Skip to content

Commit bec2d84

Browse files
committed
(C++ modules support) refactor tests
1 parent 84b0e0a commit bec2d84

File tree

22 files changed

+283
-505
lines changed

22 files changed

+283
-505
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
inherit(".test_cmake")
Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1 @@
1-
import("lib.detect.find_tool")
2-
import("core.base.semver")
3-
import("utils.ci.is_running", {alias = "ci_is_running"})
4-
5-
function _build()
6-
local outdata
7-
if ci_is_running() then
8-
outdata = os.iorun("xmake -rvD")
9-
else
10-
outdata = os.iorun("xmake -rv")
11-
end
12-
if outdata then
13-
if outdata:find("culled") then
14-
raise("Modules culling does not work\n%s", outdata)
15-
end
16-
end
17-
end
18-
19-
function can_build()
20-
if is_subhost("windows") then
21-
return true
22-
elseif is_subhost("msys") then
23-
return true
24-
elseif is_host("linux") then
25-
local gcc = find_tool("gcc", {version = true})
26-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
27-
return true
28-
end
29-
local clang = find_tool("clang", {version = true})
30-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
31-
return true
32-
end
33-
end
34-
end
35-
36-
function main(t)
37-
if is_subhost("windows") then
38-
local clang = find_tool("clang", {version = true})
39-
if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then
40-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
41-
_build()
42-
os.exec("xmake clean -a")
43-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
44-
_build()
45-
end
46-
47-
os.exec("xmake clean -a")
48-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
49-
_build()
50-
elseif is_subhost("msys") then
51-
os.exec("xmake f -c -p mingw --yes --policies=build.c++.modules.std:n")
52-
_build()
53-
elseif is_host("linux") then
54-
local gcc = find_tool("gcc", {version = true})
55-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
56-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
57-
_build()
58-
end
59-
local clang = find_tool("clang", {version = true})
60-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
61-
os.exec("xmake clean -a")
62-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
63-
_build()
64-
os.exec("xmake clean -a")
65-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
66-
_build()
67-
end
68-
end
69-
end
1+
inherit(".test_culling")
Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1 @@
1-
import("lib.detect.find_tool")
2-
import("core.base.semver")
3-
import("utils.ci.is_running", {alias = "ci_is_running"})
4-
5-
function _build()
6-
local outdata
7-
if ci_is_running() then
8-
outdata = os.iorun("xmake -rvD")
9-
else
10-
outdata = os.iorun("xmake -rv")
11-
end
12-
if outdata then
13-
if outdata:find("culled") then
14-
raise("Modules culling does not work\n%s", outdata)
15-
end
16-
end
17-
end
18-
19-
function can_build()
20-
if is_subhost("windows") then
21-
return true
22-
elseif is_subhost("msys") then
23-
return true
24-
elseif is_host("linux") then
25-
local gcc = find_tool("gcc", {version = true})
26-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
27-
return true
28-
end
29-
local clang = find_tool("clang", {version = true})
30-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
31-
return true
32-
end
33-
end
34-
end
35-
36-
function main(t)
37-
if is_subhost("windows") then
38-
local clang = find_tool("clang", {version = true})
39-
if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then
40-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
41-
_build()
42-
os.exec("xmake clean -a")
43-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
44-
_build()
45-
end
46-
47-
os.exec("xmake clean -a")
48-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
49-
_build()
50-
elseif is_subhost("msys") then
51-
os.exec("xmake f -c -p mingw --yes --policies=build.c++.modules.std:n")
52-
_build()
53-
elseif is_host("linux") then
54-
local gcc = find_tool("gcc", {version = true})
55-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
56-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
57-
_build()
58-
end
59-
local clang = find_tool("clang", {version = true})
60-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
61-
os.exec("xmake clean -a")
62-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
63-
_build()
64-
os.exec("xmake clean -a")
65-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
66-
_build()
67-
end
68-
end
69-
end
1+
inherit(".test_culling")
Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1 @@
1-
import("lib.detect.find_tool")
2-
import("core.base.semver")
3-
import("utils.ci.is_running", {alias = "ci_is_running"})
4-
5-
function _build()
6-
local outdata
7-
if ci_is_running() then
8-
outdata = os.iorun("xmake -rvD")
9-
else
10-
outdata = os.iorun("xmake -rv")
11-
end
12-
if outdata then
13-
if not outdata:find("culled") then
14-
raise("Modules culling does not work\n%s", outdata)
15-
end
16-
end
17-
end
18-
19-
function can_build()
20-
if is_subhost("windows") then
21-
return true
22-
elseif is_subhost("msys") then
23-
return true
24-
elseif is_host("linux") then
25-
local gcc = find_tool("gcc", {version = true})
26-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
27-
return true
28-
end
29-
local clang = find_tool("clang", {version = true})
30-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
31-
return true
32-
end
33-
end
34-
end
35-
36-
function main(t)
37-
if is_subhost("windows") then
38-
local clang = find_tool("clang", {version = true})
39-
if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then
40-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
41-
_build()
42-
os.exec("xmake clean -a")
43-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
44-
_build()
45-
end
46-
47-
os.exec("xmake clean -a")
48-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
49-
_build()
50-
elseif is_subhost("msys") then
51-
os.exec("xmake f -c -p mingw --yes --policies=build.c++.modules.std:n")
52-
_build()
53-
elseif is_host("linux") then
54-
local gcc = find_tool("gcc", {version = true})
55-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
56-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
57-
_build()
58-
end
59-
local clang = find_tool("clang", {version = true})
60-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
61-
os.exec("xmake clean -a")
62-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
63-
_build()
64-
os.exec("xmake clean -a")
65-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
66-
_build()
67-
end
68-
end
69-
end
1+
inherit(".test_culling")
Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1 @@
1-
import("lib.detect.find_tool")
2-
import("core.base.semver")
3-
import("utils.ci.is_running", {alias = "ci_is_running"})
4-
5-
function _build()
6-
try {
7-
function()
8-
if ci_is_running() then
9-
os.run("xmake -rvD")
10-
else
11-
os.run("xmake -r")
12-
end
13-
end,
14-
catch {
15-
function (errors)
16-
errors = tostring(errors)
17-
if not errors:find("duplicate module name detected", 1, true) then
18-
raise("Modules duplicate name detection does not work\n%s", errors)
19-
end
20-
end
21-
}
22-
}
23-
end
24-
25-
function can_build()
26-
if is_subhost("windows") then
27-
return true
28-
elseif is_subhost("msys") then
29-
return true
30-
elseif is_host("linux") then
31-
local gcc = find_tool("gcc", {version = true})
32-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
33-
return true
34-
end
35-
local clang = find_tool("clang", {version = true})
36-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
37-
return true
38-
end
39-
end
40-
end
41-
42-
function main(t)
43-
if is_subhost("windows") then
44-
local clang = find_tool("clang", {version = true})
45-
if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then
46-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
47-
_build()
48-
os.exec("xmake clean -a")
49-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
50-
_build()
51-
end
52-
53-
os.exec("xmake clean -a")
54-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
55-
_build()
56-
elseif is_subhost("msys") then
57-
os.exec("xmake f -c -p mingw --yes --policies=build.c++.modules.std:n")
58-
_build()
59-
elseif is_host("linux") then
60-
local gcc = find_tool("gcc", {version = true})
61-
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
62-
os.exec("xmake f -c --yes --policies=build.c++.modules.std:n")
63-
_build()
64-
end
65-
local clang = find_tool("clang", {version = true})
66-
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
67-
os.exec("xmake clean -a")
68-
os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n")
69-
_build()
70-
os.exec("xmake clean -a")
71-
os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes --policies=build.c++.modules.std:n")
72-
_build()
73-
end
74-
end
75-
end
1+
inherit(".test_duplicate_modules")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
inherit(".test_headerunits")
1+
inherit(".test_base")

0 commit comments

Comments
 (0)