diff --git a/tests/misc/neko/projects/Issue10937/Main.hx b/tests/misc/neko/projects/Issue10937/Main.hx new file mode 100644 index 00000000000..52afe81b827 --- /dev/null +++ b/tests/misc/neko/projects/Issue10937/Main.hx @@ -0,0 +1,70 @@ +import sys.io.Process; + +using StringTools; + +enum abstract Arch(String) { + final Arm64; + final Arm; + final X86; + final X86_64; + + public function getNdllSuffix():String { + return switch abstract { + case Arm64: "Arm64"; + case Arm: "Arm"; + case X86_64: "64"; + case X86: ""; + }; + } +} + +function getArchWindows() { + return switch Sys.getEnv("PROCESSOR_ARCHITECTURE") { + case "x86": X86; + case "AMD64": X86_64; + case "ARM64": Arm64; + case other: throw 'Unknown CPU architecture: $other'; + }; +} + +function getArchUnix() { + final uname = new Process("uname", ["-m"]); + + final arch = try { + uname.stdout.readLine(); + } catch (e:haxe.io.Eof) { + ""; + }; + + uname.kill(); + uname.close(); + + return switch arch { + case "x86_64" | "amd64": X86_64; + case "i386" | "x86": X86; + case "arm64" | "aarch64": Arm64; + case "arm": Arm; + case other: throw 'Unknown CPU architecture: "$other"'; + }; +} + +function getArch() { + return switch Sys.systemName() { + case "Windows": getArchWindows(); + default: getArchUnix(); + }; +} + +function main() { + final arch = getArch(); + + final expectedNdllSubDir = Sys.systemName() + arch.getNdllSuffix() + "/"; + + final ndllPath = neko.vm.Loader.local().getPath()[0]; + + if (ndllPath.endsWith(expectedNdllSubDir)) { + Sys.println("Success"); + } else { + Sys.println('Failure: Expected $ndllPath to end with $expectedNdllSubDir'); + } +} diff --git a/tests/misc/neko/projects/Issue10937/aaa-setup.hxml b/tests/misc/neko/projects/Issue10937/aaa-setup.hxml new file mode 100644 index 00000000000..4df3669912d --- /dev/null +++ b/tests/misc/neko/projects/Issue10937/aaa-setup.hxml @@ -0,0 +1 @@ +--cmd haxelib dev dummy_ndll dummy_ndll diff --git a/tests/misc/neko/projects/Issue10937/compile.hxml b/tests/misc/neko/projects/Issue10937/compile.hxml new file mode 100644 index 00000000000..dacc92e2c02 --- /dev/null +++ b/tests/misc/neko/projects/Issue10937/compile.hxml @@ -0,0 +1,4 @@ +--main Main +--neko bin/main.n +-lib dummy_ndll +--cmd neko bin/main.n diff --git a/tests/misc/neko/projects/Issue10937/compile.hxml.stdout b/tests/misc/neko/projects/Issue10937/compile.hxml.stdout new file mode 100644 index 00000000000..35821117c87 --- /dev/null +++ b/tests/misc/neko/projects/Issue10937/compile.hxml.stdout @@ -0,0 +1 @@ +Success diff --git a/tests/misc/neko/projects/Issue10937/dummy_ndll/ndll/.exists b/tests/misc/neko/projects/Issue10937/dummy_ndll/ndll/.exists new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/misc/neko/run.hxml b/tests/misc/neko/run.hxml new file mode 100644 index 00000000000..ddd91b1b97c --- /dev/null +++ b/tests/misc/neko/run.hxml @@ -0,0 +1,2 @@ +-cp ../src +--run Main diff --git a/tests/runci/targets/Neko.hx b/tests/runci/targets/Neko.hx index f37b61eea18..549992dbd9a 100644 --- a/tests/runci/targets/Neko.hx +++ b/tests/runci/targets/Neko.hx @@ -8,6 +8,9 @@ class Neko { runCommand("haxe", ["compile-neko.hxml", "-D", "dump", "-D", "dump_ignore_var_ids"].concat(args)); runCommand("neko", ["bin/unit.n"]); + changeDirectory(getMiscSubDir('neko')); + runCommand("haxe", ["run.hxml"].concat(args)); + changeDirectory(sysDir); runCommand("haxe", ["compile-neko.hxml"].concat(args)); runSysTest("neko", ["bin/neko/sys.n"]);