Skip to content

Commit d954d64

Browse files
committed
nfc(c++ modules) improve tests
1 parent 84fcc1f commit d954d64

4 files changed

Lines changed: 17 additions & 22 deletions

File tree

tests/projects/c++/modules/test_base.lua

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,22 @@ GCC_MIN_VER = "11"
99
MSVC_MIN_VER = "14.29"
1010

1111
function _build(check_outdata)
12+
local flags = ""
13+
if ci_is_running() then
14+
flags = "-vD"
15+
end
1216
if check_outdata then
1317
local outdata
14-
if ci_is_running() then
15-
outdata = os.iorun("xmake -rvD")
16-
else
17-
outdata = os.iorun("xmake -rv")
18-
end
18+
outdata = os.iorun("xmake -r " .. flags)
1919
if outdata then
2020
if outdata:find(check_outdata.str, 1, true) then
2121
raise(check_outdata.format_string, outdata)
2222
end
2323
end
2424
else
25-
if ci_is_running() then
26-
os.run("xmake -rvD")
27-
else
28-
os.run("xmake -r")
29-
end
25+
os.run("xmake -r " .. flags)
3026
end
31-
local outdata = os.iorun("xmake")
27+
local outdata = os.iorun("xmake " .. flags)
3228
if outdata then
3329
if outdata:find("compiling", 1, true) or outdata:find("linking", 1, true) or outdata:find("generating", 1, true) then
3430
raise("Modules incremental compilation does not work\n%s", outdata)

tests/projects/c++/modules/test_dependency_scanner.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ GCC_MIN_VER = "11"
66
MSVC_MIN_VER = "14.29"
77

88
function _build(platform, toolchain_name, runtimes, policies, flags)
9-
os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-c --yes " .. policies .. " --foo=n")
10-
local outdata
9+
local flags = ""
1110
if ci_is_running() then
12-
outdata = os.iorun("xmake -rvD")
13-
else
14-
outdata = os.iorun("xmake -rv")
11+
flags = "-vD"
1512
end
13+
os.exec("xmake f" .. platform .. "--toolchain=" .. toolchain_name .. runtimes .. "-c --yes " .. policies .. " --foo=n" .. " " .. flags)
14+
local outdata
15+
outdata = os.iorun("xmake -r " .. flags)
1616
if outdata then
1717
if outdata:find("FOO") then
1818
raise("Modules dependency scanner update does not work\n%s", outdata)

tests/projects/c++/modules/test_duplicate_modules.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ GCC_MIN_VER = "11"
66
MSVC_MIN_VER = "14.29"
77

88
function _build()
9+
local flags = ""
10+
if ci_is_running() then
11+
flags = "-vD"
12+
end
913
try {
1014
function ()
11-
if ci_is_running() then
12-
os.run("xmake -rvD")
13-
else
14-
os.run("xmake -r")
15-
end
15+
os.run("xmake -r " .. flags)
1616
end,
1717
catch {
1818
function (errors)

tests/projects/c++/modules/test_headerunits.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
inherit("test_base")
2-
import("utils.ci.is_running", {alias = "ci_is_running"})
32

43
GCC_MIN_VER = "11"
54
MSVC_MIN_VER = "14.30"

0 commit comments

Comments
 (0)