diff options
| author | ruki <[email protected]> | 2023-10-31 00:48:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-10-31 00:48:16 +0800 |
| commit | e4d57fb4ad458764a1a1b9488f70fe717036b3f8 (patch) | |
| tree | 6f0eae366efbea3a266453d3e9a384ff35149978 | |
| parent | 55fdd62b7317a15ea59e31ee0c2d48ee27bf683a (diff) | |
improve to test compile
| -rw-r--r-- | tests/actions/test/xmake.lua | 8 | ||||
| -rw-r--r-- | xmake/actions/test/main.lua | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/actions/test/xmake.lua b/tests/actions/test/xmake.lua index 641b4c764..328e817dd 100644 --- a/tests/actions/test/xmake.lua +++ b/tests/actions/test/xmake.lua @@ -17,4 +17,10 @@ target("test_10") set_kind("binary") set_default(false) add_files("src/compile.cpp") - add_tests("compile", {build_should_fail = true}) + add_tests("compile_fail", {build_should_fail = true}) + +target("test_11") + set_kind("binary") + set_default(false) + add_files("src/compile.cpp") + add_tests("compile_pass", {build_should_pass = true}) diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua index 5958325bc..a4a0b4840 100644 --- a/xmake/actions/test/main.lua +++ b/xmake/actions/test/main.lua @@ -384,7 +384,11 @@ function main() local targetnames = {} for _, testinfo in table.orderpairs(tests) do local targetname = testinfo.target:name() - if testinfo.build_should_fail then + if testinfo.build_should_pass then + local passed, errors = _try_build_target(targetname) + testinfo.passed = passed + testinfo.errors = errors + elseif testinfo.build_should_fail then local built, _ = _try_build_target(targetname) testinfo.passed = not built if built then |
