tests: Update to catch.hpp v2.13.4 and fix #2178
Commit Message
Hello,
This patch is about fixing a compilation error that we are seeing on
Fedora Rawhide with glibc 2.33.9000, which makes MINSIGSTKSZ not be a
constant value anymore. Thus, the sigStackSize variable that is
declared constexpr cannot use that MINSIGSTKSZ as initializer anymore.
So as suggested in the issue
https://github.com/catchorg/Catch2/issues/2178 filed against
'catchorg' for this purpose, I am hardwiring the initialization value
of sigStackSize for now.
* tests/lib/catch.hpp: Update to v2.13.4 and initialize
sigStackSize to 32768 for now, as suggested by
https://github.com/catchorg/Catch2/issues/2178.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
tests/lib/catch.hpp | 47 ++++++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 20 deletions(-)
Comments
Hi Dodji,
On Wed, Feb 24, 2021 at 10:26:02AM +0100, Dodji Seketeli wrote:
> diff --git a/tests/lib/catch.hpp b/tests/lib/catch.hpp
> index 31745154..8bbc0a5b 100644
> --- a/tests/lib/catch.hpp
> +++ b/tests/lib/catch.hpp
> @@ -1,7 +1,6 @@
> -// SPDX-License-Identifier: BSL-1.0
> /*
> - * Catch v2.13.3
> - * Generated: 2020-10-31 18:20:31.045274
> + * Catch v2.13.4
> + * Generated: 2020-12-29 14:48:00.116107
> * ----------------------------------------------------------
> * This file has been merged from multiple headers. Please don't edit it directly
> * Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
Note that since you are using a regenerated file it is loosing the
SPDX identifier that was added manually. Not a big issue since the
actual license that permits redistribution is still in the file, but
you might want to see if there is a way to update regenerated test
files so that they keep the identifier in case someone relies on them.
Cheers,
Mark
Mark Wielaard <mark@klomp.org> a écrit:
> Hi Dodji,
>
> On Wed, Feb 24, 2021 at 10:26:02AM +0100, Dodji Seketeli wrote:
>> diff --git a/tests/lib/catch.hpp b/tests/lib/catch.hpp
>> index 31745154..8bbc0a5b 100644
>> --- a/tests/lib/catch.hpp
>> +++ b/tests/lib/catch.hpp
>> @@ -1,7 +1,6 @@
>> -// SPDX-License-Identifier: BSL-1.0
>> /*
>> - * Catch v2.13.3
>> - * Generated: 2020-10-31 18:20:31.045274
>> + * Catch v2.13.4
>> + * Generated: 2020-12-29 14:48:00.116107
>> * ----------------------------------------------------------
>> * This file has been merged from multiple headers. Please don't edit it directly
>> * Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
>
> Note that since you are using a regenerated file it is loosing the
> SPDX identifier that was added manually. Not a big issue since the
> actual license that permits redistribution is still in the file, but
> you might want to see if there is a way to update regenerated test
> files so that they keep the identifier in case someone relies on them.
Right, thanks for noting that.
I have just added the SPDX header back.
Thanks.
From b918ec8f77af6c430183e62fe88b1da1ca693e82 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Mon, 8 Mar 2021 11:32:05 +0100
Subject: [PATCH] tests/catch.hpp: Add SPDX header back
* tests/lib/catch.hpp: Add SPDX header back.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
tests/lib/catch.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/lib/catch.hpp b/tests/lib/catch.hpp
index 8bbc0a5b..33b7ada2 100644
--- a/tests/lib/catch.hpp
+++ b/tests/lib/catch.hpp
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: BSL-1.0
/*
* Catch v2.13.4
* Generated: 2020-12-29 14:48:00.116107
@@ -1,7 +1,6 @@
-// SPDX-License-Identifier: BSL-1.0
/*
- * Catch v2.13.3
- * Generated: 2020-10-31 18:20:31.045274
+ * Catch v2.13.4
+ * Generated: 2020-12-29 14:48:00.116107
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
@@ -16,7 +15,7 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 13
-#define CATCH_VERSION_PATCH 3
+#define CATCH_VERSION_PATCH 4
#ifdef __clang__
# pragma clang system_header
@@ -10820,8 +10819,12 @@ namespace Catch {
// 32kb for the alternate stack seems to be sufficient. However, this value
// is experimentally determined, so that's not guaranteed.
- static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
+ //static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
+ // Since glibc 2.33.9000 MINSIGSTKSZ is no more a constant. So,
+ // let's hardwire this for now as suggested by
+ // https://github.com/catchorg/Catch2/issues/2178.
+ static constexpr std::size_t sigStackSize = 32768;
static SignalDefs signalDefs[] = {
{ SIGINT, "SIGINT - Terminal interrupt signal" },
{ SIGILL, "SIGILL - Illegal instruction signal" },
@@ -14127,24 +14130,28 @@ namespace Catch {
namespace {
struct TestHasher {
- explicit TestHasher(Catch::SimplePcg32& rng_instance) {
- basis = rng_instance();
- basis <<= 32;
- basis |= rng_instance();
- }
+ using hash_t = uint64_t;
- uint64_t basis;
+ explicit TestHasher( hash_t hashSuffix ):
+ m_hashSuffix{ hashSuffix } {}
- uint64_t operator()(TestCase const& t) const {
- // Modified FNV-1a hash
- static constexpr uint64_t prime = 1099511628211;
- uint64_t hash = basis;
- for (const char c : t.name) {
+ uint32_t operator()( TestCase const& t ) const {
+ // FNV-1a hash with multiplication fold.
+ const hash_t prime = 1099511628211u;
+ hash_t hash = 14695981039346656037u;
+ for ( const char c : t.name ) {
hash ^= c;
hash *= prime;
}
- return hash;
+ hash ^= m_hashSuffix;
+ hash *= prime;
+ const uint32_t low{ static_cast<uint32_t>( hash ) };
+ const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };
+ return low * high;
}
+
+ private:
+ hash_t m_hashSuffix;
};
} // end unnamed namespace
@@ -14162,9 +14169,9 @@ namespace Catch {
case RunTests::InRandomOrder: {
seedRng( config );
- TestHasher h( rng() );
+ TestHasher h{ config.rngSeed() };
- using hashedTest = std::pair<uint64_t, TestCase const*>;
+ using hashedTest = std::pair<TestHasher::hash_t, TestCase const*>;
std::vector<hashedTest> indexed_tests;
indexed_tests.reserve( unsortedTestCases.size() );
@@ -15317,7 +15324,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 2, 13, 3, "", 0 );
+ static Version version( 2, 13, 4, "", 0 );
return version;
}