add targets for individual tests (#3431)

This commit is contained in:
Dustin J. Mitchell 2024-05-03 10:06:29 -04:00 committed by GitHub
parent 28a46880a2
commit 8aa4758993
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -56,7 +56,7 @@ First switch to the test directory:
``` ```
Then you can run all tests, showing details, with Then you can run all tests, showing details, with
``` ```
$ make VERBOSE=1 $ make VERBOSE=1 test
``` ```
Alternately, run the tests with the details hidden in `all.log`: Alternately, run the tests with the details hidden in `all.log`:
``` ```
@ -66,6 +66,10 @@ Either way, you can get a summary of any test failures with:
``` ```
$ ./problems $ ./problems
``` ```
You can run a single test suite, with source file `foo.test.cpp` or `foo.test.py`, with
```
$ make foo.test
```
Note that any development should be performed using a git clone, and the current development branch. Note that any development should be performed using a git clone, and the current development branch.
The source tarballs do not reflect HEAD, and do not contain the test suite. The source tarballs do not reflect HEAD, and do not contain the test suite.

View file

@ -64,6 +64,13 @@ foreach (src_FILE ${test_SRCS})
if (DARWIN) if (DARWIN)
target_link_libraries (${src_FILE} "-framework CoreFoundation -framework Security -framework SystemConfiguration") target_link_libraries (${src_FILE} "-framework CoreFoundation -framework Security -framework SystemConfiguration")
endif (DARWIN) endif (DARWIN)
# Add a custom `foo.test` target.
string(REGEX REPLACE "\\.[^.]*$" "" test_target ${src_FILE})
add_custom_target (${test_target}
./${src_FILE}
DEPENDS ${src_FILE}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test)
endforeach (src_FILE) endforeach (src_FILE)
configure_file(run_all run_all COPYONLY) configure_file(run_all run_all COPYONLY)
@ -197,6 +204,13 @@ set (pythonTests
foreach (python_Test ${pythonTests}) foreach (python_Test ${pythonTests})
configure_file(${python_Test} ${python_Test} COPYONLY) configure_file(${python_Test} ${python_Test} COPYONLY)
# Add a custom `foo.test` target.
string(REGEX REPLACE "\\.[^.]*$" "" test_target ${python_Test})
add_custom_target (${test_target}
./${python_Test}
DEPENDS ${python_Test}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test)
endforeach(python_Test) endforeach(python_Test)
#SET(CMAKE_BUILD_TYPE gcov) #SET(CMAKE_BUILD_TYPE gcov)