-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_all_unit_tests.cmd
More file actions
141 lines (90 loc) · 2.47 KB
/
Copy pathrun_all_unit_tests.cmd
File metadata and controls
141 lines (90 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET SCRIPT_DIRECTORY=%~dp0
SET SCRIPT_PATH_DOC=%~n0[%~x0]
IF DEFINED SIS_CMAKE_BUILD_DIR (
SET "CMAKE_DIR=%SIS_CMAKE_BUILD_DIR%"
) ELSE (
SET "CMAKE_DIR=%SCRIPT_DIRECTORY%_build"
)
SET ListOnly=0
SET Verbose=0
SET status=0
FOR %%a IN (%*) DO (
IF /I {--help}=={%%a} (
IF EXIST "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" (
type "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt"
)
ECHO ^
Runs all ^(matching^) component and unit test programs ^
^
%SCRIPT_PATH_DOC% [ ... flags/options ... ] ^
^
Flags/options: ^
behaviour: ^
^
-l ^
--list-only ^
lists the target programs but does not execute them ^
^
-M ^
--no-make ^
accepted for parity with the .sh script ^(build is not invoked^) ^
^
-v ^
--verbose ^
lists each test program before executing it ^
^
standard flags: ^
^
--help ^
displays this help and terminates ^
EXIT /B 0
) ELSE IF /I {-l}=={%%a} (
SET ListOnly=1
) ELSE IF /I {--list-only}=={%%a} (
SET ListOnly=1
) ELSE IF /I {-M}=={%%a} (
REM no-op: this .cmd never invokes the build
) ELSE IF /I {--no-make}=={%%a} (
REM no-op: this .cmd never invokes the build
) ELSE IF /I {-v}=={%%a} (
SET Verbose=1
) ELSE IF /I {--verbose}=={%%a} (
SET Verbose=1
) ELSE (
ECHO %SCRIPT_PATH_DOC%: unrecognised argument '%%a'; use --help for usage 1>&2
EXIT /B 1
)
)
IF NOT EXIST "%CMAKE_DIR%" (
ECHO %SCRIPT_PATH_DOC%: CMake build directory '%CMAKE_DIR%' does not exist 1>&2
EXIT /B 1
)
SET "ProjectName="
FOR /F "usebackq delims=" %%p IN ("%SCRIPT_DIRECTORY%.sis\project_name.txt") DO SET "ProjectName=%%p"
IF NOT DEFINED ProjectName (
ECHO %SCRIPT_PATH_DOC%: could not read project name from .sis\project_name.txt 1>&2
EXIT /B 1
)
IF !ListOnly! EQU 1 (
ECHO Listing all component and unit test programs
) ELSE (
ECHO Running all component and unit test programs
)
FOR /F "usebackq delims=" %%f IN (`DIR /A:-D /B /S "%CMAKE_DIR%\*.exe" 2^>NUL ^| FINDSTR /I /R "!ProjectName!.*test.*\.exe$"`) DO (
IF !ListOnly! EQU 1 (
ECHO would execute %%f:
) ELSE (
IF !Verbose! EQU 1 (
ECHO executing %%f:
)
"%%f"
IF ERRORLEVEL 1 (
SET status=1
GOTO :done
)
)
)
:done
EXIT /B !status!