summaryrefslogtreecommitdiff
path: root/test/suite
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-12-28 21:48:09 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2026-02-03 19:38:55 +0100
commit74bd1700a7f529bc0dd4f536613b77682e5d02d8 (patch)
tree3fa27fd817faddd57d2d6ea4dd2301e72e4f8af7 /test/suite
parentf66ab53b9380a5367e24727df620d6620ab031f7 (diff)
Diffstat (limited to 'test/suite')
-rw-r--r--test/suite/ctor_files/ctor.cc.generated7
-rw-r--r--test/suite/ctor_files/ctor.cc.generated27
-rw-r--r--test/suite/test.bat13
-rw-r--r--test/suite/test.cc18
-rwxr-xr-xtest/suite/test.sh2
5 files changed, 45 insertions, 2 deletions
diff --git a/test/suite/ctor_files/ctor.cc.generated b/test/suite/ctor_files/ctor.cc.generated
index fe7e173..6d50fa7 100644
--- a/test/suite/ctor_files/ctor.cc.generated
+++ b/test/suite/ctor_files/ctor.cc.generated
@@ -67,7 +67,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings)
ctor::target("many_to_one"),
ctor::sources{
{"many_to_one.cc", ctor::source_type::generated}
- }
+ },
+ ctor::flags{
+ ctor::cxx_flags{
+ "-fexceptions",
+ },
+ },
},
{
ctor::target("many_to_one.cc"),
diff --git a/test/suite/ctor_files/ctor.cc.generated2 b/test/suite/ctor_files/ctor.cc.generated2
index acda99f..a71fa7f 100644
--- a/test/suite/ctor_files/ctor.cc.generated2
+++ b/test/suite/ctor_files/ctor.cc.generated2
@@ -47,7 +47,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings)
ctor::target("many_to_one"),
ctor::sources{
{"many_to_one.cc", ctor::source_type::generated}
- }
+ },
+ ctor::flags{
+ ctor::cxx_flags{
+ "-fexceptions",
+ },
+ },
},
{
ctor::target("many_to_one.cc"),
diff --git a/test/suite/test.bat b/test/suite/test.bat
new file mode 100644
index 0000000..20f0846
--- /dev/null
+++ b/test/suite/test.bat
@@ -0,0 +1,13 @@
+@echo off
+
+set CXX=cl.exe
+set CC=cl.exe
+set AR=lib.exe
+set LD=link.exe
+set CTORDIR=..\..\build
+
+%CXX% /nologo /MT /std:c++20 /D_X86_ /EHsc test.cc /link /out:test.exe
+@if %errorlevel% neq 0 exit /b %errorlevel%
+
+test.exe
+@if %errorlevel% neq 0 exit /b %errorlevel%
diff --git a/test/suite/test.cc b/test/suite/test.cc
index b096a8b..3c7ce4a 100644
--- a/test/suite/test.cc
+++ b/test/suite/test.cc
@@ -21,8 +21,13 @@ int fail(int value = 1,
exit(value);
}
+#if _MSC_VER && !__INTEL_COMPILER
+const std::string ctor_exe{"ctor.exe"};
+const std::string obj_ext{".obj"};
+#else
const std::string ctor_exe{"./ctor"};
const std::string obj_ext{".o"};
+#endif
void run_ctor(const std::vector<std::string>& args,
const std::source_location location = std::source_location::current())
@@ -128,18 +133,28 @@ int main()
// Wipe the board
std::filesystem::remove_all(BUILDDIR);
+#if _MSC_VER && !__INTEL_COMPILER
+ std::filesystem::create_directory(BUILDDIR);
+#endif
std::filesystem::remove("configuration.cc");
std::filesystem::remove("config.h");
std::filesystem::remove(ctor_exe);
//////////////////////////////////////////////////////////////////////////////
// bootstrap
+ // TODO: add support for quoted strings with spaces
{
auto cxx_prog = locate(CXX, paths);
std::vector<std::string> args =
+#if _MSC_VER && !__INTEL_COMPILER
+ {"/nologo", "/MT", "/std:c++20", "/D_X86_", "/EHsc", "/I..\\..\\src",
+ "ctor.cc", "/link", "/LIBPATH:"+CTORDIR, "libctor.lib",
+ "/subsystem:console", "/out:" + ctor_exe};
+#else
{"-pthread", "-std=c++20", "-L", CTORDIR, "-lctor", "-I", "../../src",
"ctor.cc", "-o", ctor_exe};
+#endif
if(!CXXFLAGS.empty())
{
auto tokens = argsplit(CXXFLAGS);
@@ -168,8 +183,11 @@ int main()
//////////////////////////////////////////////////////////////////////////////
// check if source file changes are tracked
{
+#if _MSC_VER && !__INTEL_COMPILER
+#else
// No build files should have been created yet
assert_not_exists(BUILDDIR);
+#endif
// capture ctor binary before configure is called
Tracker ctor_bin(ctor_exe);
diff --git a/test/suite/test.sh b/test/suite/test.sh
index 4638c0d..8272247 100755
--- a/test/suite/test.sh
+++ b/test/suite/test.sh
@@ -1,4 +1,6 @@
#!/bin/bash
+#set -x
+
: ${CXX:=g++}
$CXX $LDFLAGS $CXXFLAGS -std=c++20 -Wall test.cc -o test && ./test