2
2
:: before-test.cmd - Stages test and benchmark files for epanet nrtest
3
3
::
4
4
:: Date Created: 4/3/2018
5
- :: Date Updated: 9/18 /2019
5
+ :: Date Updated: 10/9 /2019
6
6
::
7
7
:: Author: Michael E. Tryby
8
8
:: US EPA - ORD/NRMRL
14
14
:: Environment Variables:
15
15
:: BUILD_HOME - defaults to "build"
16
16
:: TEST_HOME - defaults to "nrtests"
17
+ :: PLATFORM
17
18
::
18
19
:: Arguments:
19
20
:: 1 - (RELEASE_TAG) release tag for benchmark version (defaults to latest tag)
26
27
27
28
:: @echo off
28
29
30
+ :: determine project directory
31
+ set " CUR_DIR = %CD% "
32
+ set " SCRIPT_HOME = %~dp0 "
33
+ cd %SCRIPT_HOME%
34
+ cd ..
35
+
36
+ setlocal
37
+
29
38
30
39
:: check that dependencies are installed
31
40
where curl > nul
@@ -34,12 +43,6 @@ where 7z > nul
34
43
if %ERRORLEVEL% neq 0 ( echo " ERROR: 7zip not installed" & exit /B 1 )
35
44
36
45
37
- :: determine project directory
38
- set " CUR_DIR = %CD% "
39
- set " SCRIPT_HOME = %~dp0 "
40
- cd %SCRIPT_HOME%
41
- cd ..
42
-
43
46
:: set URL to github repo with test files
44
47
set " EPANET_NRTESTS_URL = https://github.com/michaeltryby/epanet-nrtests"
45
48
@@ -51,16 +54,7 @@ if [%1] == [] (set "RELEASE_TAG="
51
54
:: check BUILD_HOME and TEST_HOME and apply defaults
52
55
if not defined BUILD_HOME ( set " BUILD_HOME = build" )
53
56
if not defined TEST_HOME ( set " TEST_HOME = nrtests" )
54
-
55
-
56
- :: determine platform from CmakeCache.txt file
57
- for /F " tokens=*" %%f in ( 'findstr CMAKE_SHARED_LINKER_FLAGS:STRING %BUILD_HOME% \CmakeCache.txt' ) do (
58
- for /F " delims=: tokens=3" %%m in ( 'echo %%f ' ) do (
59
- if " %%m " == " X86" ( set " PLATFORM = win32" ) else if " %%m " == " x64" ( set " PLATFORM = win64" )
60
- )
61
- )
62
- if not defined PLATFORM ( echo " ERROR: PLATFORM could not be determined" & exit /B 1 )
63
-
57
+ if not defined PLATFORM ( echo " ERROR: PLATFORM must be defined" & exit /B 1 )
64
58
65
59
66
60
echo INFO: Staging files for regression testing
@@ -99,15 +93,19 @@ curl -fsSL -o benchmark.zip %BENCHFILES_URL%
99
93
7z e benchmark.zip -o. manifest.json -r > nul
100
94
101
95
96
+ :: set up symlinks for tests directory
97
+ mklink /D .\tests .\epanet-nrtests-%RELEASE_TAG:~1 % \public > nul
98
+
99
+
100
+ endlocal
101
+
102
+
102
103
:: determine REF_BUILD_ID from manifest file
103
- for /F delims^ =^ " ^ tokens^=4 %%d in ( 'findstr %PLATFORM% manifest.json' ) do (
104
+ for /F delims^ =^ " ^ tokens^=4 %%d in ( 'findstr %PLATFORM% %TEST_HOME% \ manifest.json' ) do (
104
105
for /F " tokens=2" %%r in ( 'echo %%d ' ) do ( set " REF_BUILD_ID = %%r " )
105
106
)
106
107
if not defined REF_BUILD_ID ( echo " ERROR: REF_BUILD_ID could not be determined" & exit /B 1 )
107
108
108
109
109
- :: set up symlinks for tests directory
110
- mklink /D .\tests .\epanet-nrtests-%RELEASE_TAG:~1 % \public > nul
111
-
112
110
:: return to users current directory
113
111
cd %CUR_DIR%
0 commit comments