Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

11 changed files with 223 additions and 8 deletions

View File

@ -1 +1 @@
340a18695d88be7c27574eaa88002a249cf851d8 SOURCES/catch1-1.12.1.tar.gz
742d0f5c5607037112a655c28853639263ad770d catch1-1.12.2.tar.gz

4
.gitignore vendored
View File

@ -1 +1,3 @@
SOURCES/catch1-1.12.1.tar.gz
/catch1-1.12.0.tar.gz
/catch1-1.12.1.tar.gz
/catch1-1.12.2.tar.gz

118
catch1-dynamic-stack.patch Normal file
View File

@ -0,0 +1,118 @@
diff --color -ru a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp
--- a/include/internal/catch_fatal_condition.hpp 2018-05-14 15:15:28.000000000 +0200
+++ b/include/internal/catch_fatal_condition.hpp 2021-07-15 14:08:17.297322549 +0200
@@ -133,10 +133,11 @@
struct FatalConditionHandler {
+ static char* altStackMem;
+ static std::size_t altStackSize;
static bool isSet;
static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)];
static stack_t oldSigStack;
- static char altStackMem[SIGSTKSZ];
static void handleSignal( int sig ) {
std::string name = "<unknown signal>";
@@ -153,10 +154,16 @@
}
FatalConditionHandler() {
+ assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
+ if (altStackSize == 0) {
+ altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), (size_t)(32 * 1024));
+ }
+ altStackMem = new char[altStackSize]();
+
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
- sigStack.ss_size = SIGSTKSZ;
+ sigStack.ss_size = altStackSize;
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = { 0 };
@@ -171,6 +178,11 @@
~FatalConditionHandler() {
reset();
+
+ delete[] altStackMem;
+ // We signal that another instance can be constructed by zeroing
+ // out the pointer.
+ altStackMem = nullptr;
}
static void reset() {
if( isSet ) {
@@ -185,10 +197,11 @@
}
};
+ char* FatalConditionHandler::altStackMem = nullptr;
+ std::size_t FatalConditionHandler::altStackSize = 0;
bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
stack_t FatalConditionHandler::oldSigStack = {};
- char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
} // namespace Catch
diff --color -ru a/single_include/catch.hpp b/single_include/catch.hpp
--- a/single_include/catch.hpp 2018-05-14 15:15:28.000000000 +0200
+++ b/single_include/catch.hpp 2021-07-15 14:21:18.755941570 +0200
@@ -6537,10 +6537,11 @@
struct FatalConditionHandler {
+ static char* altStackMem;
+ static std::size_t altStackSize;
static bool isSet;
static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)];
static stack_t oldSigStack;
- static char altStackMem[SIGSTKSZ];
static void handleSignal( int sig ) {
std::string name = "<unknown signal>";
@@ -6557,10 +6558,16 @@
}
FatalConditionHandler() {
+ assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
+ if (altStackSize == 0) {
+ altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), (size_t)(32 * 1024));
+ }
+ altStackMem = new char[altStackSize]();
+
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
- sigStack.ss_size = SIGSTKSZ;
+ sigStack.ss_size = altStackSize;
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = { 0 };
@@ -6574,6 +6581,11 @@
~FatalConditionHandler() {
reset();
+
+ delete[] altStackMem;
+ // We signal that another instance can be constructed by zeroing
+ // out the pointer.
+ altStackMem = nullptr;
}
static void reset() {
if( isSet ) {
@@ -6588,10 +6600,11 @@
}
};
+ char* FatalConditionHandler::altStackMem = nullptr;
+ std::size_t FatalConditionHandler::altStackSize = 0;
bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
stack_t FatalConditionHandler::oldSigStack = {};
- char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
} // namespace Catch

View File

@ -1,8 +1,8 @@
%global debug_package %{nil}
Name: catch1
Version: 1.12.1
Release: 1%{?dist}
Version: 1.12.2
Release: 11%{?dist}
Summary: A modern, C++-native, header-only, framework for unit-tests, TDD and BDD
License: Boost
@ -11,6 +11,8 @@ Source0: https://github.com/philsquared/Catch/archive/v%{version}/%{name}
BuildRequires: cmake make gcc-c++
Patch1: catch1-dynamic-stack.patch
%description
Catch stands for C++ Automated Test Cases in Headers and is a
multi-paradigm automated test framework for C++ and Objective-C (and,
@ -35,8 +37,8 @@ is packaged up as a single header for extra convenience.
%build
%cmake . -Bbuild
%make_build -Cbuild
%cmake
%cmake_build
%install
@ -45,8 +47,7 @@ cp -pr include %{buildroot}%{_includedir}/catch
%check
cd build
ctest -V %{?_smp_mflags}
%ctest
%files devel
@ -56,6 +57,39 @@ ctest -V %{?_smp_mflags}
%changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.12.2-11
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Jul 15 2021 Zoltan Fridrich <zfridric@redhat.com> - 1.12.2-10
- Add tests
- Fix compilation error due to dynamic stack sizes
Resolves: rhbz#1980993
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1.12.2-8
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.12.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue May 15 2018 Tom Hughes <tom@compton.nu> - 1.12.2-1
- Update to 1.12.2 upstream release
* Sat Mar 3 2018 Tom Hughes <tom@compton.nu> - 1.12.1-1
- Update to 1.12.1 upstream release

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (catch1-1.12.2.tar.gz) = ed963cdca9fe307ee02928677f81cafcb41cd607faaa315182fdf898d0f2aa28f0be2141bd642f46fdfac400c38f6d065e00a595a1e5879fe2335c4a3851e844

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,14 @@
#define CATCH_CONFIG_MAIN
#include <catch/catch.hpp>
unsigned int Factorial(unsigned int number) {
return number <= 1 ? number : Factorial(number - 1) * number;
}
TEST_CASE("Factorials are computed", "[factorial]") {
REQUIRE(Factorial(1) == 1);
REQUIRE(Factorial(2) == 2);
REQUIRE(Factorial(3) == 6);
REQUIRE(Factorial(10) == 3628800);
}

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
set -x
TEST_SOURCE=factorial.cpp
TEST_TARGET="${TEST_SOURCE/\.cpp/}"
CXXFLAGS="$(rpm --eval '%{build_cxxflags}')"
LDFLAGS="$(rpm --eval '%{build_ldflags}')"
LIBFLAGS=""
# build target using distribution-specific flags
g++ -std=c++11 $CXXFLAGS $LDFLAGS $LIBFLAGS -o $TEST_TARGET $TEST_SOURCE
# test that target exists
test -f ./$TEST_TARGET
# test that target is executable
test -x ./$TEST_TARGET
# test that target runs successfully
./$TEST_TARGET

4
tests/provision.fmf Normal file
View File

@ -0,0 +1,4 @@
---
standard-inventory-qcow2:
qemu:
m: 4G

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- devel-usability
required_packages:
- gcc-c++
- rpm
- redhat-rpm-config
- catch1-devel