From f64943bd2dacfb0790472fcbd6eb9731c5e4adc0 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 8 Apr 2024 23:08:57 +0800 Subject: add parallel test --- tests/projects/other/parallel_build/1.cpp | 2 ++ tests/projects/other/parallel_build/2.cpp | 31 +++++++++++++++++++++++++++ tests/projects/other/parallel_build/xmake.lua | 13 +++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tests/projects/other/parallel_build/1.cpp create mode 100644 tests/projects/other/parallel_build/2.cpp create mode 100644 tests/projects/other/parallel_build/xmake.lua diff --git a/tests/projects/other/parallel_build/1.cpp b/tests/projects/other/parallel_build/1.cpp new file mode 100644 index 000000000..c6dee1602 --- /dev/null +++ b/tests/projects/other/parallel_build/1.cpp @@ -0,0 +1,2 @@ +int main(){ +} \ No newline at end of file diff --git a/tests/projects/other/parallel_build/2.cpp b/tests/projects/other/parallel_build/2.cpp new file mode 100644 index 000000000..3bedf31ca --- /dev/null +++ b/tests/projects/other/parallel_build/2.cpp @@ -0,0 +1,31 @@ +// Make this object complex and cost longer compile time... +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() { + + using Type = std::variant; + Type a, b, c; + a = 5; + b = 3.0; + c = 4.0f; + double r; + std::visit([&](auto a, auto b, auto c) { r = a + b + c; }, a, b, c); + std::visit([&](auto a, auto b, auto c) { r = a + b - c; }, a, b, c); + std::visit([&](auto a, auto b, auto c) { r = a - b - c; }, a, b, c); + std::visit([&](auto a, auto b, auto c) { r = (a + b + c) * 2; }, a, b, c); + std::visit([&](auto a, auto b, auto c) { r = (a + b - c) * 3; }, a, b, c); +} \ No newline at end of file diff --git a/tests/projects/other/parallel_build/xmake.lua b/tests/projects/other/parallel_build/xmake.lua new file mode 100644 index 000000000..e84b8a6e5 --- /dev/null +++ b/tests/projects/other/parallel_build/xmake.lua @@ -0,0 +1,13 @@ +-- These targets should compiled and linked concurrently. +add_rules("mode.release", "mode.debug", "mode.releasedbg") +set_policy("build.ccache", false) + +target("first") + set_kind("binary") + add_files("1.cpp") + set_languages("clatest", "cxx20") + +target("second") + set_kind("binary") + add_files("2.cpp") + set_languages("clatest", "cxx20") -- cgit v1.3.1