| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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_DEFAULT_REPORTER |
| 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', 'DefaultReporter') |
| 30 |
|
| 31 |
configure_and_build(catch2_source_path, |
| 32 |
build_dir_path, |
| 33 |
[("CATCH_CONFIG_DEFAULT_REPORTER", "xml")]) |
| 34 |
|
| 35 |
stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), 'SelfTest', ['[approx][custom]']) |
| 36 |
|
| 37 |
xml_tag = '</Catch2TestRun>' |
| 38 |
if xml_tag not in stdout: |
| 39 |
print("Could not find '{}' in the stdout".format(xml_tag)) |
| 40 |
print('stdout: "{}"'.format(stdout)) |
| 41 |
exit(2) |