From 799874d3c8c0cd362da0362baede9f89f21eff32 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 11 Feb 2019 15:43:53 -0500 Subject: [PATCH 1/3] Adding options and usage to run-nrtest.sh --- tools/run-nrtest.sh | 65 ++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/tools/run-nrtest.sh b/tools/run-nrtest.sh index 0c302f7..adf4e21 100755 --- a/tools/run-nrtest.sh +++ b/tools/run-nrtest.sh @@ -1,7 +1,7 @@ #! /bin/bash # -# run-nrtest.sh - Runs numerical regression test +# run-nrtest.sh - Runs numerical regression test # # Date Created: 10/16/2017 # @@ -10,22 +10,22 @@ # # Arguments: # 1 - relative path to location there test suite is staged -# 2 - version/build identifier -# +# 2 - version/build identifier +# run-nrtest() -{ +{ return_value=0 -test_suite_path=$1 +test_suite_path=$2 benchmark_ver="220dev1" nrtest_execute_cmd="nrtest execute" -test_app_path="apps/epanet-$2.json" -tests="tests/examples tests/exeter tests/large tests/network_one tests/small tests/tanks tests/valves" -test_output_path="benchmark/epanet-$2" +test_app_path="apps/epanet-$3.json" +tests="tests/examples" # tests/exeter tests/large tests/network_one tests/small tests/tanks tests/valves" +test_output_path="benchmark/epanet-$3" nrtest_compare_cmd="nrtest compare" ref_output_path="benchmark/epanet-${benchmark_ver}" @@ -42,19 +42,46 @@ rm -rf ${test_output_path} echo INFO: Creating test benchmark nrtest_command="${nrtest_execute_cmd} ${test_app_path} ${tests} -o ${test_output_path}" echo INFO: "$nrtest_command" -if ! [ $( $nrtest_command ) ]; then - echo - echo INFO: Comparing test and ref benchmarks - nrtest_command="${nrtest_compare_cmd} ${test_output_path} ${ref_output_path} --rtol ${rtol_value} --atol ${atol_value}" - echo INFO: "$nrtest_command" - return_value=$( $nrtest_command ) -else - echo ERROR: Test benchmark creation failed - exit 1 +return_value=$( $nrtest_command ) + +if [ $1 = 'true' ]; then + echo + echo INFO: Comparing test and ref benchmarks + nrtest_command="${nrtest_compare_cmd} ${test_output_path} ${ref_output_path} --rtol ${rtol_value} --atol ${atol_value}" + echo INFO: "$nrtest_command" + return_value=$( $nrtest_command ) fi return $return_value - } -run-nrtest $1 $2 +print_usage() { + echo " " + echo "run-nrtest.sh - generates artifacts for SUT and performes benchmark comparison " + echo " " + echo "options:" + echo "-c, don't compare SUT and benchmark artifacts" + echo "-t test_path relative path to location where test suite is staged" + echo "-v version version/build identifier" +} + +# Default option values +compare='true' +test_path='nrtestsuite' +version='vXXX' + +while getopts ":ct:v:" flag; do + case "${flag}" in + c ) compare='false' ;; + t ) test_path="${OPTARG}" ;; + v ) version=${OPTARG} ;; + \? ) print_usage + exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +# Invoke command +run_command="run-nrtest ${compare} ${test_path} ${version}" +echo INFO: "$run_command" +$run_command From 3e8e1c6009ed9bd127b17d7823a14ec39b425748 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 11 Feb 2019 15:44:26 -0500 Subject: [PATCH 2/3] Updating Travis to run coverage for reg tests --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0702dd1..43a8472 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,10 +28,10 @@ script: - cd tests - ctest # run regression tests - #- cd $EPANET_HOME - #- pip install -r tools/requirements.txt - #- tools/before-test.sh $TEST_HOME $EPANET_HOME/$BUILD_HOME/bin $TRAVIS_COMMIT - #- tools/run-nrtest.sh $TEST_HOME $TRAVIS_COMMIT + - cd $EPANET_HOME + - pip install -r tools/requirements.txt + - tools/before-test.sh $TEST_HOME $EPANET_HOME/$BUILD_HOME/bin $TRAVIS_COMMIT + - tools/run-nrtest.sh -c -t $TEST_HOME -v $TRAVIS_COMMIT after_success: - bash <(curl -s https://codecov.io/bash) From f4ea0a671eae0a3aa8c30c9e8fe35f6a5703b3af Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 11 Feb 2019 15:51:40 -0500 Subject: [PATCH 3/3] Running all tests --- .travis.yml | 1 - tools/run-nrtest.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43a8472..0eb3f74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ before_install: install: - sudo apt-get install -y libboost-test-dev - sudo apt-get install -y libboost-thread-dev - - pip install -r tools/requirements.txt before_script: - mkdir -p $BUILD_HOME diff --git a/tools/run-nrtest.sh b/tools/run-nrtest.sh index adf4e21..fd05bb4 100755 --- a/tools/run-nrtest.sh +++ b/tools/run-nrtest.sh @@ -24,7 +24,7 @@ benchmark_ver="220dev1" nrtest_execute_cmd="nrtest execute" test_app_path="apps/epanet-$3.json" -tests="tests/examples" # tests/exeter tests/large tests/network_one tests/small tests/tanks tests/valves" +tests="tests/examples tests/exeter tests/large tests/network_one tests/small tests/tanks tests/valves" test_output_path="benchmark/epanet-$3" nrtest_compare_cmd="nrtest compare"