forked from TriBITSPub/TriBITS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get tribits_add_advanced_test() to work from non-CMake projects (TriB…
…ITSPub#368, TriBITSPub#582) Changes to TriBITS: * Changed explicit includes from TribitsAddAdvancedTest.cmake (this module and its included modules will be moved to tribits/core/test_support/ in next commit). * Remove option to prefix test base name in tribits_add_advanced_test() by '${PROJECT_NAME}_' (since tribits_set_tribits_package_name() is now being called to set PACKAGE_NAME give PROJECT_NAME). * Changed tribits_add_advanced_test() to set explicit include of DriveAdvancedTest.cmake without setting CMAKE_MODULE_PATH. * Use more explicit includes in tribits/core/utils/*.cmake mdoules needed to get above to work. Changes to TribitsExampleProject2/Packages1: * Updated package1-prg to accept command-line arguments that are echoed to STDOUT. * Added new test Package1_Prg-advanced taking in command-line arguments using tribits_add_advanced_test() and in raw CMake build. Changes to tests: * Removed regex for CMAKE_MODULE_PATH from driver file for tribits_add_advanced_test() (which reduces the total number of checks by 1).
- Loading branch information
1 parent
1f69bbb
commit 7332f9b
Showing
11 changed files
with
73 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_Prg.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include "Package1.hpp" | ||
|
||
int main() | ||
int main(int argc, char* argv[]) | ||
{ | ||
std::cout << "Package1 Deps: " << Package1::deps() << "\n"; | ||
for (int arg_i = 0; arg_i < argc; ++arg_i) { | ||
std::cout << argv[arg_i+1] << "\n"; | ||
} | ||
return 0; | ||
} |
10 changes: 10 additions & 0 deletions
10
tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
add_test(NAME Package1_Prg COMMAND package1-prg) | ||
set_tests_properties(Package1_Prg | ||
PROPERTIES PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1") | ||
|
||
add_test(NAME Package1_Prg-advanced COMMAND package1-prg something_extra) | ||
set_tests_properties(Package1_Prg-advanced | ||
PROPERTIES PASS_REGULAR_EXPRESSION "something_extra") | ||
|
||
# NOTE: With raw CMake/CTest, it is not possible to require the matches of | ||
# multiple regexes. Also, it is not possible to require a non-zero return | ||
# code in addition to requiring a regex match the output. These more advanced | ||
# features of tribits_add_advanced_test() would need to be provided by writing | ||
# a wrapper script (e.g. using a Python script, a cmake -P script, etc.) |
13 changes: 13 additions & 0 deletions
13
tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX | ||
NAME Prg DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../src" NUM_MPI_PROCS 1 | ||
PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" ) | ||
|
||
tribits_add_advanced_test(Prg-advanced | ||
OVERALL_WORKING_DIRECTORY TEST_NAME | ||
OVERALL_NUM_MPI_PROCS 1 | ||
TEST_0 | ||
EXEC package1-prg DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../src" | ||
NOEXEPREFIX NOEXESUFFIX | ||
ARGS "something_extra" | ||
PASS_REGULAR_EXPRESSION_ALL | ||
"Package1 Deps: tpl1" | ||
"something_extra" | ||
ALWAYS_FAIL_ON_NONZERO_RETURN | ||
) |