Merge branch 'add-test-cases' into dev

This commit is contained in:
Michael Tryby
2018-04-02 11:48:07 -04:00
184 changed files with 487738 additions and 25 deletions

46
tools/app-config.sh Normal file
View File

@@ -0,0 +1,46 @@
#! /bin/bash
#
# app-config.sh - Generates nrtest app configuration file for test executable
#
# Date Created: 3/19/2018
#
# Author: Michael E. Tryby
# US EPA - ORD/NRMRL
#
# Arguments:
# 1 - absolute path to test executable
#
# NOT IMPLEMENTED YET
# 2 - test executable version number
# 3 - build description
#
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) ;&
Darwin*) abs_build_path=$1
test_cmd="runepanet"
;;
MINGW*) ;&
MSYS*) # Remove leading '/c' from file path for nrtest
abs_build_path="$( echo "$1" | sed -e 's#/c##' )"
test_cmd="runepanet.exe"
;;
*) # Machine unknown
esac
version=""
build_description=""
cat<<EOF
{
"name" : "epanet",
"version" : "${version}",
"description" : "${build_description}",
"setup_script" : "",
"exe" : "${abs_build_path}/${test_cmd}"
}
EOF

View File

@@ -107,8 +107,8 @@ def epanet_report_compare(path_test, path_ref, rtol, atol):
RunTimeError()
...
'''
HEADER = 11
FOOTER = 3
HEADER = 10
FOOTER = 2
with open(path_test ,'r') as ftest, open(path_ref, 'r') as fref:

View File

@@ -20,7 +20,7 @@ set TEST_SUITE_PATH=%~2
set NRTEST_EXECUTE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest execute
set TEST_APP_PATH=apps\epanet-%3.json
set TESTS=tests\examples
set TESTS=tests\examples tests\exeter tests\large tests\network_one tests\small tests\tanks tests\valves
set TEST_OUTPUT_PATH=benchmark\epanet-%3
set NRTEST_COMPARE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest compare
@@ -41,6 +41,8 @@ set NRTEST_COMMAND=%NRTEST_EXECUTE_CMD% %TEST_APP_PATH% %TESTS% -o %TEST_OUTPUT_
:: if there is an error exit the script with error value 1
%NRTEST_COMMAND% || exit /B 1
echo.
echo INFO: Comparing test and ref benchmark
set NRTEST_COMMAND=%NRTEST_COMPARE_CMD% %TEST_OUTPUT_PATH% %REF_OUTPUT_PATH% --rtol %RTOL_VALUE% --atol %ATOL_VALUE%
%NRTEST_COMMAND%

View File

@@ -22,7 +22,7 @@ test_suite_path=$1
nrtest_execute_cmd="nrtest execute"
test_app_path="apps/epanet-$2.json"
tests="tests/examples"
tests="tests/examples tests/exeter tests/large tests/network_one tests/small tests/tanks tests/valves"
test_output_path="benchmark/epanet-$2"
nrtest_compare_cmd="nrtest compare"

43
tools/test-config.sh Normal file
View File

@@ -0,0 +1,43 @@
#! /bin/bash
#
# test-config.sh - Generates nrtest test configuration file for test case.
#
# Date Created: 3/19/2018
#
# Author: Michael E. Tryby
# US EPA - ORD/NRMRL
#
# Arguments:
# 1 - name
# 2 - version
# 3 - description
#
# Suggested Usage:
# $ for file in .//*; do ./test-config.sh $file 1.0 > "${file%.*}.json"; done
#
filename="$1"
name="${filename%.*}"
version="$2"
description="$3"
cat<<EOF
{
"name": "${name}",
"version": "${version}",
"description": "${description}",
"args": [
"${name}.inp",
"${name}.rpt",
"${name}.out"
],
"input_files": [
"${name}.inp"
],
"output_files": {
"${name}.rpt": "epanet report",
"${name}.out": "epanet allclose"
}
}
EOF