@@ -41,7 +41,9 @@ relating to compilation so that they can be conveniently edited in one place.
41
41
contains commands that are needed in every makefile but which the
42
42
developer is not expected to edit. (There is also
43
43
[ another config.inc] ( https://github.com/diffblue/cbmc/blob/develop/jbmc/src/config.inc )
44
- which is also included in every makefile in the ` jbmc ` folder.)
44
+ which is also included in every makefile in the ` jbmc ` folder.)
45
+
46
+ Note, these files are not involved in the CMake build.
45
47
46
48
47
49
\subsubsection compilation-and-development-subsubsection-macro-debug Macro DEBUG
@@ -59,31 +61,63 @@ The regression tests are contained in `regression/` and `jbmc/regression/`.
59
61
Inside these folders there is a directory for each of the tools/modules. Each
60
62
of these contains multiple test directories, with names describing
61
63
what they test. When there are multiple tests in a test directory then
62
- they should be testing very similar aspects of the program's behaviour. Each
64
+ they should all test very similar aspects of the program's behaviour. Each
63
65
test directory contains input files and one or more test description files,
64
66
which have the ending ` .desc ` . The test description files describe what command
65
67
to run, what output is expected and so on. The test framework is a
66
68
Perl script,
67
- [ test.pl] ( https://github.com/diffblue/cbmc/blob/develop/regression/test.pl ) .
68
- To run all the tests in a directory corresponding to a tool or module:
69
-
70
- ../test.pl -c PATH_TO_CBMC
69
+ [ test.pl] ( https://github.com/diffblue/cbmc/blob/develop/regression/test.pl ) ,
70
+ located in ` regression/test.pl ` .
71
71
72
- The ` --help ` option to ` test.pl ` gives instructions for use and outlines the
72
+ The ` --help ` option to ` test.pl ` outlines the
73
73
format of the test description files. Most importantly, the first word in a
74
74
test description file is its level, which is one of: ` CORE ` (should be run in
75
75
CI, should succeed), ` THOROUGH ` (takes too long to be run in CI, should
76
76
succeed), ` FUTURE ` (will succeed when a planned feature is added) or
77
77
` KNOWNBUG ` (will succeed when a bug is fixed).
78
78
79
- If you have compiled CBMC using CMake then another way to run the same tests
80
- is through ` CTest ` . From the build directory, the command ` ctest -V -L CORE `
81
- will run all of the tests that are labelled CORE in the desc files and unit
82
- tests. ` -V ` makes it print out more
83
- useful output and ` -L CORE ` makes it only run tests that have been tagged
84
- ` CORE ` . ` -R regular_expression ` can be used to limit which tests are run, and
85
- ` -N ` makes it lists which tests it will run without actually running them.
79
+ \subsubsection compilation-and-development-subsubsection-running-regression-tests-with-make Running regression tests with ` make `
80
+
81
+ If you have compiled using ` make ` then you can run the regression tests
82
+ using ` make test ` . Run it from ` regression/ ` to run all the regression tests,
83
+ or any of its subfolders to just run the tests in that subfolder.
84
+
85
+ If you have not compiled using ` make ` then this won't work, because the
86
+ makefile is expecting to find binaries like ` cbmc ` and ` jbmc ` in the source
87
+ folders.
88
+
89
+ \subsubsection compilation-and-development-subsubsection-running-regression-tests-with-ctest Running regression tests with ` ctest `
90
+
91
+ If you have compiled using CMake then you can run the regression tests (and
92
+ the unit tests) using CTest.
93
+
94
+ Here are two example commands, to be run from the build directory:
95
+
96
+ ctest -V -L CORE -R cpp
97
+ ctest -V -L CORE -R cpp -E cbmc-cpp
86
98
99
+ ` -V ` makes it print out more
100
+ useful output. ` -L CORE ` makes it only run tests that have been tagged
101
+ ` CORE ` . ` -R regular_expression ` can be used to limit which tests are run to
102
+ those which match the given regular expression, and ` -E regex ` excludes tests
103
+ to those which match the given regular expression.
104
+ So the first command will run all the CORE tests in ` regression/cbmc/cpp ` and
105
+ ` regression/cbmc/cbmc-cpp ` , and the second will run all the CORE tests in
106
+ ` regression/cbmc/cpp ` only. Another useful option is ` -N ` , which makes CTest
107
+ list which tests it will run without actually running them.
108
+
109
+
110
+ \subsubsection compilation-and-development-subsubsection-running-regression-tests-directly-with-test-pl Running regression tests directly with ` test.pl `
111
+
112
+ In a directory corresponding to a tool or module, you can directly run a
113
+ test directory as follows:
114
+
115
+ ../test.pl -c PATH_TO_CBMC_FROM_DESC_FILE TEST_DIR
116
+
117
+ Note that ` PATH_TO_CBMC_FROM_DESC_FILE ` should either be absolute or be
118
+ relative to the location of the test description files. If ` TEST_DIR ` is
119
+ not provided then all test directories are run.
120
+
87
121
88
122
\subsection compilation-and-development-subsection-unit-tests Unit tests
89
123
@@ -98,6 +132,8 @@ To run the unit tests for JBMC, go to `jbmc/unit/` and run
98
132
99
133
../../<build-folder>/bin/java-unit
100
134
135
+ The unit tests are also included in CTest as ` unit ` and ` java-unit ` .
136
+
101
137
Note that some tests run which are expected to fail - see the summary at
102
138
the end of the run to see how many tests passed, how many failed which were
103
139
expected to and how many tests failed which were not expected to.
0 commit comments