Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/projects/c++/modules/class_cmake/test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inherit(".test_cmake")
70 changes: 1 addition & 69 deletions tests/projects/c++/modules/culling/test.lua
Original file line number Diff line number Diff line change
@@ -1,69 +1 @@
import("lib.detect.find_tool")
import("core.base.semver")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build()
local outdata
if ci_is_running() then
outdata = os.iorun("xmake -rvD")
else
outdata = os.iorun("xmake -rv")
end
if outdata then
if outdata:find("culled") then
raise("Modules culling 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
end
inherit(".test_culling")
70 changes: 1 addition & 69 deletions tests/projects/c++/modules/culling2/test.lua
Original file line number Diff line number Diff line change
@@ -1,69 +1 @@
import("lib.detect.find_tool")
import("core.base.semver")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build()
local outdata
if ci_is_running() then
outdata = os.iorun("xmake -rvD")
else
outdata = os.iorun("xmake -rv")
end
if outdata then
if outdata:find("culled") then
raise("Modules culling 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
end
inherit(".test_culling")
70 changes: 1 addition & 69 deletions tests/projects/c++/modules/culling3/test.lua
Original file line number Diff line number Diff line change
@@ -1,69 +1 @@
import("lib.detect.find_tool")
import("core.base.semver")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build()
local outdata
if ci_is_running() then
outdata = os.iorun("xmake -rvD")
else
outdata = os.iorun("xmake -rv")
end
if outdata then
if not outdata:find("culled") then
raise("Modules culling 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
end
inherit(".test_culling")
76 changes: 1 addition & 75 deletions tests/projects/c++/modules/duplicate_name_detection/test.lua
Original file line number Diff line number Diff line change
@@ -1,75 +1 @@
import("lib.detect.find_tool")
import("core.base.semver")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build()
try {
function()
if ci_is_running() then
os.run("xmake -rvD")
else
os.run("xmake -r")
end
end,
catch {
function (errors)
errors = tostring(errors)
if not errors:find("duplicate module name detected", 1, true) then
raise("Modules duplicate name detection does not work\n%s", errors)
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
end
inherit(".test_duplicate_modules")
12 changes: 12 additions & 0 deletions tests/projects/c++/modules/hello_with_pch/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
inherit(".test_base")

CLANG_MIN_VER = "17"
GCC_MIN_VER = "11"
MSVC_MIN_VER = "14.29"

function main(_)
-- clang-cl doesn't support mixing pch and C++ module atm
local clang_options = {compiler = "clang", version = CLANG_MIN_VER, disable_clang_cl = true}
local gcc_options = {compiler = "gcc", version = GCC_MIN_VER}
local msvc_options = {version = MSVC_MIN_VER}
run_tests(clang_options, gcc_options, msvc_options)
end
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/internal_partition/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_base")
inherit(".test_partitions")
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/packages-subtarget/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_headerunits")
inherit(".test_base")
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/packages/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_headerunits")
inherit(".test_base")
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/partitions/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_stdmodules")
inherit(".test_partitions")
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/partitions_implunit/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_stdmodules")
inherit(".test_partitions")
2 changes: 1 addition & 1 deletion tests/projects/c++/modules/partitions_implunit2/test.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
inherit(".test_stdmodules")
inherit(".test_partitions")
Loading
Loading