-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests according to Github issue #65
- Loading branch information
1 parent
3ea1a7a
commit 662902f
Showing
5 changed files
with
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
ecbuild_add_test( | ||
TARGET test_ecbuild_project_summary | ||
TYPE SCRIPT | ||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure.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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} | ||
|
||
# --------------------- cleanup ------------------------ | ||
echo "cleaning $HERE" | ||
rm -rf $HERE/build_* |
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
function EXPECT_ONE_OF() | ||
{ | ||
local file=$1 | ||
local pattern=$2 | ||
local found=$(cat ${file} | grep "${pattern}" | wc -l | xargs) | ||
|
||
if [ "$found" != "1" ]; then | ||
echo "File ${file} does not contain exacly one of '$2'" | ||
exit 1 | ||
fi | ||
} | ||
|
||
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 | ||
|
||
# --------------------- cleanup ------------------------ | ||
$SOURCE/clean.sh | ||
|
||
# ----------------- configure project --------------------- | ||
|
||
# Options: -DENABLE_MYFEATURE=ON | ||
|
||
mkdir -p $HERE/build_1 | ||
ecbuild -DENABLE_MYFEATURE=ON $SOURCE/test_project -B $HERE/build_1 | tee $HERE/build_1.log | ||
EXPECT_ONE_OF $HERE/build_1.log "* MYFEATURE, proja(✔): '', projb(✔): ''" | ||
|
||
# Options: -DENABLE_MYFEATURE=ON -DPROJB_ENABLE_MYFEATURE=OFF | ||
|
||
mkdir -p $HERE/build_2 | ||
ecbuild -DENABLE_MYFEATURE=ON -DPROJB_ENABLE_MYFEATURE=OFF $SOURCE/test_project -B $HERE/build_2 | tee $HERE/build_2.log | ||
EXPECT_ONE_OF $HERE/build_2.log "* MYFEATURE, proja(✔): '', projb(✘): ''" | ||
|
||
# Options: -DENABLE_MYFEATURE=OFF -DPROJB_ENABLE_MYFEATURE=ON | ||
|
||
mkdir -p $HERE/build_3 | ||
ecbuild -DENABLE_MYFEATURE=OFF -DPROJB_ENABLE_MYFEATURE=ON $SOURCE/test_project -B $HERE/build_3 | tee $HERE/build_3.log | ||
EXPECT_ONE_OF $HERE/build_3.log "* MYFEATURE, proja(✘): '', projb(✔): ''" |
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,16 @@ | ||
cmake_minimum_required( VERSION 3.18.4 FATAL_ERROR ) | ||
find_package( ecbuild 3.4 REQUIRED ) | ||
|
||
project( proja LANGUAGES NONE VERSION 0.2 ) | ||
ecbuild_add_option( | ||
FEATURE MYFEATURE | ||
DEFAULT ON | ||
) | ||
|
||
project( projb LANGUAGES NONE VERSION 0.1 ) | ||
ecbuild_add_option( | ||
FEATURE MYFEATURE | ||
DEFAULT OFF | ||
) | ||
|
||
ecbuild_print_summary() |