summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2024-02-02 21:12:11 +0100
committerArthur LAURENT <[email protected]>2024-02-02 21:36:09 +0100
commit9ccf1552cbae1759d63e9d8e45f1b8cd72104ab9 (patch)
treeb1903fbdfc1822b35ecb9f891be09760aa929744 /tests/projects/c++/modules
parent6061ff61688f58d413764789f8c7eea18d44e4b9 (diff)
improve circular_dependency test
Diffstat (limited to 'tests/projects/c++/modules')
-rw-r--r--tests/projects/c++/modules/circular_dependency/test.lua55
-rw-r--r--tests/projects/c++/modules/test_base_failed.lua46
2 files changed, 54 insertions, 47 deletions
diff --git a/tests/projects/c++/modules/circular_dependency/test.lua b/tests/projects/c++/modules/circular_dependency/test.lua
index c741a2b7c..02b11dbff 100644
--- a/tests/projects/c++/modules/circular_dependency/test.lua
+++ b/tests/projects/c++/modules/circular_dependency/test.lua
@@ -1 +1,54 @@
-inherit(".test_base_failed")
+import("lib.detect.find_tool")
+import("core.base.semver")
+
+function _build()
+ local ci = (os.getenv("CI") or os.getenv("GITHUB_ACTIONS") or ""):lower()
+ local passed = false
+ try {function()
+ if ci == "true" then
+ os.run("xmake -rvD")
+ else
+ os.run("xmake -r")
+ end
+ end, catch{function(errors)
+ print(errors)
+ passed = errors:match("circular modules dependency detected!")
+ end}}
+
+ assert(passed)
+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, "14.0") >= 0 then
+ os.exec("xmake f --toolchain=clang -c --yes")
+ _build()
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes")
+ _build()
+ end
+
+ os.exec("xmake clean -a")
+ os.exec("xmake f -c --yes")
+ _build()
+ elseif is_subhost("msys") then
+ os.exec("xmake f -c -p mingw --yes")
+ _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")
+ _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")
+ _build()
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes")
+ _build()
+ end
+ end
+end
diff --git a/tests/projects/c++/modules/test_base_failed.lua b/tests/projects/c++/modules/test_base_failed.lua
deleted file mode 100644
index 8f33d1fbf..000000000
--- a/tests/projects/c++/modules/test_base_failed.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-import("lib.detect.find_tool")
-import("core.base.semver")
-
-function _build()
- local ci = (os.getenv("CI") or os.getenv("GITHUB_ACTIONS") or ""):lower()
- if ci == "true" then
- assert(os.execv("xmake", {"-rvD"}, {try = true}))
- else
- assert(os.execv("xmake", {"-r"}, {try = true}))
- 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, "14.0") >= 0 then
- os.exec("xmake f --toolchain=clang -c --yes")
- _build()
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes")
- _build()
- end
-
- os.exec("xmake clean -a")
- os.exec("xmake f -c --yes")
- _build()
- elseif is_subhost("msys") then
- os.exec("xmake f -c -p mingw --yes")
- _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")
- _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")
- _build()
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes")
- _build()
- end
- end
-end