| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
# Copyright Catch2 Authors |
| 4 |
# Distributed under the Boost Software License, Version 1.0. |
| 5 |
# (See accompanying file LICENSE.txt or copy at |
| 6 |
# https://www.boost.org/LICENSE_1_0.txt) |
| 7 |
|
| 8 |
# SPDX-License-Identifier: BSL-1.0 |
| 9 |
|
| 10 |
from ConfigureTestsCommon import configure_and_build, run_and_return_output |
| 11 |
|
| 12 |
import os |
| 13 |
import re |
| 14 |
import sys |
| 15 |
|
| 16 |
""" |
| 17 |
Tests the CMake configure option for CATCH_CONFIG_DISABLE_STRINGIFICATION |
| 18 |
|
| 19 |
Requires 2 arguments, path folder where the Catch2's main CMakeLists.txt |
| 20 |
exists, and path to where the output files should be stored. |
| 21 |
""" |
| 22 |
|
| 23 |
if len(sys.argv) != 3: |
| 24 |
print('Wrong number of arguments: {}'.format(len(sys.argv))) |
| 25 |
print('Usage: {} catch2-top-level-dir base-build-output-dir'.format(sys.argv[0])) |
| 26 |
exit(1) |
| 27 |
|
| 28 |
catch2_source_path = os.path.abspath(sys.argv[1]) |
| 29 |
build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', 'DisableStringification') |
| 30 |
|
| 31 |
configure_and_build(catch2_source_path, |
| 32 |
build_dir_path, |
| 33 |
[("CATCH_CONFIG_DISABLE_STRINGIFICATION", "ON")]) |
| 34 |
|
| 35 |
stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), |
| 36 |
'SelfTest', |
| 37 |
['-s', '[approx][custom]']) |
| 38 |
|
| 39 |
|
| 40 |
required_output = 'Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION' |
| 41 |
if not required_output in stdout: |
| 42 |
print("Could not find '{}' in the stdout".format(required_output)) |
| 43 |
print('stdout: "{}"'.format(stdout)) |
| 44 |
exit(2) |