-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add `TEST_PROPERTIES` keyword in `ecbuild_add_test`
- Loading branch information
Showing
5 changed files
with
61 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
ecbuild_add_test( | ||
TARGET test_ecbuild_test_properties | ||
TYPE SCRIPT | ||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh | ||
ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} | ||
) |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} | ||
SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} | ||
|
||
# Add ecbuild to path | ||
export PATH=$SOURCE/../../bin:$PATH | ||
echo $PATH | ||
echo $SOURCE | ||
|
||
# Build the project | ||
ecbuild $SOURCE/test_project -B $HERE/build | ||
|
||
# Run only one specific test (which should invoke the others) | ||
(cd $HERE/build; ctest -R write_world_after_hello) # Avoid using --test-dir option in ctest | ||
|
||
# Check if the output is as expected | ||
echo -n "Hello, World!" | diff - $HERE/build/output.txt |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.7 FATAL_ERROR) | ||
|
||
find_package( ecbuild REQUIRED ) | ||
project( test_test_properties VERSION 0.1.0 LANGUAGES NONE ) | ||
|
||
ecbuild_add_test( | ||
TARGET clean_output | ||
TEST_PROPERTIES FIXTURES_SETUP clean_output | ||
COMMAND ${CMAKE_COMMAND} | ||
ARGS -E remove ${CMAKE_CURRENT_BINARY_DIR}/output.txt | ||
) | ||
|
||
ecbuild_add_test( | ||
TARGET write_hello | ||
TEST_PROPERTIES FIXTURES_SETUP write_hello FIXTURES_REQUIRED clean_output | ||
COMMAND bash | ||
ARGS -c "echo -n 'Hello, ' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" | ||
) | ||
|
||
ecbuild_add_test( | ||
TARGET write_world_after_hello | ||
TEST_PROPERTIES FIXTURES_REQUIRED write_hello | ||
COMMAND bash | ||
ARGS -c "echo -n 'World!' >> ${CMAKE_CURRENT_BINARY_DIR}/output.txt" | ||
) |