diff --git a/.gitignore b/.gitignore index a20656a..8566bb4 100755 --- a/.gitignore +++ b/.gitignore @@ -225,6 +225,7 @@ nrtestsuite/ tests/data/ #Cmake stuff +__cmake_systeminformation/ buildprod*/ *_export.h diff --git a/tools/before-test.sh b/tools/before-test.sh index 72b1a7e..5e3d805 100755 --- a/tools/before-test.sh +++ b/tools/before-test.sh @@ -1,6 +1,6 @@ #! /bin/bash -# +# # before-test.sh - Prepares Travis CI worker to run epanet regression tests # # Date Created: 04/04/2018 @@ -8,25 +8,62 @@ # Author: Michael E. Tryby # US EPA - ORD/NRMRL # -# Arguments: -# 1 - relative path regression test file staging location -# 2 - absolute path to location of software under test -# 3 - build identifier for software under test -# -# Note: +# Arguments: +# 1 - (platform) +# 2 - (build id for reference) +# 3 - (build id for software under test) +# 4 - (version id for software under test) +# 5 - (relative path regression test file staging location) +# +# Note: # Tests and benchmark files are stored in the epanet-example-networks repo. -# This script retreives them using a stable URL associated with a release on -# GitHub and stages the files for nrtest to run. The script assumes that -# before-test.sh and gen-config.sh are located together in the same folder. +# This script retreives them using a stable URL associated with a release on +# GitHub and stages the files for nrtest to run. The script assumes that +# before-test.sh and gen-config.sh are located together in the same folder. + +if [ -z $1 ]; then + unset PLATFORM; +else + PLATFORM=$1; +fi + +if [ -z $2 ]; then + echo "ERROR: REF_BUILD_ID must be defined"; exit 1; +else + REF_BUILD_ID=$2; +fi + +if [ -z $3 ]; then + SUT_BUILD_ID="local"; +else + SUT_BUILD_ID=$3; +fi + +if [ -z $4 ]; then + SUT_VERSION="unknown"; +else + SUT_VERSION=$4; fi + +if [ -z $5 ]; then + TEST_HOME="nrtestsuite"; +else + TEST_HOME=$5; fi + SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -TEST_HOME=$1 +BUILD_HOME="$(dirname "$SCRIPT_HOME")" -EXAMPLES_VER="1.0.2-dev.1" -BENCHMARK_VER="220dev1" -TEST_URL="https://github.com/OpenWaterAnalytics/epanet-example-networks/archive/v${EXAMPLES_VER}.tar.gz" -BENCH_URL="https://github.com/OpenWaterAnalytics/epanet-example-networks/releases/download/v${EXAMPLES_VER}/epanet-benchmark-${BENCHMARK_VER}.tar.gz" +SUT_PATH=(`find $BUILD_HOME -name "bin" -type d`) + + +# TODO: determine platform + +# determine latest tag from GitHub API +LATEST_TAG=$(curl --silent "https://api.github.com/repos/openwateranalytics/epanet-example-networks/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') + +TEST_URL="https://github.com/OpenWaterAnalytics/epanet-example-networks/archive/${LATEST_TAG}.tar.gz" +BENCH_URL="https://github.com/OpenWaterAnalytics/epanet-example-networks/releases/download/${LATEST_TAG}/benchmark-${PLATFORM}-${REF_BUILD_ID}.tar.gz" echo INFO: Staging files for regression testing @@ -47,7 +84,7 @@ curl -fsSL -o benchmark.tar.gz ${BENCH_URL} # extract tests and benchmarks tar xzf examples.tar.gz -ln -s epanet-example-networks-${EXAMPLES_VER}/epanet-tests tests +ln -s epanet-example-networks-${LATEST_TAG:1}/epanet-tests tests mkdir benchmark tar xzf benchmark.tar.gz -C benchmark @@ -55,4 +92,4 @@ tar xzf benchmark.tar.gz -C benchmark # generate json configuration file for software under test mkdir apps -${SCRIPT_HOME}/gen-config.sh $2 > apps/epanet-$3.json +${SCRIPT_HOME}/gen-config.sh ${SUT_PATH} ${PLATFORM} ${SUT_BUILD_ID} ${SUT_VERSION} > apps/epanet-${SUT_BUILD_ID}.json diff --git a/tools/gen-config.sh b/tools/gen-config.sh index a937054..cb9620c 100755 --- a/tools/gen-config.sh +++ b/tools/gen-config.sh @@ -1,6 +1,6 @@ #! /bin/bash -# +# # gen-config.sh - Generates nrtest app configuration file for test executable # # Date Created: 10/16/2017 @@ -10,10 +10,9 @@ # # Arguments: # 1 - absolute path to test executable -# -# NOT IMPLEMENTED YET -# 2 - test executable version number -# 3 - build description +# 2 - platform +# 3 - SUT build id +# 4 - SUT version id # unameOut="$(uname -s)" @@ -28,18 +27,15 @@ case "${unameOut}" in abs_build_path="$( echo "$1" | sed -e 's#/c##' )" test_cmd="runepanet.exe" ;; - + *) # Machine unknown esac -version="" -build_description="" - cat<