summaryrefslogtreecommitdiff
path: root/tests/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2026-05-11 13:57:30 +0800
committerGitHub <[email protected]>2026-05-11 13:57:30 +0800
commitfe5d4800ea9c524c06cc54c52afa3955da2612f1 (patch)
treef72fe3c09ea76809ada5f98bee28cf6e1911d30e /tests/modules
parentc14b01fd77d4d31376f03263e9833deadb998e4e (diff)
parent70f6ecdc9aeecabeee5727867b3dae13d006c82f (diff)
Merge pull request #7535 from xmake-io/ascend
Add Huawei Ascend C toolchain support
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/language/ascendc/test.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/modules/language/ascendc/test.lua b/tests/modules/language/ascendc/test.lua
new file mode 100644
index 000000000..507bff9ec
--- /dev/null
+++ b/tests/modules/language/ascendc/test.lua
@@ -0,0 +1,34 @@
+import("core.language.language")
+
+function _write_asc_file(name, source)
+ local sourcefile = os.tmpfile(name) .. ".asc"
+ io.writefile(sourcefile, source)
+ return sourcefile
+end
+
+function test_check_main(t)
+ local instance = language.load("ascendc")
+ t:require(instance)
+
+ local check_main = instance:get("check_main")
+ t:require(check_main)
+
+ local mainfile = _write_asc_file("ascendc_check_main", [[
+#include "acl/acl.h"
+
+int32_t main(int argc, char const *argv[]) {
+ return 0;
+}
+]])
+ t:are_equal(check_main(mainfile), true)
+
+ local commentfile = _write_asc_file("ascendc_check_main_comment", [[
+// int main() { return 0; }
+/*
+int main() { return 1; }
+*/
+__global__ __vector__ void kernel() {
+}
+]])
+ t:are_equal(check_main(commentfile), false)
+end