Commit Graph
108 Commits
Author SHA1 Message Date
Martin Storsjö 8a6b022f88 test: Test building another executable in UWP mode
Test building a file that includes windows.h, to catch issues with
e.g. the definition of WINAPI_FAMILY.
2024-03-13 18:19:42 +02:00
Martin Storsjö ac3c8bfe35 test: Add a testcase for atomic helpers 2024-01-24 09:11:40 +02:00
Martin Storsjö a815d6557a test: Add a smoke test for resource files and windres 2023-12-12 16:10:37 +02:00
Martin Storsjö c1dfe42094 test: Remove an exception for a glibc test failure in crt-test
I no longer can reproduce the issue that this works around; neither
on current environments or when testing building with older
distributions.
2023-10-27 10:32:10 +03:00
Martin Storsjö e4534c56fa test: Split the math tests in crt-test into many smaller functions
This speeds up compilation a bit further.
2023-10-27 10:31:55 +03:00
Martin Storsjö 5e45947c20 test: Split the main function in crt-test to a couple smaller functions
This speeds up compilation with LLVM a little bit.
2023-10-26 12:01:17 +03:00
Martin Storsjö 0f79bd9460 test: Reset the iret variable inbetween tests of frexp 2023-10-26 12:01:17 +03:00
Martin Storsjö b592dd734e tests: Consistently use <triple>-gcc instead of <triple>-clang for cross compilation
While <triple>-clang is more specific, using <triple>-gcc allows
testing GCC based toolchains (somewhat) with the same scripts/makefiles
too.
2023-03-11 23:59:19 +02:00
Martin Storsjö dfd4c31f2e test: Simplify handling of OpenMP
It is available on all architectures by default now. Keep the
HAVE_OPENMP conditional within the test makefile to allow custom
testing without having it available.
2023-01-29 01:09:17 +02:00
Martin Storsjö 4ba7adbb90 run-tests: Check for the error messages from ssp routines
Since using the ssp routines from mingw-w64 instead of those from
GCC's libssp, these messages are included in the piped output of
the process, so we can check for the right messages.
2023-01-29 01:09:17 +02:00
Martin Storsjö abc36e1f7c run-tests: Stop trying to copy libssp-0.dll
We no longer build that DLL.
2023-01-29 01:09:17 +02:00
Martin Storsjö ef9806fc0a run-tests: Stop explicitly linking against -lssp for the fortification test
Since libmingwex.a provides these routines now, we don't need to
specify -lssp manually.
2023-01-29 01:09:17 +02:00
Martin Storsjö 241a1cd148 test: Prepare the test scripts for testing native Windows tools via WSL
Use the TOOLEXT variable in run-tests.sh in the same way as in the
Makefile. The Makefile sets this variable automatically if invoked
by mingw32-make, but if running run-tests.sh in WSL with native
Windows compilers, then we need to set TOOLEXT manually when calling
run-tests.sh.

Allow skipping the cfguard failure tests when run in such a
configuration, since Linux make in WSL can't easily run cmd.exe
like in MSYS2.
2023-01-21 23:48:24 +02:00
Martin Storsjö 04c623fe8b crt-test: Improve the check for testing the >64 bit range for strtold
The previous condition failed to identify that macOS on aarch64
also has long double equal to regular double.
2022-12-01 12:13:20 +02:00
Martin Storsjö 21c279aab5 crt-test: Skip the NAN preservation tests on platforms other than mingw
This part of the tests does pass on glibc on x86_64 and on MSVC,
but fails on macOS (for some functions) and on glibc on aarch64
(for one function).

This is a somewhat overly pedantic test, but is useful for checking
the NAN preservation behaviour when modifying implementations.

Also print the sign bit explicitly - not all printf implementations
distinguish between NAN and -NAN when printed.
2022-12-01 12:07:32 +02:00
Martin Storsjö e934cba58e test: Include the runtime DLLs even if not running tests
This makes the produced binaries ready for running separately
afterwards, which was regressed in
e16ba0772f.
2022-11-02 10:37:58 +02:00
Martin Storsjö e16ba0772f run-tests: Split out building and running of tests into a Makefile
This allows building and running the tests in parallel.
2022-10-29 23:22:56 +03:00
Martin Storsjö 71b3bcb278 crt-test: Wrap parameters to tested string functions to avoid optimizing them
When some of the parameters to standard C functions are known
constants, the compiler can optimize out the call to the actual
function.

When built with fortification enabled, the compiler previously
didn't actually end up calling the __<func>_chk functions in
most cases, as it could optimize out much of the calls. Now all
tested function calls should end up emitted as intended, making
this actually do functional testing of the __<func>_chk function
implementations.
2022-10-14 14:34:02 +03:00
Martin Storsjö c81a93e86c crt-test: Fix tests with MSVC after changing the F() macro
The literal NAN in MSVC is a negative NAN, while it is a positive one
in other environments. (strtod("NAN", NULL) did return a positive NAN
though.) In most tests where we test that NANs are preserved, the exact
sign doesn't matter much as long as it matches, but for some tests, it
does matter. Change to using variables with known representation
in the tests where it matters.

Also add a LL suffix to make a tricky constant more correct.
In MSVC, the variable initialization
    long long i = -2147483648;
actually sets the variable to the positive value 2147483648 (both
in MSVC 2019 and 2022).
2022-10-14 14:33:57 +03:00
Martin Storsjö 9be66e9d22 crt-test: Fix the macros for avoiding compiler optimizations
The macros F() and L() etc were meant for providing constants for
the tests, without the compiler seeing them as constants, to
avoid optimizing out the entire functions that are to be tested.

However in practice, the compiler is also able to optimize out
e.g. a call to strtol("42", NULL, 0), so this didn't have the
intended effect.

Instead make the macros wrap through a no-op function, but which
is indirected via a global function pointer. The compiler can't
reason about global variables keeping their values (they could be
modified by e.g. a constructor in a different object file, before
running the main function). This avoids needing to pass all values
through strtod/strtol etc.

Change some constants like 123456789012345, which are seen by
the compiler as integer constants (which aren't exactly representable
in floating point form) into 123456789012345.0, which the compiler
won't complain about being inexact.
2022-10-14 14:33:51 +03:00
Martin Storsjö 04edd84e9d test: Return 0 if cfguard-test is executed without arguments
This simplifies bare-bones testing of just executing all built
executables without an argument.
2022-10-04 11:51:12 +03:00
Alvin Wong 039ee72a68 Add CFGuard test 2022-10-01 13:25:52 +03:00
Martin Storsjö 516c9779fb test: stacksmash: Make sure to change the value of the written byte
If the low byte of the stack cookie happens to be zero, we
previously wouldn't trigger any error.

This avoids accidentally failing to trigger the stack protector
once per 256 runs, roughly.
2022-09-16 20:23:32 +03:00
Martin Storsjö 83422b6be4 test: crt-test: Add tests for a bunch of string functions
These are functions that, when built with "-D_FORTIFY_SOURCE=2 -O2",
can end up calling the corresponding __<func>_chk functions - thus,
this can be used for testing those functions.
2022-09-16 19:44:32 +03:00
Martin Storsjö 1d8c107d49 test: crt-test: Skip a test for cos(-NAN) == -NAN when optimizing
Both GCC and Clang fail this test if optimizations are enabled.
2022-09-16 19:43:40 +03:00
Martin Storsjö 4c29469eac test: Add a test for fortification of string functions
We currently only run the testcase where it doesn't trigger the
failed checks though.
2022-09-16 19:43:40 +03:00
Martin Storsjö e9e53d581d test: Remove a workaround for an old clang version 2022-03-14 11:36:32 +02:00
Martin Storsjö 77d293e95f test: Add tests for conversions between int128 and floats
These require a newer version of LLVM, past
d6216e2cd1a5e07f8509215ee5422ff5ee358da8 in llvm-project (September
29th).
2022-02-09 14:02:20 +02:00
Martin Storsjö f3b6f0fa45 test: Don't use std::chrono_literals, fix building hello-exception in C++11 mode
std::chrono_literals require C++14.

This simplifies building hello-exception on macOS, where current
Apple Clang still default to C++11.
2021-12-03 11:42:11 +02:00
Martin Storsjö e3866b9df2 test: Fix a symbol collision when building hello-exception on macOS
On macOS, the included headers end up including sys/wait.h, which
declares a different symbol "wait".
2021-12-03 11:39:31 +02:00
Martin Storsjö fe57d608de test: Add tests for conversion between 64 bit integers and long double 2021-10-14 12:34:00 +03:00
Martin Storsjö b7c5fc5ef0 test: Add tests for _bittest* intrinsics 2021-08-09 12:08:16 +03:00
Martin Storsjö 5070c39532 test: Add testing of more float formatting cases, including %a 2021-08-09 12:08:16 +03:00
Martin Storsjö 50fb2ef45d test: Add tests for printf formatting of %+u (and %+<n>[doux]) 2021-08-09 12:08:16 +03:00
Martin Storsjö cf18e2de01 test: Add tests for strtod/strtof/strtold/wcstod/wcstof/wcstold 2021-08-09 12:08:16 +03:00
Martin Storsjö ea4f925038 test: Add a test for printf formatting of long doubles 2021-08-09 12:08:16 +03:00
Martin Storsjö 1f5a7e0577 test: Remove a workaround for older wine versions
I've updated my continuous test setup to a newer version of wine now,
not needing this workaround.
2021-08-03 11:36:12 +03:00
Martin Storsjö 84462c92b0 test: Add options -noop and -wait to the hello-exception test program
This allows easier testing of continuing from manually set
breakpoints.

Also fix compilation for non-windows platforms where __debugbreak()
isn't defined.
2021-05-03 13:08:44 +03:00
Martin Storsjö bbbdab6e27 test: Add an option for triggering a breakpoint with hello-exception.cpp 2021-04-15 11:37:11 +03:00
Martin Storsjö 0200472671 test: Add a testcase for cleanup of C++ destructors while doing longjmp
For x86_64 and aarch64, this requires https://reviews.llvm.org/D89231.

The C++ destructors aren't executed while doing the longjmp (contrary
to how it works MSVC's C++ exceptions), but it no longer crashes.
2021-04-15 11:36:20 +03:00
Martin Storsjö 790bc40855 test: Add a testcase for throwing/catching C++ exceptions across DLLs 2021-02-19 16:19:47 +02:00
Martin Storsjö e5612ac52e crt-test: Add a few more log2 tests for negative outputs with exact inputs 2020-11-21 21:34:50 +02:00
Martin Storsjö 9031eb6791 Build the OpenMP runtime in docker based builds
LLVM's OpenMP implementation only supports Windows on x86, and it
requires a MASM-compatible assembler to build it. Build UASM
for this purpose, for now. (UASM isn't available packaged in
debian/ubuntu repos.) In the future, llvm-ml should be able
to handle it instead, but it's not currently mature enough.

Not including it in the regular build-all.sh for now, as UASM
isn't generally available.
2020-10-15 23:23:05 +03:00
Martin Storsjö f2b389e6a7 test: Change hello-exception.cpp to print to stderr
Also flush after each printout, since not all configurations (in
particular, wine) flush stderr implicitly.

This is often useful when debugging unwinding.
2020-10-13 12:24:15 +03:00
Martin Storsjö 42297caad3 test: Add an option to hello-exception.cpp for causing crashes
This is useful for testing the debugger.
2020-10-13 12:20:25 +03:00
Martin Storsjö 8a60836d87 test: Remove unnecessary bits of hello-exception.cpp
These bits are tested by hello-cpp.cpp.
2020-10-13 12:19:46 +03:00
Martin Storsjö 6ae2bfa3ad crt-test: Add a testcase for a case where a broken optimization in LLVM broke the compiler builtin division helpers
https://reviews.llvm.org/D88783 caused this to break.
2020-10-12 14:20:49 +03:00
Martin Storsjö ccff9e4106 test: Update the conditions for skipping global-terminate.cpp on aarch64
Our pinned version of mingw-w64 is new enough already, and
latest wine has implemented __C_specific_handler for aarch64,
so this makes the test be bypassed with current pinned clang (10.0.0)
and the soon to be released clang 11.0.0, but is executed with
clang 12.0.0 (where current versions has got this implemented properly).
2020-09-28 15:11:10 +03:00
Martin Storsjö c82a6f2340 test: Add a testcase for the global termminate handler 2020-09-16 00:07:46 +03:00
Martin Storsjö 308f7227c5 test: Add an idl testcase 2020-09-16 00:03:57 +03:00