Skip to content

Commit

Permalink
Merge tag 'v3.7.1' into rythe
Browse files Browse the repository at this point in the history
v3.7.1

=== Improvements ===
* Applied the JUnit reporter's optimization from last release to the SonarQube reporter
* Suppressed `-Wuseless-cast` in `CHECK_THROWS_MATCHES` (catchorg#2904)
* Standardize exit codes for various failures
  * Running no tests is now guaranteed to exit with 2 (without the `--allow-running-no-tests` flag)
  * All tests skipped is now always 4 (...)
  * Assertion failures are now always 42
  * and so on

=== Fixes ===
* Fixed out-of-bounds access when the arg parser encounters single `-` as an argument (catchorg#2905)

=== Miscellaneous ===
* Added `catch_config_prefix_messages.hpp` to meson build (catchorg#2903)
* `catch_discover_tests` now supports skipped tests (catchorg#2873)
  * You can get the old behaviour by calling `catch_discover_tests` with `SKIP_IS_FAILURE` option.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEE8QyLZSqAHw/oZQgX3kgwe4sNOBoFAmbpQnMACgkQ3kgwe4sN
# OBpa1Q//UbNsxKpLU7cKzCr3kEOOc2RsryS5foHYRs+mhUzOFYf4y1HkSdvzc3TV
# ZUI8sA5FA1OVO7JtCSpgzizF5vGiOunDFGgroSw9kIxsX0KtHugksNgQcU7QeFEf
# 6KqtKb4/tmRryuyoHZTdWMxBGpB4dtc3zy1Yq+ebe8k52neBmilb80Mz9KbuQ4vT
# QAXz7xWiZukHyxosmKZe5kxDLF3Ck5iVCvvUJu9iwiE6Ua8TIJgs+sOFApsQztmu
# 5hwrmajqZGLB65RQe4G6AXScNLGnzRTJwByR5fg+YFZQmUdjSE0oQ6rd2Ni9qk5c
# QUOPBAVA2A3rahnV3k9bY6SapFjeTZlO4/go9eSzswc2CU7LCX0jRME5d+oW6YJ4
# H0XgacVYM362Exd4hKsSplfuvwkRi1irlnGxHpTvBLBp1czJgUnQV1lwsncaiQFx
# IZfxiqot+V0fPEweVkgHOwf175o9SLLZka6546MFgSvWY8yEEMnl3nLrmeHhCFPq
# 70MdKcj/Qbzkzd5PTSuUoUhxIFZJMzsszj9b0pdGlCb5ObRMcN0UHKG9nVNXWTmn
# tWnukCdzGHsZzaHjH/J0IY8P9ANNjAb5xtROzuF5TmE6h+D5J6kwxGTqZoCyqmC/
# FyPPf1WYkrU2qj+ms7SbdyGlE7s1w8VF/7p3/EKwoE2fpZk/9WM=
# =lDEO
# -----END PGP SIGNATURE-----
# gpg: directory '/c/Users/Ty Rymer/.gnupg' created
# gpg: Signature made Tue Sep 17 10:48:51 2024 WEST
# gpg:                using RSA key F10C8B652A801F0FE8650817DE48307B8B0D381A
# gpg: Can't check signature: No public key
  • Loading branch information
GlynLeine committed Oct 15, 2024
2 parents 723324f + fa43b77 commit e6254f3
Show file tree
Hide file tree
Showing 200 changed files with 8,787 additions and 3,837 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build:vs2022 --cxxopt=/std:c++17

build:windows --config=vs2022
build:linux --config=gcc11
build:macos --cxxopt=-std=c++2b
81 changes: 81 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
# Note: Alas, `Checks` is a string, not an array.
# Comments in the block string are not parsed and are passed in the value.
# They must thus be delimited by ',' from either side - then they are
# harmless. It's terrible, but it works.
Checks: >-
clang-diagnostic-*,
clang-analyzer-*,
-clang-analyzer-optin.core.EnumCastOutOfRange,
bugprone-*,
-bugprone-unchecked-optional-access,
,# This is ridiculous, as it triggers on constants,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-easily-swappable-parameters,
,# Is not really useful, has false positives, triggers for no-noexcept move constructors ...,
-bugprone-exception-escape,
-bugprone-narrowing-conversions,
-bugprone-chained-comparison,# RIP decomposers,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-auto,
-modernize-use-emplace,
-modernize-use-nullptr,# it went crazy with three-way comparison operators,
-modernize-use-trailing-return-type,
-modernize-return-braced-init-list,
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
-modernize-use-default-member-init,
-modernize-type-traits,# we need to support C++14,
-modernize-deprecated-headers,
,# There's a lot of these and most of them are probably not useful,
-modernize-pass-by-value,
performance-*,
-performance-enum-size,
portability-*,
readability-*,
-readability-braces-around-statements,
-readability-container-size-empty,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-named-parameter,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-readability-simplify-boolean-expr,
-readability-static-definition-in-anonymous-namespace,
-readability-uppercase-literal-suffix,
-readability-use-anyofallof,
-readability-avoid-return-with-void-value,
,# time hogs,
-bugprone-throw-keyword-missing,
-modernize-replace-auto-ptr,
-readability-identifier-naming,
,# We cannot use this until clang-tidy supports custom unique_ptr,
-bugprone-use-after-move,
,# Doesn't recognize unevaluated context in CATCH_MOVE and CATCH_FORWARD,
-bugprone-macro-repeated-side-effects,
WarningsAsErrors: >-
clang-analyzer-core.*,
clang-analyzer-cplusplus.*,
clang-analyzer-security.*,
clang-analyzer-unix.*,
performance-move-const-arg,
performance-unnecessary-value-param,
readability-duplicate-include,
HeaderFilterRegex: '.*\.(c|cxx|cpp)$'
FormatStyle: none
CheckOptions: {}
...
16 changes: 6 additions & 10 deletions .conan/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
cmake_minimum_required(VERSION 3.2.0)
project(test_package CXX)
cmake_minimum_required(VERSION 3.15)
project(PackageTest CXX)

include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup()
find_package(Catch2 CONFIG REQUIRED)

find_package(Catch2 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)

target_link_libraries(${PROJECT_NAME} Catch2::Catch2WithMain)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
add_executable(test_package test_package.cpp)
target_link_libraries(test_package Catch2::Catch2WithMain)
target_compile_features(test_package PRIVATE cxx_std_14)
32 changes: 26 additions & 6 deletions .conan/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run
from conan.tools.files import save, load
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package_multi", "cmake"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def generate(self):
save(self, os.path.join(self.build_folder, "package_folder"),
self.dependencies[self.tested_reference_str].package_folder)
save(self, os.path.join(self.build_folder, "license"),
self.dependencies[self.tested_reference_str].license)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
assert os.path.isfile(os.path.join(
self.deps_cpp_info["catch2"].rootpath, "licenses", "LICENSE.txt"))
bin_path = os.path.join("bin", "test_package")
self.run("%s -s" % bin_path, run_environment=True)
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "test_package")
self.run(cmd, env="conanrun")

package_folder = load(self, os.path.join(self.build_folder, "package_folder"))
license = load(self, os.path.join(self.build_folder, "license"))
assert os.path.isfile(os.path.join(package_folder, "licenses", "LICENSE.txt"))
assert license == 'BSL-1.0'
1 change: 0 additions & 1 deletion .github/workflows/linux-meson-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ jobs:

- name: Run tests
working-directory: ${{runner.workspace}}/meson-build
# Hardcode 2 cores we know are there
run: |
meson test --verbose
52 changes: 50 additions & 2 deletions .github/workflows/linux-other-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,53 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
# Hardcode 2 cores we know are there
run: ctest -C ${{matrix.build_type}} -j 2 ${{matrix.other_ctest_args}}
run: ctest -C ${{matrix.build_type}} -j `nproc` ${{matrix.other_ctest_args}}
clang-tidy:
name: clang-tidy ${{matrix.version}}, ${{matrix.build_description}}, C++${{matrix.std}} ${{matrix.build_type}}
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- version: "15"
build_description: all
build_type: Debug
std: 17
other_pkgs: ''
cmake_configurations: -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON
steps:
- uses: actions/checkout@v4

- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang-${{matrix.version}} clang-tidy-${{matrix.version}} ${{matrix.other_pkgs}}
- name: Configure build
working-directory: ${{runner.workspace}}
env:
CXX: clang++-${{matrix.version}}
CXXFLAGS: ${{matrix.cxxflags}}
# Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}.
# This is important
run: |
clangtidy="clang-tidy-${{matrix.version}};-use-color"
# Use a dummy compiler/linker/ar/ranlib to effectively disable the
# compilation and only run clang-tidy.
cmake -Bbuild -H$GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_CXX_EXTENSIONS=OFF \
-DCATCH_DEVELOPMENT_BUILD=ON \
-DCMAKE_CXX_CLANG_TIDY="$clangtidy" \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/true \
-DCMAKE_AR=/usr/bin/true \
-DCMAKE_CXX_COMPILER_AR=/usr/bin/true \
-DCMAKE_RANLIB=/usr/bin/true \
-DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/true \
${{matrix.cmake_configurations}} \
-G Ninja
- name: Run clang-tidy
working-directory: ${{runner.workspace}}/build
run: ninja
3 changes: 1 addition & 2 deletions .github/workflows/linux-simple-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,4 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
# Hardcode 2 cores we know are there
run: ctest -C ${{matrix.build_type}} -j 2
run: ctest -C ${{matrix.build_type}} -j `nproc`
44 changes: 44 additions & 0 deletions .github/workflows/mac-builds-m1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: M1 Mac builds

on: [push, pull_request]

jobs:
build:
runs-on: macos-14
strategy:
matrix:
cxx:
- clang++
build_type: [Debug, Release]
std: [14, 17]
include:
- build_type: Debug
examples: ON
extra_tests: ON

steps:
- uses: actions/checkout@v4

- name: Configure build
working-directory: ${{runner.workspace}}
env:
CXX: ${{matrix.cxx}}
CXXFLAGS: ${{matrix.cxxflags}}
run: |
cmake -Bbuild -H$GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCATCH_DEVELOPMENT_BUILD=ON \
-DCATCH_BUILD_EXAMPLES=${{matrix.examples}} \
-DCATCH_BUILD_EXTRA_TESTS=${{matrix.examples}}
- name: Build tests + lib
working-directory: ${{runner.workspace}}/build
run: make -j `sysctl -n hw.ncpu`

- name: Run tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: ctest -C ${{matrix.build_type}} -j `sysctl -n hw.ncpu`
9 changes: 1 addition & 8 deletions .github/workflows/mac-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ on: [push, pull_request]

jobs:
build:
# macos-12 updated to a toolchain that crashes when linking the
# test binary. This seems to be a known bug in that version,
# and will eventually get fixed in an update. After that, we can go
# back to newer macos images.
runs-on: macos-11
runs-on: macos-12
strategy:
matrix:
cxx:
- g++-11
- clang++
build_type: [Debug, Release]
std: [14, 17]
Expand All @@ -29,8 +24,6 @@ jobs:
env:
CXX: ${{matrix.cxx}}
CXXFLAGS: ${{matrix.cxxflags}}
# Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}.
# This is important
run: |
cmake -Bbuild -H$GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/package-manager-builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Package Manager Builds

on: [push, pull_request]

jobs:
conan_builds:
name: Conan ${{matrix.conan_version}}
runs-on: ubuntu-20.04
strategy:
matrix:
conan_version:
- '1.63'
- '2.1'

include:
# Conan 1 has default profiles installed
- conan_version: '1.63'
profile_generate: 'false'

steps:
- uses: actions/checkout@v4

- name: Install conan
run: pip install conan==${{matrix.conan_version}}

- name: Setup conan profiles
if: matrix.profile_generate != 'false'
run: conan profile detect

- name: Run conan package create
run: conan create . -tf .conan/test_package
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Build
cmake-build-*
benchmark-dir
.conan/test_package/build
**/CMakeUserPresets.json
bazel-*
MODULE.bazel.lock
build-fuzzers
debug-build
.vscode
Expand All @@ -35,3 +37,4 @@ msvc-sln*
docs/doxygen
*.cache
compile_commands.json
**/*.unapproved.txt
2 changes: 2 additions & 0 deletions CMake/CatchMiscFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function(add_warnings_to_targets targets)
"-Wmissing-noreturn"
"-Wmissing-prototypes"
"-Wmissing-variable-declarations"
"-Wnon-virtual-dtor"
"-Wnull-dereference"
"-Wold-style-cast"
"-Woverloaded-virtual"
Expand All @@ -78,6 +79,7 @@ function(add_warnings_to_targets targets)
"-Wreturn-std-move"
"-Wshadow"
"-Wstrict-aliasing"
"-Wsubobject-linkage"
"-Wsuggest-destructor-override"
"-Wsuggest-override"
"-Wundef"
Expand Down
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif()
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON)
option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF)
option(CATCH_ENABLE_REPRODUCIBLE_BUILD "Add compiler flags for improving build reproducibility" ON)

include(CMakeDependentOption)
cmake_dependent_option(CATCH_BUILD_TESTING "Build the SelfTest project" ON "CATCH_DEVELOPMENT_BUILD" OFF)
Expand All @@ -32,7 +33,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()

project(Catch2
VERSION 3.5.0 # CML version placeholder, don't delete
VERSION 3.7.1 # CML version placeholder, don't delete
LANGUAGES CXX
# HOMEPAGE_URL is not supported until CMake version 3.12, which
# we do not target yet.
Expand Down Expand Up @@ -75,8 +76,6 @@ endif()
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SOURCES_DIR ${CATCH_DIR}/src/catch2)
set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest)
set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark)
set(EXAMPLES_DIR ${CATCH_DIR}/examples)

# We need to bring-in the variables defined there to this scope
add_subdirectory(src)
Expand Down Expand Up @@ -199,4 +198,4 @@ if (NOT_SUBPROJECT)

include( CPack )

endif(NOT_SUBPROJECT)
endif()
Loading

0 comments on commit e6254f3

Please sign in to comment.