diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-02-01 20:37:32 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-03-04 09:52:25 +0100 |
commit | 53ba0324a35a48cdbe3286991c60842b67099ed8 (patch) | |
tree | 289281df5fac32acaab714d8ee6b8863e7b2a3a8 /test | |
parent | 0778d3c45d1aef18d9b2ae6769e372b2a3d83b8e (diff) |
WIPmsvc
Diffstat (limited to 'test')
-rw-r--r-- | test/ctor.cc | 27 | ||||
-rw-r--r-- | test/execute_test.cc | 12 | ||||
-rw-r--r-- | test/source_type_test.cc | 8 | ||||
-rwxr-xr-x | test/suite/test.sh | 2 | ||||
-rw-r--r-- | test/testprog.cc | 38 | ||||
-rw-r--r-- | test/tools_test.cc | 3 |
6 files changed, 90 insertions, 0 deletions
diff --git a/test/ctor.cc b/test/ctor.cc index 0d77a3e..fd759e1 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -22,6 +22,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"argparser\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -39,6 +41,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"argsplit\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -56,6 +60,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"pointerlist\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -74,7 +80,10 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) .cxxflags = { "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", + "-I../json/include", "-DOUTPUT=\"deps\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -88,6 +97,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) .flags = { .cxxflags = { "-std=c++20", "-O3", "-Wall", "-Werror", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -108,6 +119,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"execute\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, .ldflags = { "-pthread" }, }, @@ -126,6 +139,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"tasks\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, .ldflags = { "-pthread" }, }, @@ -144,6 +159,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"cycle\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, .ldflags = { "-pthread" }, }, @@ -162,6 +179,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"source_type\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, .ldflags = { "-pthread" }, }, @@ -182,6 +201,8 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", "-Iuunit", "-DOUTPUT=\"tools\"", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, }, }, }, @@ -211,6 +232,12 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) .cxxflags = { "-std=c++20", "-O3", "-Wall", "-Werror", "-I../src", + "-I../json/include", + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_X86_"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/external:W0"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/D_CRT_SECURE_NO_WARNINGS"}, + {ctor::toolchain::msvc, ctor::cxx_opt::custom, "/Dstrdup=_strdup"}, }, .ldflags = { "-pthread" }, }, diff --git a/test/execute_test.cc b/test/execute_test.cc index 11b067f..4084084 100644 --- a/test/execute_test.cc +++ b/test/execute_test.cc @@ -36,11 +36,23 @@ public: value = execute(s, "no-such-binary", {}, {}, false); uASSERT_EQUAL(1, value); value = execute(s, cmd, {"segfault"}, {}, false); +#if !defined(_WIN32) uASSERT_EQUAL(11, value); +#else + uASSERT_EQUAL(3, value); +#endif value = execute(s, cmd, {"throw"}, {}, false); +#if !defined(_WIN32) uASSERT_EQUAL(6, value); +#else + uASSERT_EQUAL(-1073740791, value); +#endif value = execute(s, cmd, {"abort"}, {}, false); +#if !defined(_WIN32) uASSERT_EQUAL(6, value); +#else + uASSERT_EQUAL(-1073740791, value); +#endif } void env() diff --git a/test/source_type_test.cc b/test/source_type_test.cc index 288f1e5..657260e 100644 --- a/test/source_type_test.cc +++ b/test/source_type_test.cc @@ -26,6 +26,14 @@ std::ostream& operator<<(std::ostream& stream, const ctor::language& lang) return stream; } +const ctor::configuration& ctor::get_configuration() +{ + static ctor::configuration cfg{}; + cfg.build_toolchain = ctor::toolchain::gcc; + cfg.build_arch = ctor::arch::unix; + return cfg; +} + class TestableTaskCC : public TaskCC { diff --git a/test/suite/test.sh b/test/suite/test.sh index c54137a..ec603f5 100755 --- a/test/suite/test.sh +++ b/test/suite/test.sh @@ -1,4 +1,6 @@ #!/bin/bash +#set -x + : ${CXX:=g++} : ${CTORDIR:=../../build} : ${BUILDDIR:=build} diff --git a/test/testprog.cc b/test/testprog.cc index 93edc3f..18c2c74 100644 --- a/test/testprog.cc +++ b/test/testprog.cc @@ -5,6 +5,14 @@ extern char **environ; +#if defined(_WIN32) +#define WINDOWS_LEAN_AND_MEAN +#include <windows.h> +#undef max +#else +extern char **environ; // see 'man environ' +#endif + int main(int argc, const char* argv[]) { if(argc < 2) @@ -20,11 +28,41 @@ int main(int argc, const char* argv[]) { return 0; } + std::ofstream ostrm(argv[2], std::ios::binary); + if(ostrm.bad()) + { + std::cout << "Error: Could not write to " << argv[2] << "\n"; + } +#if defined(_WIN32) + auto env_strings = GetEnvironmentStrings(); + const char* ptr = env_strings; + std::string env; + while(true) + { + if(*ptr == '\0') + { + if(env.empty()) + { + // no more + break; + } + ostrm << env << "\n"; + env.clear(); + ++ptr; + continue; + } + + env += *ptr; + ++ptr; + } + FreeEnvironmentStrings(env_strings); +#else for(auto current = environ; *current; ++current) { ostrm << (*current) << "\n"; } +#endif } if(cmd == "retval") diff --git a/test/tools_test.cc b/test/tools_test.cc index 5ae04c3..15270b3 100644 --- a/test/tools_test.cc +++ b/test/tools_test.cc @@ -22,6 +22,9 @@ std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& toolchain) case ctor::toolchain::clang: stream << "ctor::toolchain::clang"; break; + case ctor::toolchain::msvc: + stream << "ctor::toolchain::msvc"; + break; } return stream; } |