mirror of
https://github.com/openharmony/third_party_libabigail.git
synced 2026-07-20 23:44:50 -04:00
tests: Update to catch.hpp v2.13.4 and fix #2178
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>
This commit is contained in:
+27
-20
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user