summaryrefslogtreecommitdiff
path: root/xmake/actions/test/main.lua
diff options
context:
space:
mode:
author小鸡快跑 <[email protected]>2024-08-12 17:52:02 +0800
committer小鸡快跑 <[email protected]>2024-08-12 17:52:02 +0800
commit4eeaaaa589f2fff682bf56fa32489a5aedcb6463 (patch)
tree7e2c28f3a7a8abfb0f7b85c384dfe16aa8ba148f /xmake/actions/test/main.lua
parentaf3090adbb8e46ee8e3d62417e9a6dc9b06f068c (diff)
fix(plugin/project): Generate compile_commands for tests
1. Implement the get_tests_table as a function 2. Generate compile_commands for tests
Diffstat (limited to 'xmake/actions/test/main.lua')
-rw-r--r--xmake/actions/test/main.lua35
1 files changed, 20 insertions, 15 deletions
diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua
index f8314ce69..684660afc 100644
--- a/xmake/actions/test/main.lua
+++ b/xmake/actions/test/main.lua
@@ -366,20 +366,8 @@ function _try_build_target(targetname)
return passed, errors
end
-function main()
-
- -- do action for remote?
- if remote_build_action.enabled() then
- return remote_build_action()
- end
-
- -- lock the whole project
- project.lock()
-
- -- load config first
- task.run("config", {}, {disable_dump = true})
-
- -- get tests
+-- get tests table, export this for the `project` plugin
+function get_tests_table()
local tests = {}
local group_pattern = option.get("group")
if group_pattern then
@@ -440,6 +428,24 @@ function main()
end
end
end
+ return tests
+end
+
+function main()
+
+ -- do action for remote?
+ if remote_build_action.enabled() then
+ return remote_build_action()
+ end
+
+ -- lock the whole project
+ project.lock()
+
+ -- load config first
+ task.run("config", {}, {disable_dump = true})
+
+ -- get tests
+ local tests = get_tests_table()
local test_patterns = option.get("tests")
if test_patterns then
local tests_new = {}
@@ -488,4 +494,3 @@ function main()
-- unlock the whole project
project.unlock()
end
-