From 85f065de55cd0e52167bdad9fa9432a2a959168e Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 24 Mar 2026 17:37:54 +0000 Subject: [PATCH 1/5] [tests] Use auto-compiling hlc templates --- tests/runci/targets/Hl.hx | 48 +++++++-------------------------- tests/sys/compile-hlc.hxml | 6 +---- tests/sys/src/ExitCode.hx | 2 +- tests/sys/src/TestArguments.hx | 2 +- tests/sys/src/TestSys.hx | 2 +- tests/sys/src/UtilityProcess.hx | 2 +- tests/unit/compile-hlc.hxml | 5 ++-- 7 files changed, 16 insertions(+), 51 deletions(-) diff --git a/tests/runci/targets/Hl.hx b/tests/runci/targets/Hl.hx index f8fff44e48f..9c2bbf46acb 100644 --- a/tests/runci/targets/Hl.hx +++ b/tests/runci/targets/Hl.hx @@ -29,10 +29,6 @@ class Hl { static public function getHlDependencies() { Sys.putEnv("HASHLINK", hlInstallDir); - if (systemName == "Windows") { - Sys.putEnv("HASHLINK_SRC", hlInstallDir); - Sys.putEnv("HASHLINK_BIN", hlInstallBinDir); - } if (FileSystem.exists(hlBinary)) { infoMsg('hl has already been installed at $hlBinary.'); @@ -87,38 +83,13 @@ class Hl { static function buildAndRunHlc(dir:String, filename:String, ?run) { if (run == null) run = runCommand; - final compiler = if (systemName == "Mac") "clang" else "gcc"; - final extraCompilerFlags = switch (systemName) { - case "Windows": ["-ldbghelp", "-municode"]; - case "Mac": ["-rpath", hlInstallLibDir]; - case _: ['-Wl,-rpath,$hlInstallLibDir']; - }; - - runCommand(compiler, [ - "-o", '$dir/$filename.exe', - '$dir/$filename.c', - '-I$dir', - '-I$hlInstallDir/include', - '-L$hlInstallLibDir', - '$hlInstallLibDir/fmt.hdll', - '$hlInstallLibDir/ssl.hdll', - '$hlInstallLibDir/sqlite.hdll', - "-lm", - "-lhl" - ].concat(extraCompilerFlags)); - - run('$dir/$filename.exe', []); + runCommand("haxelib", ["run", "hashlink", "build", '$dir/$filename.c', "-D", "hlgen.makefile=make"]); + run('$dir/$filename', []); // Run with MSBuild if (systemName == "Windows") { - runCommand("MSBuild.exe", [ - '$dir/$filename.sln', - '-nologo', '-verbosity:minimal', - '-t:$filename', - '-property:Configuration=Release', - '-property:Platform=$msbuildPlatform' - ]); - run('$dir${msbuildPlatform == 'x64' ? '/x64' : ''}/Release/$filename.exe', []); + runCommand("haxelib", ["run", "hashlink", "build", '$dir/$filename.c', "-D", "hlgen.makefile=vs2022"]); + run('$dir${msbuildPlatform == 'x64' ? '/x64' : ''}/Debug/$filename.exe', []); } } @@ -131,7 +102,7 @@ class Hl { } if (withHlcTests) { - runCommand("haxe", [hxml, "-hl", '$target/hlc.c', "-D", "hlgen.makefile=ci"].concat(args)); + runCommand("haxe", [hxml, "-hl", '$target/hlc.c'].concat(args)); buildAndRunHlc(target, "hlc"); } } @@ -156,7 +127,7 @@ class Hl { } if (Hl.withHlcTests) { runCommand("haxe", ["compile-hlc.hxml"].concat(extraArgs).concat(haxeArgs)); - buildAndRunHlc("bin/hlc", "unit", runCommand); + buildAndRunHlc("bin/hlc", "main", runCommand); } } @@ -174,11 +145,11 @@ class Hl { buildAndRunHlc("bin/hlc/testArguments", "TestArguments", dontRun); buildAndRunHlc("bin/hlc/exitCode", "ExitCode", dontRun); buildAndRunHlc("bin/hlc/utilityProcess", "UtilityProcess", dontRun); - buildAndRunHlc("bin/hlc/sys", "sys", (cmd, ?args) -> runSysTest(FileSystem.fullPath(cmd), args)); + buildAndRunHlc("bin/hlc/sys", "main", (cmd, ?args) -> runSysTest(FileSystem.fullPath(cmd), args)); } changeDirectory(getMiscSubDir("cross", "eventLoop")); - buildAndRun("build-hl.hxml", "bin/eventLoop"); + buildAndRun("build-hl.hxml", "bin/eventLoop", haxeArgs); // these are generic tests for genhl which shouldn't actually execute the .hl using hl jit, // so they are not skipped with --skip-hl-jit @@ -189,8 +160,7 @@ class Hl { runCommand("haxe", ["run-base.hxml", "--run", "Main", "hl"]); if (Hl.withHlcTests) { - final hlcTemplateDefine = systemName == "Windows" ? "hlgen.makefile=vs2022" : "hlgen.makefile=make"; - runCommand("haxe", ["run-base.hxml", "--run", "Main", "hlc", "-D", hlcTemplateDefine].concat(haxeArgs)); + runCommand("haxe", ["run-base.hxml", "--run", "Main", "hlc", "-D", "hlgen.makefile"].concat(haxeArgs)); } } } diff --git a/tests/sys/compile-hlc.hxml b/tests/sys/compile-hlc.hxml index 4f0bdb8c814..dc3ef812084 100644 --- a/tests/sys/compile-hlc.hxml +++ b/tests/sys/compile-hlc.hxml @@ -1,22 +1,18 @@ compile-each.hxml --main Main --hl bin/hlc/sys/sys.c --D hlgen.makefile=ci +-hl bin/hlc/sys/main.c --next compile-each.hxml --main TestArguments -hl bin/hlc/testArguments/TestArguments.c --D hlgen.makefile=ci --next compile-each.hxml --main ExitCode -hl bin/hlc/exitCode/ExitCode.c --D hlgen.makefile=ci --next compile-each.hxml --main UtilityProcess -hl bin/hlc/utilityProcess/UtilityProcess.c --D hlgen.makefile=ci diff --git a/tests/sys/src/ExitCode.hx b/tests/sys/src/ExitCode.hx index e555eb33497..b3ad76a1b1b 100644 --- a/tests/sys/src/ExitCode.hx +++ b/tests/sys/src/ExitCode.hx @@ -13,7 +13,7 @@ class ExitCode { "bin/neko/ExitCode.n"; #elseif hl #if hlc - "bin/hlc/exitCode/ExitCode.exe"; + "bin/hlc/exitCode/ExitCode"; #else "bin/hl/ExitCode.hl"; #end diff --git a/tests/sys/src/TestArguments.hx b/tests/sys/src/TestArguments.hx index 2afe7b906f9..e8d6b519d74 100644 --- a/tests/sys/src/TestArguments.hx +++ b/tests/sys/src/TestArguments.hx @@ -73,7 +73,7 @@ class TestArguments extends utest.Test { "bin/neko/TestArguments.n"; #elseif hl #if hlc - "bin/hlc/testArguments/TestArguments.exe"; + "bin/hlc/testArguments/TestArguments"; #else "bin/hl/TestArguments.hl"; #end diff --git a/tests/sys/src/TestSys.hx b/tests/sys/src/TestSys.hx index 0e4a056d8ef..8374dcc455c 100644 --- a/tests/sys/src/TestSys.hx +++ b/tests/sys/src/TestSys.hx @@ -125,7 +125,7 @@ class TestSys extends TestCommandBase { "sys.js" #elseif hl #if hlc - "sys.exe" + "main" + (Sys.systemName() == "Windows" ? ".exe" : "") #else "sys.hl" #end diff --git a/tests/sys/src/UtilityProcess.hx b/tests/sys/src/UtilityProcess.hx index 1c05b6b4072..132478ceea1 100644 --- a/tests/sys/src/UtilityProcess.hx +++ b/tests/sys/src/UtilityProcess.hx @@ -48,7 +48,7 @@ class UtilityProcess { #end #elseif hl #if hlc - "UtilityProcess.exe"; + "UtilityProcess"; #else "UtilityProcess.hl"; #end diff --git a/tests/unit/compile-hlc.hxml b/tests/unit/compile-hlc.hxml index 237ed1daed9..a64f29360a5 100644 --- a/tests/unit/compile-hlc.hxml +++ b/tests/unit/compile-hlc.hxml @@ -1,8 +1,7 @@ compile-each.hxml --main unit.TestMain --hl bin/hlc/unit.c +-hl bin/hlc/main.c #-D interp -D hl-check -D hl-ver=1.16.0 --D hlgen.makefile=ci --D UTEST-PRINT-TESTS \ No newline at end of file +-D UTEST-PRINT-TESTS From c77244e28c9bc9e4bdc52f3678bd7a56a44f40d8 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 24 Mar 2026 20:23:15 +0000 Subject: [PATCH 2/5] [ci] Remove msbuild setup step for hlc tests Now that we use the auto-compiling hlc templates, we no longer need to have msbuild in path. --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 079bd461609..d8bb786b6eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -478,12 +478,6 @@ jobs: mkdir "$env:HAXELIB_ROOT" haxelib setup "$env:HAXELIB_ROOT" - - name: Add msbuild to PATH (hl/c) - uses: microsoft/setup-msbuild@v2 - if: matrix.target == 'hl' - with: - msbuild-architecture: x64 - - name: Cache Lua environments uses: ./.github/actions/cache-lua if: matrix.target == 'lua' From 4daa2cb9dae55d67a0f1163b4c1931795ab90095 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 24 Mar 2026 19:51:53 +0000 Subject: [PATCH 3/5] [tests] Fix hlc utility process symlink --- tests/sys/gen_test_res.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/gen_test_res.py b/tests/sys/gen_test_res.py index fac084673bd..e6f4a09377a 100755 --- a/tests/sys/gen_test_res.py +++ b/tests/sys/gen_test_res.py @@ -81,7 +81,7 @@ ("../../bin/cpp/UtilityProcess", "bin-cpp"), ("../../bin/cppia/UtilityProcess.cppia", "bin-cppia"), ("../../bin/hl/UtilityProcess.hl", "bin-hl"), - ("../../bin/hlc/utilityProcess/UtilityProcess.exe", "bin-hlc"), + ("../../bin/hlc/utilityProcess/UtilityProcess", "bin-hlc"), ("../../bin/lua/UtilityProcess.lua", "bin-lua"), ("../../bin/java/UtilityProcess-Debug.jar", "bin-java-debug"), ("../../bin/java/UtilityProcess.jar", "bin-java"), From 3848abdb8962029fd7988848b92efe6d8a04a285 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 24 Mar 2026 22:37:47 +0000 Subject: [PATCH 4/5] [tests] Compile all hlc tests using debug --- tests/runci/targets/Hl.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/runci/targets/Hl.hx b/tests/runci/targets/Hl.hx index 9c2bbf46acb..cdbbf29cf5c 100644 --- a/tests/runci/targets/Hl.hx +++ b/tests/runci/targets/Hl.hx @@ -102,7 +102,7 @@ class Hl { } if (withHlcTests) { - runCommand("haxe", [hxml, "-hl", '$target/hlc.c'].concat(args)); + runCommand("haxe", [hxml, "-hl", '$target/hlc.c'].concat(args).concat(["--debug"])); buildAndRunHlc(target, "hlc"); } } From 5b0a2681aa9298acf307cdd138e10ceb6a038684 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 24 Mar 2026 22:37:23 +0000 Subject: [PATCH 5/5] [tests] Use jumbo build for hlc with mingw make Mingw make is much faster with the jumbo build. --- tests/runci/targets/Hl.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/runci/targets/Hl.hx b/tests/runci/targets/Hl.hx index cdbbf29cf5c..a4b0268ac98 100644 --- a/tests/runci/targets/Hl.hx +++ b/tests/runci/targets/Hl.hx @@ -83,7 +83,8 @@ class Hl { static function buildAndRunHlc(dir:String, filename:String, ?run) { if (run == null) run = runCommand; - runCommand("haxelib", ["run", "hashlink", "build", '$dir/$filename.c', "-D", "hlgen.makefile=make"]); + runCommand("haxelib", ["run", "hashlink", "build", '$dir/$filename.c', "-D", "hlgen.makefile=make"] + .concat(systemName == "Windows" ? ["-D", "hlgen.makefile.jumbo"] : [])); run('$dir/$filename', []); // Run with MSBuild