Revert "Revert "Merge branch 'dev' of https://github.com/OpenWaterAnalytics/EPANET into dev""
This reverts commit 4415d8c4a1.
This commit is contained in:
46
tools/app-config.sh
Executable file
46
tools/app-config.sh
Executable 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
|
||||
60
tools/before-test.cmd
Normal file
60
tools/before-test.cmd
Normal file
@@ -0,0 +1,60 @@
|
||||
::
|
||||
:: before-test.cmd - Prepares AppVeyor CI worker to run epanet regression tests
|
||||
::
|
||||
:: Date Created: 4/3/2018
|
||||
::
|
||||
:: 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:
|
||||
:: 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.cmd and gen-config.cmd are located together in the same folder.
|
||||
::
|
||||
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set SCRIPT_HOME=%~dp0
|
||||
set TEST_HOME=%~1
|
||||
|
||||
set EXAMPLES_VER=1.0.0
|
||||
set BENCHMARK_VER=2012
|
||||
|
||||
set TESTFILES_URL=https://github.com/OpenWaterAnalytics/epanet-example-networks/archive/v%EXAMPLES_VER%.zip
|
||||
set BENCHFILES_URL=https://github.com/OpenWaterAnalytics/epanet-example-networks/releases/download/v%EXAMPLES_VER%/epanet-benchmark-%BENCHMARK_VER%.zip
|
||||
|
||||
|
||||
echo INFO: Staging files for regression testing
|
||||
|
||||
:: create a clean directory for staging regression tests
|
||||
if exist %TEST_HOME% (
|
||||
rmdir /s /q %TEST_HOME%
|
||||
)
|
||||
mkdir %TEST_HOME%
|
||||
cd %TEST_HOME%
|
||||
|
||||
:: retrieve epanet-examples for regression testing
|
||||
curl -fsSL -o examples.zip %TESTFILES_URL%
|
||||
|
||||
:: retrieve epanet benchmark results
|
||||
curl -fsSL -o benchmark.zip %BENCHFILES_URL%
|
||||
|
||||
|
||||
:: extract tests and benchmarks
|
||||
7z x examples.zip *\epanet-tests\* > nul
|
||||
7z x benchmark.zip -obenchmark\ > nul
|
||||
|
||||
:: set up symlink for tests directory
|
||||
mklink /D .\tests .\epanet-example-networks-%EXAMPLES_VER%\epanet-tests
|
||||
|
||||
|
||||
:: generate json configuration file for software under test
|
||||
mkdir apps
|
||||
%SCRIPT_HOME%\gen-config.cmd %~2 > apps\epanet-%~3.json
|
||||
58
tools/before-test.sh
Executable file
58
tools/before-test.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#! /bin/bash
|
||||
|
||||
#
|
||||
# before-test.sh - Prepares Travis CI worker to run epanet regression tests
|
||||
#
|
||||
# Date Created: 04/04/2018
|
||||
#
|
||||
# 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:
|
||||
# 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.
|
||||
|
||||
SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
TEST_HOME=$1
|
||||
|
||||
EXAMPLES_VER="1.0.0"
|
||||
BENCHMARK_VER="2012"
|
||||
|
||||
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"
|
||||
|
||||
|
||||
echo INFO: Staging files for regression testing
|
||||
|
||||
# create a clean directory for staging regression tests
|
||||
if [ -d ${TEST_HOME} ]; then
|
||||
rm -rf ${TEST_HOME}
|
||||
fi
|
||||
mkdir ${TEST_HOME}
|
||||
cd ${TEST_HOME}
|
||||
|
||||
# retrieve epanet-examples for regression testing
|
||||
curl -fsSL -o examples.tar.gz ${TEST_URL}
|
||||
|
||||
# retrieve epanet benchmark results
|
||||
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
|
||||
|
||||
mkdir benchmark
|
||||
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
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#
|
||||
# requirements.txt
|
||||
# requirements-appveyor.txt
|
||||
#
|
||||
# Date Created: 10/10/2017
|
||||
# Author: Michael E. Tryby
|
||||
# US EPA ORD/NRMRL
|
||||
#
|
||||
# Useful for configuring a python environment to run epanet-nrtestsuite.
|
||||
# Useful for configuring a python environment to run epanet-nrtestsuite
|
||||
# on AppVeyor CI.
|
||||
#
|
||||
# command:
|
||||
# $ pip install --src build/packages -r tools/requirements.txt
|
||||
# $ pip install --src build/packages -r tools/requirements-appveyor.txt
|
||||
#
|
||||
|
||||
nrtest>=0.2.3
|
||||
|
||||
@@ -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%
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# US EPA - ORD/NRMRL
|
||||
#
|
||||
# Arguments:
|
||||
# 1 - test suite path
|
||||
# 1 - relative path to location there test suite is staged
|
||||
# 2 - version/build identifier
|
||||
#
|
||||
|
||||
@@ -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
43
tools/test-config.sh
Normal 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
|
||||
Reference in New Issue
Block a user