1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!/usr/bin/env bash
# (C) Copyright 2020- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
# Usage:
# test-install.sh [CMAKE_ARGUMENTS]
SOURCE=@CMAKE_CURRENT_SOURCE_DIR@/test_install
BUILD=@CMAKE_CURRENT_BINARY_DIR@/test_install
# Error handling
function test_failed {
EXIT_CODE=$?
{ set +ex; } 2>/dev/null
if [ $EXIT_CODE -ne 0 ]; then
echo "+++++++++++++++++"
echo "Test failed"
echo "+++++++++++++++++"
fi
exit $EXIT_CODE
}
trap test_failed EXIT
set -e -o pipefail
set -x
# Start with clean build
rm -rf $BUILD
if [ -z ${ectrans_ROOT+x} ]; then
export ectrans_DIR=@PROJECT_BINARY_DIR@
else
echo "ectrans_ROOT=$ectrans_ROOT"
fi
export ecbuild_DIR=@ecbuild_MACROS_DIR@/../lib/cmake/ecbuild
# Build
mkdir -p $BUILD && cd $BUILD
cmake $SOURCE \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DECBUILD_2_COMPAT=OFF \
"$@"
make VERBOSE=1
if [ -f bin/main_dp ]; then
bin/main_dp
fi
if [ -f bin/main_sp ]; then
bin/main_sp
fi
if [ -f bin/transi_sptogp ]; then
bin/transi_sptogp
fi
{ set +ex; } 2>/dev/null
echo "+++++++++++++++++"
echo "Test passed"
echo "+++++++++++++++++"
|