Closed szarnyasg closed 1 year ago
It seems using the binary in build/
is a good approach for running an individual test.
I also found using the CTEST_OUTPUT_ON_FAILURE
useful to see the output upon test failure, e.g.:
CTEST_OUTPUT_ON_FAILURE=1 make test
I know you already have a working solution but I wanted to post an alternative in case it helps with related use cases. You can use ctest
to "drive" the test suite and select subsets of the tests. For example, to run just test_PageRank
you could do the following:
# Inside build directory
ctest -R test_PageRank$ # <== Notice the $ for the regex here
The real power of this comes when you want to run more than one of the tests at a time. If multiple tests are named in a related way (e.g. test_PageRank
and test_PageRankGX
), then you select both them at the same time:
# Inside build directory
ctest -R test_PageRank --parallel 2
You can string together multiple regular expressions here and there are exclude flags you can use as well. Here are the cmake docs, let me know if you have questions about them.
This was exactly what I was looking for. Thanks very much, @jamesETsmith!
I am developing a PageRank variant for Graphalytics and would like to run the tests in a single test file during the development.
I can
make install
and run the PageRank unit test withbuild/src/test/test_PageRank
.Is there a more elegant way to run a single test file from
make
(something likemake test XX
)?