summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules/test_dependency_scanner.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-05-21 01:37:17 +0200
committerArthur LAURENT <[email protected]>2025-05-21 04:53:30 +0200
commit8b4e9f90ba045edb14cb2800c506ee6bc5118cd7 (patch)
treeffa4bc5edf9e19d953689fde3cc811382397e786 /tests/projects/c++/modules/test_dependency_scanner.lua
parentbfc0f75db8c238187aa011f522adf9685e023b31 (diff)
(C++ modules support) refactor tests
Diffstat (limited to 'tests/projects/c++/modules/test_dependency_scanner.lua')
-rw-r--r--tests/projects/c++/modules/test_dependency_scanner.lua70
1 files changed, 11 insertions, 59 deletions
diff --git a/tests/projects/c++/modules/test_dependency_scanner.lua b/tests/projects/c++/modules/test_dependency_scanner.lua
index 5f56113c2..c27b52887 100644
--- a/tests/projects/c++/modules/test_dependency_scanner.lua
+++ b/tests/projects/c++/modules/test_dependency_scanner.lua
@@ -1,9 +1,12 @@
-import("lib.detect.find_tool")
-import("core.base.semver")
+inherit("test_base")
import("utils.ci.is_running", {alias = "ci_is_running"})
-function _build()
- os.run("xmake f --foo=n --policies=build.c++.modules.std:n")
+CLANG_MIN_VER = "17"
+GCC_MIN_VER = "11"
+MSVC_MIN_VER = "14.29"
+
+function _build(platform, toolchain_name, runtimes, policies, flags)
+ os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-c --yes " .. policies .. " --foo=n")
local outdata
if ci_is_running() then
outdata = os.iorun("xmake -rvD")
@@ -15,62 +18,11 @@ function _build()
raise("Modules dependency scanner update does not work\n%s", outdata)
end
end
- outdata = os.iorun("xmake")
- if outdata then
- if outdata:find("compiling") or outdata:find("linking") or outdata:find("generating") then
- raise("Modules incremental compilation does not work\n%s", outdata)
- end
- end
-end
-
-function can_build()
- if is_subhost("windows") then
- return true
- elseif is_subhost("msys") then
- return true
- elseif is_host("linux") then
- local gcc = find_tool("gcc", {version = true})
- if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
- return true
- end
- local clang = find_tool("clang", {version = true})
- if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
- return true
- end
- end
end
function main(t)
- if is_subhost("windows") then
- local clang = find_tool("clang", {version = true})
- if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then
- os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
- _build()
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
- _build()
- end
-
- os.exec("xmake clean -a")
- os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
- _build()
- elseif is_subhost("msys") then
- os.exec("xmake f -c -p mingw --yes --policies=build.c++.modules.std:n")
- _build()
- elseif is_host("linux") then
- local gcc = find_tool("gcc", {version = true})
- if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
- os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
- _build()
- end
- local clang = find_tool("clang", {version = true})
- if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
- _build()
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
- _build()
- end
- end
+ local clang_options = {compiler = "clang", version = CLANG_MIN_VER, flags = {"--foo=y"}, after_build = _build}
+ local gcc_options = {compiler = "gcc", version = GCC_MIN_VER, flags = {"--foo=y"}, after_build = _build}
+ local msvc_options = {version = MSVC_MIN_VER, flags = {"--foo=y"}, after_build = _build}
+ run_tests(clang_options, gcc_options, msvc_options)
end