From 6f5018cc4bab2cbdc4cc0c022adf8e6b2d2434fe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 14:28:19 -0300 Subject: [PATCH 01/11] Update s7 revision to 1-Dec-2024 release --- s7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s7 b/s7 index 8521f28..828a36b 160000 --- a/s7 +++ b/s7 @@ -1 +1 @@ -Subproject commit 8521f288ed8434bcdd72b374182b37d88acf5683 +Subproject commit 828a36b8f02e87b75f78b691a6686ea512b83416 From 5ec812f67932d067c73c4d94d6a957a1f04d23d7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 14:29:01 -0300 Subject: [PATCH 02/11] Re-enable builds on windows platforms This reverts commit f60ab5b0ccf89e3071218c702f4eebdded5d44fd. --- .github/workflows/builds.yml | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index ae84c98..bb154bf 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -21,17 +21,17 @@ jobs: target-type: template_debug os: ubuntu-20.04 -# - platform: windows -# float-precision: single -# arch: x86_32 -# target-type: template_debug -# os: windows-latest - -# - platform: windows -# float-precision: single -# arch: x86_64 -# target-type: template_debug -# os: windows-latest + - platform: windows + float-precision: single + arch: x86_32 + target-type: template_debug + os: windows-latest + + - platform: windows + float-precision: single + arch: x86_64 + target-type: template_debug + os: windows-latest - platform: macos float-precision: single @@ -144,17 +144,17 @@ jobs: target-type: template_debug os: ubuntu-20.04 -# - platform: windows -# float-precision: double -# arch: x86_32 -# target-type: template_debug -# os: windows-latest - -# - platform: windows -# float-precision: double -# arch: x86_64 -# target-type: template_debug -# os: windows-latest + - platform: windows + float-precision: double + arch: x86_32 + target-type: template_debug + os: windows-latest + + - platform: windows + float-precision: double + arch: x86_64 + target-type: template_debug + os: windows-latest - platform: macos float-precision: double From 85d53c380827d4dc7a7950f8996feeaff2e50d2a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 14:55:21 -0300 Subject: [PATCH 03/11] Split s7 target so it is built with C compiler --- SConstruct | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index 4a428da..316a7a7 100644 --- a/SConstruct +++ b/SConstruct @@ -32,7 +32,7 @@ const char* {constant_name} = R"({file_content})"; """) def is_submodule_initialized(path): - return os.path.isdir(path) and os.listdir(path) + return os.path.isdir(path) and os.listdir(path) # -------------------------- Build definition -------------------------- @@ -64,15 +64,23 @@ env.Append( "DISABLE_AUTOLOAD": "1", "WITH_C_LOADER": "0", "WITH_MULTITHREAD_CHECKS": "0", - "WITH_SYSTEM_EXTRAS": "0", - "HAVE_COMPLEX_NUMBERS": "0" if env["platform"] == "windows" else "1" + "WITH_SYSTEM_EXTRAS": "0" } ) +s7_env = env.Clone() +s7_obj = s7_env.SharedObject(target='s7', source='s7/s7.c') +if s7_env["platform"] == "windows": + s7_env.Append( + CCFLAGS=['/std:c17'], + CPPDEFINES={ + "HAVE_COMPLEX_NUMBERS": "0" + } + ) + sources = [ Glob("src/*.cpp"), - Glob("src/repl/*.cpp"), - Glob("s7/s7.c") + Glob("src/repl/*.cpp") ] if env["target"] in ["editor", "template_debug"]: @@ -92,7 +100,7 @@ if env["platform"] == "macos" or env["platform"] == "ios": library_file = "bin/{}/{}{}".format(env["platform"], file_path, file) library = env.SharedLibrary( library_file, - source=sources, + source=sources + [s7_obj], ) copy = env.InstallAs("{}/bin/{}/{}lib{}".format(project_dir, env["platform"], file_path, file), library) From e01d6602224074a9bfe13054a633590041962100 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 16:00:34 -0300 Subject: [PATCH 04/11] On windows, only test if arch == x86_64 --- .github/workflows/builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index bb154bf..8b2ae2a 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -286,13 +286,13 @@ jobs: # Test - name: Setup Godot Action - if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'windows') }} + if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || (matrix.platform == 'windows' && matrix.arch == 'x86_64')) }} uses: chickensoft-games/setup-godot@v2.1.1 with: version: 4.3.0 use-dotnet: false - name: Test - if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'windows') }} + if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || (matrix.platform == 'windows' && matrix.arch == 'x86_64')) }} run: make test -j # Sign From 437380ec1ab83e4611c675fe647da2d710a23d0d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 16:01:52 -0300 Subject: [PATCH 05/11] Get godot location from `GODOT` environment variable --- test/test-main.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-main.scm b/test/test-main.scm index 8c54a96..d196644 100644 --- a/test/test-main.scm +++ b/test/test-main.scm @@ -7,7 +7,8 @@ (error 'assertion-error "ERROR~%# (assert-equals ~a ~a)~%## ~a~%`~a`~%## ~a~%`~a`" lq rq lq l' rq r'))))) (define (godot scene) - (system (format #f "godot --path demo ~a --headless --quit" scene) #t)) + (let ((program (or (getenv "GODOT") "godot"))) + (system (format #f "~a --path demo ~a --headless --quit" program scene) #t))) (define (read-file path) (call-with-input-file path From 18ca9ef83d23b73ab7346c98d969b78d588fbe4f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 16:39:44 -0300 Subject: [PATCH 06/11] Dump test command line to the console --- test/test-main.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test-main.scm b/test/test-main.scm index d196644..d722346 100644 --- a/test/test-main.scm +++ b/test/test-main.scm @@ -7,8 +7,10 @@ (error 'assertion-error "ERROR~%# (assert-equals ~a ~a)~%## ~a~%`~a`~%## ~a~%`~a`" lq rq lq l' rq r'))))) (define (godot scene) - (let ((program (or (getenv "GODOT") "godot"))) - (system (format #f "~a --path demo ~a --headless --quit" program scene) #t))) + (let* ((program (or (getenv "GODOT") "godot")) + (cmd (format #f "~a --path demo ~a --headless --quit" program scene))) + (format #t "~a~%" cmd) + (system cmd #t))) (define (read-file path) (call-with-input-file path From f1a75d38ec0a0708d9921bc9c62f487579643055 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 17:20:56 -0300 Subject: [PATCH 07/11] Quote program when running test scene --- test/test-main.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-main.scm b/test/test-main.scm index d722346..66b9f32 100644 --- a/test/test-main.scm +++ b/test/test-main.scm @@ -8,7 +8,7 @@ (define (godot scene) (let* ((program (or (getenv "GODOT") "godot")) - (cmd (format #f "~a --path demo ~a --headless --quit" program scene))) + (cmd (format #f "\"~a\" --path demo ~a --headless --quit" program scene))) (format #t "~a~%" cmd) (system cmd #t))) From 50c7e9b0e8555d41b2d6521bd9b8208b7b92caea Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 17:23:11 -0300 Subject: [PATCH 08/11] Set /std:c17 on windows --- SConstruct | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 316a7a7..f89fb7a 100644 --- a/SConstruct +++ b/SConstruct @@ -72,10 +72,7 @@ s7_env = env.Clone() s7_obj = s7_env.SharedObject(target='s7', source='s7/s7.c') if s7_env["platform"] == "windows": s7_env.Append( - CCFLAGS=['/std:c17'], - CPPDEFINES={ - "HAVE_COMPLEX_NUMBERS": "0" - } + CCFLAGS=['/std:c17'] ) sources = [ From 3e8be0beb095bc1410a6ae16c4aa52d18fd0721c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 17:46:13 -0300 Subject: [PATCH 09/11] Let diff with golden test file ignore trailling cr For compatibility with windows. And let GitHub action set GODOT_EXE env var on windows. --- .github/workflows/builds.yml | 3 +++ test/test-main.scm | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 8b2ae2a..f8616d6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -291,6 +291,9 @@ jobs: with: version: 4.3.0 use-dotnet: false + - name: Set GODOT_EXE on windows + if: ${{ matrix.platform == 'windows' }} + run: echo "GODOT_EXE=C:\Users\runneradmin\godot\Godot_v4.3-stable_win64.exe" >> $env:GITHUB_ENV - name: Test if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || (matrix.platform == 'windows' && matrix.arch == 'x86_64')) }} run: make test -j diff --git a/test/test-main.scm b/test/test-main.scm index 66b9f32..ba29c13 100644 --- a/test/test-main.scm +++ b/test/test-main.scm @@ -7,7 +7,7 @@ (error 'assertion-error "ERROR~%# (assert-equals ~a ~a)~%## ~a~%`~a`~%## ~a~%`~a`" lq rq lq l' rq r'))))) (define (godot scene) - (let* ((program (or (getenv "GODOT") "godot")) + (let* ((program (or (getenv "GODOT_EXE") (getenv "GODOT") "godot")) (cmd (format #f "\"~a\" --path demo ~a --headless --quit" program scene))) (format #t "~a~%" cmd) (system cmd #t))) @@ -16,12 +16,16 @@ (call-with-input-file path (lambda (p) (read-string 65535 p)))) +(define (diff file1 file2) + (system (format #f "diff --strip-trailing-cr --color=auto -u ~a ~a" file1 file2))) + (define* (golden-scene-test scene golden-file) (let ((output-file "bin/s7_scheme_tests.txt")) (call-with-output-file output-file (lambda (p) (write-string (godot scene) p))) - (unless (= 0 (system (format #f "diff --color=auto -u ~a ~a" golden-file output-file))) - (error 'assertion-error "ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file)))) + (unless (= 0 (diff golden-file output-file)) + (error 'assertion-error + "ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file)))) (define (golden-scene-tests) (golden-scene-test From d633bbaea57d85ce21fe0cea2967a8117efd310d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 30 Nov 2024 18:33:36 -0300 Subject: [PATCH 10/11] Bump egor-tension/setup-mingw@v2.2.0 --- .github/actions/build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 2294d2d..a55f576 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -78,7 +78,7 @@ runs: emcc -v # Windows only - name: Windows - Setup MinGW for Windows/MinGW build - uses: egor-tensin/setup-mingw@v2 + uses: egor-tensin/setup-mingw@v2.2.0 if: ${{ inputs.platform == 'windows' }} with: version: 12.2.0 From 1381dd856c3bd5b6470d93100306450205b6dd40 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sun, 1 Dec 2024 08:24:26 -0300 Subject: [PATCH 11/11] Adjust test not to rely on *stdout* being flushed on windows --- demo/addons/s7/test/s7_scheme_tests.gd | 2 +- test/golden/s7_scheme_tests.txt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/demo/addons/s7/test/s7_scheme_tests.gd b/demo/addons/s7/test/s7_scheme_tests.gd index 63cc8ba..8951dc1 100644 --- a/demo/addons/s7/test/s7_scheme_tests.gd +++ b/demo/addons/s7/test/s7_scheme_tests.gd @@ -22,7 +22,7 @@ func apply(symbol: String, args: Array): return r func can_exchange_primitive_values(): - eval("(format #t \"Hello from Scheme!\n\")") + eval("(format #f \"Hello from Scheme!~%\")") define("an-integer", 41) eval("an-integer") diff --git a/test/golden/s7_scheme_tests.txt b/test/golden/s7_scheme_tests.txt index c6ff6c4..1d09585 100644 --- a/test/golden/s7_scheme_tests.txt +++ b/test/golden/s7_scheme_tests.txt @@ -1,8 +1,6 @@ Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org -Hello from Scheme! -(format #t "Hello from Scheme! -")=>String(Hello from Scheme! +(format #f "Hello from Scheme!~%")=>String(Hello from Scheme! ) an-integer=>int(41) (+ 1 an-integer)=>int(42)