From 65a950ee174ac6cb508c5bab8e6f1dbaa31fd2be Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 1 Nov 2023 22:47:48 +0800 Subject: compile test stub --- tests/actions/test/src/compile.cpp | 6 ------ tests/actions/test/src/compile_1.cpp | 6 ++++++ tests/actions/test/src/compile_2.cpp | 6 ++++++ tests/actions/test/xmake.lua | 4 ++-- xmake/actions/test/main.lua | 11 +++++++++++ 5 files changed, 25 insertions(+), 8 deletions(-) delete mode 100644 tests/actions/test/src/compile.cpp create mode 100644 tests/actions/test/src/compile_1.cpp create mode 100644 tests/actions/test/src/compile_2.cpp diff --git a/tests/actions/test/src/compile.cpp b/tests/actions/test/src/compile.cpp deleted file mode 100644 index adfe8588c..000000000 --- a/tests/actions/test/src/compile.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char** argv) { - static_assert(0, "error"); - return 0; -} diff --git a/tests/actions/test/src/compile_1.cpp b/tests/actions/test/src/compile_1.cpp new file mode 100644 index 000000000..adfe8588c --- /dev/null +++ b/tests/actions/test/src/compile_1.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char** argv) { + static_assert(0, "error"); + return 0; +} 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 + +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") -- cgit v1.3.1