summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-10-31 19:51:35 +0100
committerruki <[email protected]>2025-12-18 09:31:43 +0800
commit7a1be435eef977b88a2855df9bafc4ebeca1843e (patch)
tree687371e4df59a735060f25082322e7062984be71
parent2a81ad148a079dd0cb42c045b8d532b61d154e50 (diff)
nfc(llvm) add a test for llvm builtins
-rw-r--r--tests/projects/c++/modules/test_base.lua2
-rw-r--r--tests/projects/c/llvm_compiler_rt/src/main.c5
-rw-r--r--tests/projects/c/llvm_compiler_rt/test.lua18
-rw-r--r--tests/projects/c/llvm_compiler_rt/xmake.lua3
4 files changed, 27 insertions, 1 deletions
diff --git a/tests/projects/c++/modules/test_base.lua b/tests/projects/c++/modules/test_base.lua
index 6abbeecee..0a0d07dae 100644
--- a/tests/projects/c++/modules/test_base.lua
+++ b/tests/projects/c++/modules/test_base.lua
@@ -103,7 +103,7 @@ function build_tests(toolchain_name, opt)
end
os.exec("xmake clean -a")
- os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-cD --yes " .. policies .. flags)
+ os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-c --yes " .. policies .. flags)
if opt.build then
opt.build()
else
diff --git a/tests/projects/c/llvm_compiler_rt/src/main.c b/tests/projects/c/llvm_compiler_rt/src/main.c
new file mode 100644
index 000000000..e12ade9ad
--- /dev/null
+++ b/tests/projects/c/llvm_compiler_rt/src/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+ __int128 a = 123;
+ __int128 b = 1;
+ return a / b;
+}
diff --git a/tests/projects/c/llvm_compiler_rt/test.lua b/tests/projects/c/llvm_compiler_rt/test.lua
new file mode 100644
index 000000000..3d9fd2cad
--- /dev/null
+++ b/tests/projects/c/llvm_compiler_rt/test.lua
@@ -0,0 +1,18 @@
+import("lib.detect.find_tool")
+import("utils.ci.is_running", {alias = "ci_is_running"})
+
+function main(t)
+ local flags = ""
+ if ci_is_running() then
+ flags = "-vD"
+ end
+
+ local cc = find_tool("clang", {version = true})
+ if not cc then
+ wprint("clang not found, skipping tests")
+ return
+ end
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=llvm -c --yes " .. flags)
+ os.run("xmake -r " .. flags)
+end
diff --git a/tests/projects/c/llvm_compiler_rt/xmake.lua b/tests/projects/c/llvm_compiler_rt/xmake.lua
new file mode 100644
index 000000000..04267d334
--- /dev/null
+++ b/tests/projects/c/llvm_compiler_rt/xmake.lua
@@ -0,0 +1,3 @@
+target("foo")
+ set_kind("binary")
+ add_files("src/main.c")