Skip to content

Commit 7569b95

Browse files
committed
Merge branch 'improve-testing-docs' into 'v92-bugfix'
Expand testing README for CMake See merge request integer/scip!3568
2 parents 96386ad + 3c34d15 commit 7569b95

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: tests/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Here are some test examples that can help you get started writing unit tests.
3333

3434
## Compile
3535

36+
### With the `Makefile` System
37+
3638
Smart test discovery is already built into the `Makefile`, so anything in `src` (at any level of nesting) will be detected and compiled into the equivalent path in the `bin` directory. Also, the `Makefile` generates the test "makefile" for `ctest`. There should never be a reason to directly modify any Makefile unless you are hacking on the SCIP Unit Test Suite.
3739

3840
The easiest way to compile and run the tests is:
@@ -54,8 +56,27 @@ Go to `Criterion/dependencies/klib` and execute `git co cdb7e92` and then go to
5456

5557
**NOTE** Some tests might need to include c files from SCIP. For tests to be recompilied the included c file gets recompiled, run `make depend`.
5658

59+
### With the CMake System
60+
61+
Create a build directory and build the unittests
62+
```bash
63+
mkdir build
64+
cd build
65+
cmake .. YOUR_CMAKE_CONFIGURATION
66+
make unittests -j
67+
```
68+
69+
There's a target for each test file, that's generated by cmake if you would like to compile only one test.
70+
For example,
71+
```bash
72+
make unittest-scip-stages -j
73+
```
74+
To compile the `stages.c` test file in `tests/scip` directory.
75+
5776
## Run
5877

78+
### With the Makefile System
79+
5980
See above for the easiest way to compile and run tests. For simply running tests:
6081

6182
```
@@ -90,6 +111,18 @@ Alternatively, one can disable ASLR system-wide (requires root access):
90111

91112
TODO: Define a policy for moving/removing tests in `src/bugs` once the bugs are fixed.
92113

114+
### With the CMake System
115+
116+
To run all tests:
117+
```
118+
ctest
119+
```
120+
121+
To run tests with pattern filter:
122+
```
123+
ctest -R FILTER_PATTERN
124+
```
125+
93126
## Debug (up to Criterion 2.2.2)
94127

95128
If a test fails, use `gdb` to debug. For example:

0 commit comments

Comments
 (0)