1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-01-29 18:56:31 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Clare Macrae
40b9df567f Add missing cmake option to fix buildAndTest.sh
Note that the documentation was updated automatically, by running:
 ./tools/scripts/updateDocumentSnippets.py
2020-10-28 11:38:06 +01:00
Clare Macrae
c6352c3e1f Embed the script buildAndTest.sh inside the docs 2020-10-28 11:38:06 +01:00
Clare Macrae
4035beb988 Add a script - buildAndTest.sh
This contains the currently-documented steps for a developer build.
Also, make git ignore its output directory.
2020-10-28 11:38:06 +01:00
Clare Macrae
8c3970465d Add infrastructure for embedding code samples in docs. 2020-10-28 11:38:06 +01:00
Clare Macrae
f57689f888 Fix minor typo in docs. 2020-10-28 11:38:06 +01:00
6 changed files with 76 additions and 17 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ benchmark-dir
.conan/test_package/build
bazel-*
build-fuzzers
debug-build

View File

@ -56,7 +56,7 @@ By default a console width of 80 is assumed but this can be controlled by defini
CATCH_CONFIG_NOSTDOUT
To support platforms that do not provide `std::cout`, `std::cerr` and
`std::clog`, Catch does not usem the directly, but rather calls
`std::clog`, Catch does not use them directly, but rather calls
`Catch::cout`, `Catch::cerr` and `Catch::clog`. You can replace their
implementation by defining `CATCH_CONFIG_NOSTDOUT` and implementing
them yourself, their signatures are:

View File

@ -78,23 +78,30 @@ the invocation of CMake configuration step.
Bringing this all together, the steps below should configure, build,
and run all tests in the `Debug` compilation.
1. Regenerate the amalgamated distribution
<!-- snippet: catch2-build-and-test -->
<a id='snippet-catch2-build-and-test'></a>
```sh
# 1. Regenerate the amalgamated distribution
./tools/scripts/generateAmalgamatedFiles.py
# 2. Configure the full test build
cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_DEVELOPMENT_BUILD=ON
# 3. Run the actual build
cmake --build debug-build
# 4. Run the tests using CTest
cd debug-build
ctest -j 4 --output-on-failure -C Debug
```
$ cd Catch2
$ ./tools/scripts/generateAmalgamatedFiles.py
```
2. Configure the full test build
```
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON
```
3. Run the actual build
```
$ cmake --build debug-build
```
4. Run the tests using CTest
```
$ cd debug-build
$ ctest -j 4 --output-on-failure -C Debug
<sup><a href='/tools/scripts/buildAndTest.sh#L6-L19' title='File snippet `catch2-build-and-test` was extracted from'>snippet source</a> | <a href='#snippet-catch2-build-and-test' title='Navigate to start of snippet `catch2-build-and-test`'>anchor</a></sup>
<!-- endSnippet -->
For convenience, the above commands are in the script `tools/scripts/buildAndTest.sh`, and can be run like this:
```bash
cd Catch2
./tools/scripts/buildAndTest.sh
```
If you added new tests, you will likely see `ApprovalTests` failure.

9
mdsnippets.json Normal file
View File

@ -0,0 +1,9 @@
{
"ReadOnly": false,
"TocLevel": 5,
"Exclude": [
"cmake-build"
],
"WriteHeader": false,
"Convention": "InPlaceOverwrite"
}

19
tools/scripts/buildAndTest.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env sh
# Start at the root of the Catch project directory, for example:
# cd Catch2
# begin-snippet: catch2-build-and-test
# 1. Regenerate the amalgamated distribution
./tools/scripts/generateAmalgamatedFiles.py
# 2. Configure the full test build
cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_DEVELOPMENT_BUILD=ON
# 3. Run the actual build
cmake --build debug-build
# 4. Run the tests using CTest
cd debug-build
ctest -j 4 --output-on-failure -C Debug
# end-snippet

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
from scriptCommon import catchPath
import os
import subprocess
# ---------------------------------------------------
# Update code examples
# ---------------------------------------------------
# For info on mdsnippets, see https://github.com/SimonCropp/MarkdownSnippets
# install dotnet SDK from http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
# Then install MarkdownSnippets.Tool with
# dotnet tool install -g MarkdownSnippets.Tool
# To update:
# dotnet tool update -g MarkdownSnippets.Tool
# To uninstall (e.g. to downgrade to a lower version)
# dotnet tool uninstall -g MarkdownSnippets.Tool
os.chdir(catchPath)
subprocess.run('dotnet tool update -g MarkdownSnippets.Tool --version 21.2.0', shell=True, check=True)
subprocess.run('mdsnippets', shell=True, check=True)