diff options
| author | ruki <[email protected]> | 2023-11-01 22:47:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-01 22:47:48 +0800 |
| commit | 65a950ee174ac6cb508c5bab8e6f1dbaa31fd2be (patch) | |
| tree | 0785b55f490ad55a46d3d7018f4e4c4512b368e3 | |
| parent | 3ba30810808986745dc0644ce495e3ab46d41291 (diff) | |
compile test stub
| -rw-r--r-- | tests/actions/test/src/compile_1.cpp (renamed from tests/actions/test/src/compile.cpp) | 0 | ||||
| -rw-r--r-- | tests/actions/test/src/compile_2.cpp | 6 | ||||
| -rw-r--r-- | tests/actions/test/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/test/main.lua | 11 |
4 files changed, 19 insertions, 2 deletions
diff --git a/tests/actions/test/src/compile.cpp b/tests/actions/test/src/compile_1.cpp index adfe8588c..adfe8588c 100644 --- a/tests/actions/test/src/compile.cpp +++ b/tests/actions/test/src/compile_1.cpp diff --git a/tests/actions/test/src/compile_2.cpp b/tests/actions/test/src/compile_2.cpp new file mode 100644 index 000000000..adfe8588c --- /dev/null +++ b/tests/actions/test/src/compile_2.cpp @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main(int argc, char** argv) { + static_assert(0, "error"); + return 0; +} diff --git a/tests/actions/test/xmake.lua b/tests/actions/test/xmake.lua index 83718245f..a4f75036d 100644 --- a/tests/actions/test/xmake.lua +++ b/tests/actions/test/xmake.lua @@ -16,13 +16,13 @@ end target("test_10") set_kind("binary") set_default(false) - add_files("src/compile.cpp") + add_files("src/compile_1.cpp") add_tests("compile_fail", {build_should_fail = true}) target("test_11") set_kind("binary") set_default(false) - add_files("src/compile.cpp") + add_files("src/compile_2.cpp") add_tests("compile_pass", {build_should_pass = true}) target("test_13") diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua index d73274a28..2bb5dfe23 100644 --- a/xmake/actions/test/main.lua +++ b/xmake/actions/test/main.lua @@ -351,6 +351,17 @@ function main() local testinfo = {name = testname, target = target} if extra then table.join2(testinfo, extra) + if extra.files then + local target_new = target:clone() + local scriptdir = target:scriptdir() + for _, file in ipairs(extra.files) do + file = path.absolute(file, scriptdir) + file = path.relative(file, os.projectdir()) + target_new:add("files", file, {defines = extra.defines}) + project.target_add(target_new) + end + testinfo.target = target_new + end end if not testinfo.group then testinfo.group = target:get("group") |
