summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-18 15:07:54 +0800
committerGitHub <[email protected]>2025-12-18 15:07:54 +0800
commit67019f3310fe67e365c24df2a47806bf3fd947e5 (patch)
tree54c91c9642350220003ebaaddedbc2303add1cd7 /tests/projects
parenta33624639549e6dda946a810f175fc0e9cfc79b3 (diff)
parent2ff05c59d4c3aa6b23b8d521d9173c0860109019 (diff)
Merge pull request #7145 from xmake-io/clangrt
Improve clang runtime
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/c++/modules/test_base.lua7
-rw-r--r--tests/projects/c/llvm_compiler_rt/src/main.c5
-rw-r--r--tests/projects/c/llvm_compiler_rt/test.lua29
-rw-r--r--tests/projects/c/llvm_compiler_rt/xmake.lua3
4 files changed, 42 insertions, 2 deletions
diff --git a/tests/projects/c++/modules/test_base.lua b/tests/projects/c++/modules/test_base.lua
index 6abbeecee..466a59e98 100644
--- a/tests/projects/c++/modules/test_base.lua
+++ b/tests/projects/c++/modules/test_base.lua
@@ -11,7 +11,7 @@ MSVC_MIN_VER = "14.29"
function _build(check_outdata)
local flags = ""
if ci_is_running() then
- flags = "-vD"
+ flags = "-vD"
end
if check_outdata then
local outdata
@@ -101,9 +101,12 @@ function build_tests(toolchain_name, opt)
if opt.flags then
flags = " " .. table.concat(opt.flags, " ")
end
+ if ci_is_running() then
+ flags = flags .. " -vD"
+ 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..6285ecb1a
--- /dev/null
+++ b/tests/projects/c/llvm_compiler_rt/test.lua
@@ -0,0 +1,29 @@
+import("lib.detect.find_tool")
+import("core.tool.toolchain")
+import("utils.ci.is_running", {alias = "ci_is_running"})
+
+function run_test(toolchain_name)
+ local flags = ""
+ if ci_is_running() then
+ flags = "-vD"
+ end
+
+ local plat = os.host()
+ local arch = os.arch()
+ if is_subhost("msys") then
+ plat = "mingw"
+ end
+ local toolchain_inst = toolchain.load(toolchain_name, {plat = plat, arch = arch})
+ if not toolchain_inst or not toolchain_inst:check() then
+ wprint(toolchain_name .. " not found, skipping tests")
+ return
+ end
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=" .. toolchain_name .. " -c --yes " .. flags)
+ os.run("xmake -r " .. flags)
+end
+
+function main(t)
+ run_test("llvm")
+ run_test("clang")
+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")