Commit Graph

1827 Commits

Author SHA1 Message Date
Rupert Nash
3d01f3ae32 Backport changes from 7bea1e2ac36ac54b648ae5c9d381a59bc69db912 to fix #2273 for 2.x 2021-09-18 21:24:03 +02:00
Jørgen P. Tjernø
4b9780201b Fix warning suppressions leaking under clang.exe
When running clang.exe under Windows, catch.hpp leaks warning
suppressions because it uses `#pragma warning(push)` & `#pragma
warning(pop)` around warning suppressions like `#pragma clang diagnostic
ignore "-Wunused-variable"`, instead of using `#pragma clang diagnostic
push` and `#pragma clang diagnostic pop`.

This fixes that by only defining
`CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` and
`CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION` to be the cl.exe variants if
`defined(_MSC_VER) && !defined(__clang__)`.
2021-08-30 23:26:51 +02:00
Martin Hořeňovský
c4e3767e26
v2.13.7 2021-07-28 20:30:51 +02:00
Martin Hořeňovský
eea3e9a5b5
Mark !mayfail tests as skipped in the JUnit reporter
Should fix #2116
2021-07-27 23:16:01 +02:00
Dimitrij Mijoski
531a149ae7 Fix compiling v2.x with C++17 + Clang 5 + libstdc++ v5
This basically tests the combination where the compiler supports most
of C++17 but the library does not.
2021-05-25 23:50:45 +02:00
Martin Hořeňovský
9683570be7
Tiny optimization in JUnit reporter 2021-05-23 11:31:33 +02:00
Martin Hořeňovský
581c46249a
JUnit reporter uses only 3 decimal places when reporting durations
We used to use whatever precision we ended up having from C++'s
stdlib. However, some relatively popular tools, like Jenkins,
use Maven SureFire XML schema to validate JUnit test reports, and
Maven SureFire schema requires the duration to have at most 3
decimal places.

For compatibility, the JUnit reporter will now respect this
limitation.

Closes #2221
2021-05-22 23:45:43 +02:00
Evgeny Proydakov
b15b862d86 Fixed noexcept benchmark build for gcc. 2021-05-21 20:49:16 +02:00
Martin Hořeňovský
6971476563
Ensure that <iterator> is included before back_inserter is used
Closes #2231
2021-05-21 20:20:00 +02:00
Martin Hořeňovský
5c88067bd3
v2.13.6 2021-04-16 20:14:58 +02:00
Matteo Beniamino
469a717395 Fixed [dis]engage_platform declarations mismatch 2021-04-13 19:50:32 +02:00
Martin Hořeňovský
42e368dd0a
v2.13.5 2021-04-10 23:48:32 +02:00
Julien Brianceau
269f96e2bc Fix typos in the code base
Note that only documentation and comments are impacted by this change.
2021-04-08 18:06:36 +02:00
Martin Hořeňovský
b8b03da534
Mangle doccoments to avoid breaking single include stitching 2021-04-04 18:09:29 +02:00
Martin Hořeňovský
8f277a54c0
Significantly refactor fatal error handling
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
2021-04-04 18:09:26 +02:00
Pavel Kamenov
4cb3220a8a Add lcc to the list of unwanted compilers that mimic gcc 2021-04-04 14:05:39 +02:00
Scott Hutchinson
b025a007b9 Wrap all std::min and std::max calls in parentheses 2021-02-20 23:28:20 +01:00
Rob Boehne
68975e3ff3
[Issue 2154] Correct error when building with IBM's latest XLC (#2155)
* [Issue 2154] Correct error when building with IBM's latest XLC compiler with xlclang++ front-end.

On AIX, the XLC 16.1.0.1 compiler considers the call to `std::abs` ambigious, so it needs help with a static_cast to the type of the template argument.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2021-01-21 22:50:49 +01:00
Tom de Geus
d4c9494eb5
Making target detection on Mac more robust 2021-01-20 21:12:18 +01:00
Martin Hořeňovský
de6fe184a9
v2.13.4 2020-12-29 15:03:40 +01:00
Martin Hořeňovský
dc7e705672
Small cleanups for the reworked test case order hashing 2020-11-17 21:08:33 +01:00
Sergio Losilla
3ba745552b Modified hash to make it more independent of the choice of test names. 2020-11-17 20:58:16 +01:00
Martin Hořeňovský
ff349a50bf
v2.13.3 2020-10-31 18:21:23 +01:00
Martin Hořeňovský
765ac08f08
Fix potential infinite loops in generators combined with section filter
The problem was that under specific circumstances, namely that none
of their children progressed, `GeneratorTracker` will not progress.
This was changed recently, to allow for code like this, where a
`SECTION` follows a `GENERATE` at the same level:

```cpp
SECTION("A") {}
auto a = GENERATE(1, 2);
SECTION("B") {}
```

However, this interacted badly with `SECTION` filters (`-c foo`),
as they could deactivate all `SECTION`s below a generator, and thus
stop it from progressing forever. This commit makes GeneratorTracker
check whether there are any filters active, and if they are, it checks
whether its section-children can ever run.

Fixes #2025
2020-10-31 18:04:15 +01:00
Martin Hořeňovský
87074da73e
v2.13.2 2020-10-07 11:43:02 +02:00
Martin Hořeňovský
e6f5e05ebc
Improve detection of std::uncaught_exceptions support
The problem was that Catch2 did not reliably include `<exception>`
before it checked for the feature test macro for
`std::uncaught_exceptions`. To avoid overhead of including
`<exception>` everywhere, the configuration check was split out
into a separate header.

Closes #2021
2020-10-06 11:07:53 +02:00
Martin Hořeňovský
7c75ecaef4
Workaround AppleClang bug by renaming TestHasher constructor argument
As far as I understand the standard, if there is a function called
`rng` in the global namespace, and a function argument called `rng`,
then the argument should shadow the function. This then means that
uses of `rng` inside the function should refer to the argument.

This is not the case for AppleClang 12.0.0. Luckily the workaround
is simple enough; just rename the argument. Given that the function
is 3 lines and uncomplicated, the change of the name doesn't really
affect readability.

Still, WTF AppleClang?

Closes #2030
2020-10-02 23:22:49 +02:00
Will Pazner
00db4fb497 Disable __builtin_constant_p when compiling with nvcc 2020-09-18 16:07:18 +02:00
Travis Wilson
a2e5ce2418 Make experimental capture work on Windows with read-write temp file behavior 2020-09-10 20:14:18 +02:00
Martin Hořeňovský
fd9f5ac661
v2.13.1 2020-09-07 12:34:55 +02:00
Dawid Kurek
f0dc4d9be0 Remove superfluous values
The `0`s were needed for the expansion of parameter pack for the sake of
expander. Now when we have `index++` it is no more needed.
2020-08-27 11:15:58 +02:00
Sean Middleditch
284672cc84
Support sentinel-based ranges in default stringify (#2004) 2020-08-18 10:34:47 +02:00
Gregory Bond
708487d201 Issue 1992: Better c++17 std::byte detection
This fixed buld errors for ubuntu-16 + clang and similar situations
where C++17 is supported in the compiler but not the default
C++ standard library.
2020-08-03 14:38:56 +02:00
Martin Hořeňovský
7f21cc6c55
v2.13.0 2020-07-12 20:28:38 +02:00
Martin Hořeňovský
4c85248179
Fixup whitespace in TAPReporter 2020-07-12 20:27:25 +02:00
Martin Hořeňovský
b4e2237152
Remove pointless CompactReporter::getPreferences override 2020-07-12 20:06:14 +02:00
Gavin S
b1c45652e5
Update catch_reporter_tap.hpp
TAP format requires all results to be reported.
Removed extraneous preferences function (handled by parent)
Incorporated fix from 3d9e7db2e0
Simplified total printing
2020-07-12 01:17:37 -07:00
Martin Hořeňovský
b79a83e4aa
Modify generator tracking to allow GENERATEs between SECTIONs
This means that code such as

```cpp
TEST_CASE() {
    SECTION("first") { SUCCEED(); }
    auto _ = GENERATE(1, 2);
    SECTION("second") { SUCCEED(); }
}
```

will run and report 3 assertions, 1 from section "first" and 2
from section "second". This also applies for greater and potentially
more confusing nesting, but fundamentally it is up to the user to
avoid overly complex and confusing nestings, just as with `SECTION`s.

The old behaviour of `GENERATE` as first thing in a `TEST_CASE`,
`GENERATE` not followed by a `SECTION`, etc etc should be unchanged.

Closes #1938
2020-07-11 23:16:07 +02:00
Martin Hořeňovský
6f7c191513
--min-duration is overriden by -d no 2020-07-06 20:33:08 +02:00
John Bytheway
46fde0c597 Add --min-duration option
A test runner already has a --durations option to print durations.
However, this isn't entirely satisfactory.

When there are many tests, this produces output spam which makes it hard
to find the test failure output.  Nevertheless, it is helpful to be
informed of tests which are unusually slow.

Therefore, introduce a new option --min-duration that causes all
durations above a certain threshold to be printed.  This allows slow
tests to be visible without mentioning every test.
2020-07-06 11:35:02 +02:00
Martin Hořeňovský
c299133a31
v2.12.4 2020-07-05 11:51:30 +02:00
George Rhoten
bad3c93049 Fix for macOS on ARM 2020-07-01 19:28:50 +02:00
Martin Hořeňovský
0f05c034c2
v2.12.3 2020-06-29 20:50:39 +02:00
Ryan Pavlik
ee4538c0c6 Add OverallResultsCases element to XML reporter 2020-06-28 22:36:08 +02:00
Martin Hořeňovský
288416f501
Devirtualize NameAndLocation query on trackers 2020-06-13 19:26:17 +02:00
Martin Hořeňovský
cbbebb65b6
Fix copy paste error in 7-arg TEMPLATE_TEST_CASE_SIG implementation
Closes #1954
2020-06-13 15:46:59 +02:00
Matthias Blankertz
0614a4acb3 Hide std::exception_ptr and friends if exceptions disabled
Some compilers, e.g. the Green Hills C++ compiler, react badly to the
appearance of std::exception_ptr, std::current_exception,
std::rethrow_exception and std::uncaught_exception(s). To allow usage of
Catch2 with these compilers when exceptions are disabled, hide the usage
of std::exception_ptr etc. when compiling with
CATCH_CONFIG_DISABLE_EXCEPTIONS.
2020-06-12 23:23:55 +02:00
Martin Hořeňovský
0807fdb175
Replace stray tabs with spaces 2020-06-01 19:06:51 +02:00
Martin Hořeňovský
9500ded83b
Improved generator tracking
* Successive executions of the same `GENERATE` macro (e.g. because
of a for loop) no longer lead to multiple nested generators.
* The same line can now contain multiple `GENERATE` macros without
issues.

Fixes #1913
2020-06-01 19:06:51 +02:00
bogdasar1985
6c6ebe374a fixing UB 2020-05-29 14:56:40 +02:00