@@ -41,8 +41,8 @@ while [[ "$#" -gt 0 ]]; do
41
41
exit 0
42
42
;;
43
43
--dry-run)
44
- dry_run=true
45
- ;;
44
+ dry_run=true
45
+ ;;
46
46
--bin-dir)
47
47
bin_dir=" $2 "
48
48
shift
@@ -53,26 +53,24 @@ while [[ "$#" -gt 0 ]]; do
53
53
;;
54
54
--os)
55
55
case $2 in
56
- windows|linux|macos)
57
- ;;
58
- * )
59
- printf " error: Unrecognized os: '$2 '\n\n" >&2
60
- show_help >&2
61
- exit 1
62
- ;;
56
+ windows | linux | macos) ;;
57
+ * )
58
+ printf " error: Unrecognized os: '$2 '\n\n" >&2
59
+ show_help >&2
60
+ exit 1
61
+ ;;
63
62
esac
64
63
os=" $2 "
65
64
shift
66
65
;;
67
66
--config)
68
67
case $2 in
69
- debug|release)
70
- ;;
71
- * )
72
- printf " error: Unrecognized config: '$2 '\n\n" >&2
73
- show_help >&2
74
- exit 1
75
- ;;
68
+ debug | release) ;;
69
+ * )
70
+ printf " error: Unrecognized config: '$2 '\n\n" >&2
71
+ show_help >&2
72
+ exit 1
73
+ ;;
76
74
esac
77
75
config=" $2 "
78
76
shift
@@ -86,133 +84,117 @@ while [[ "$#" -gt 0 ]]; do
86
84
shift
87
85
done
88
86
89
- if [[ " $os " == " " ]]
90
- then
91
- echo " error: No OS specified.\n\n"
92
- show_help >&2
93
- exit 1
87
+ if [[ " $os " == " " ]]; then
88
+ echo " error: No OS specified.\n\n"
89
+ show_help >&2
90
+ exit 1
94
91
fi
95
92
96
- if [[ " $config " == " " ]]
97
- then
98
- printf " error: No build configuration specified.\n\n" >&2
99
- show_help >&2
100
- exit 1
93
+ if [[ " $config " == " " ]]; then
94
+ printf " error: No build configuration specified.\n\n" >&2
95
+ show_help >&2
96
+ exit 1
101
97
fi
102
98
103
- if [[ " $bin_dir " == " " ]]
104
- then
105
- printf " error: No binary directory specified.\n\n" >&2
106
- show_help >&2
107
- exit 1
99
+ if [[ " $bin_dir " == " " ]]; then
100
+ printf " error: No binary directory specified.\n\n" >&2
101
+ show_help >&2
102
+ exit 1
108
103
fi
109
104
110
- if [[ " $skip_file " == " " ]]
111
- then
112
- printf " error: No skip file specified.\n\n" >&2
113
- show_help >&2
114
- exit 1
105
+ if [[ " $skip_file " == " " ]]; then
106
+ printf " error: No skip file specified.\n\n" >&2
107
+ show_help >&2
108
+ exit 1
115
109
fi
116
110
117
- if [[ ! -f " $skip_file " ]]
118
- then
119
- printf " error: Skip file '$skip_file ' does not exist.\n\n" >&2
111
+ if [[ ! -f " $skip_file " ]]; then
112
+ printf " error: Skip file '$skip_file ' does not exist.\n\n" >&2
120
113
fi
121
114
122
- if [[ ! -d " $bin_dir " ]]
123
- then
124
- printf " error: Binary directory '$bin_dir ' does not exist.\n\n" >&2
115
+ if [[ ! -d " $bin_dir " ]]; then
116
+ printf " error: Binary directory '$bin_dir ' does not exist.\n\n" >&2
125
117
fi
126
118
127
119
summary=" "
128
120
failure_count=0
129
121
skip_count=0
130
122
sample_count=0
131
123
132
- function skip
133
- {
134
- local p
135
- local line_index
136
- p=" $1 "
137
- line_index=1
138
- while read pattern
139
- do
140
- pat=$pattern
141
- if [[ ! $pat =~ .* # ]]
142
- then
143
- echo " error: Skip pattern on line $line_index is missing a comment!"
144
- exit 1
145
- fi
146
- pat= " ${pattern%% *#* } "
147
- if [[ $p =~ ^$pat $ ]]
148
- then
149
- return 0
150
- fi
151
- line_index= $(( line_index+ 1 ))
152
- done < $skip_file
153
-
154
- return 1
155
- }
156
-
157
- function run_sample
158
- {
159
- local command
160
- local sample
161
- command=$@
162
- shift
163
- sample=" ${command%% * } "
164
- sample_count=$(( sample_count+ 1 ))
165
- summary+=" $sample : "
166
- if skip " $os :$config :$sample "
167
- then
168
- echo " Skipping $sample ..."
169
- summary+=" \n skipped\n"
170
- skip_count=$(( skip_count+ 1 ))
171
- return
172
- fi
173
- echo " Running '$command '..."
174
- result=0
175
- pushd $bin_dir 1> /dev/null 2>&1
176
- if [[ ! " $dry_run " = true ]]
177
- then
178
- ./$command || result=$?
124
+ function skip {
125
+ local p
126
+ local line_index
127
+ p=" $1 "
128
+ line_index=1
129
+ while read pattern; do
130
+ pat=$pattern
131
+ if [[ ! $pat =~ .* # ]]; then
132
+ echo " error: Skip pattern on line $line_index is missing a comment!"
133
+ exit 1
179
134
fi
180
- if [[ $result -eq 0 ]]
181
- then
182
- summary+=" \n success\n"
183
- else
184
- summary+=" \n failure (exit code: $result )\n"
185
- failure_count=$(( failure_count+ 1 ))
135
+ pat= " ${pattern%% *#* } "
136
+ if [[ $p =~ ^$pat $ ]]; then
137
+ return 0
186
138
fi
187
- popd 1> /dev/null 2>&1
139
+ line_index= $(( line_index + 1 ))
140
+ done < $skip_file
141
+
142
+ return 1
143
+ }
144
+
145
+ function run_sample {
146
+ local command
147
+ local sample
148
+ command=$@
149
+ shift
150
+ sample=" ${command%% * } "
151
+ sample_count=$(( sample_count + 1 ))
152
+ summary+=" $sample : "
153
+ if skip " $os :$config :$sample " ; then
154
+ echo " Skipping $sample ..."
155
+ summary+=" \n skipped\n"
156
+ skip_count=$(( skip_count + 1 ))
157
+ return
158
+ fi
159
+ echo " Running '$command '..."
160
+ result=0
161
+ pushd $bin_dir 1> /dev/null 2>&1
162
+ if [[ ! " $dry_run " = true ]]; then
163
+ ./$command || result=$?
164
+ fi
165
+ if [[ $result -eq 0 ]]; then
166
+ summary+=" \n success\n"
167
+ else
168
+ summary+=" \n failure (exit code: $result )\n"
169
+ failure_count=$(( failure_count + 1 ))
170
+ fi
171
+ popd 1> /dev/null 2>&1
188
172
}
189
173
190
174
sample_commands= (
191
- ' platform-test --test-mode'
192
- ' ray-tracing-pipeline --test-mode'
193
- ' ray-tracing --test-mode'
194
- ' shader-toy --test-mode'
195
- ' triangle --test-mode'
196
- ' model-viewer --test-mode'
197
- ' shader-object'
198
- ' reflection-api'
199
- ' hello-world'
200
- ' gpu-printing'
201
- ' cpu-hello-world'
202
- ' cpu-com-example'
175
+ ' platform-test --test-mode'
176
+ ' ray-tracing-pipeline --test-mode'
177
+ ' ray-tracing --test-mode'
178
+ ' shader-toy --test-mode'
179
+ ' triangle --test-mode'
180
+ ' model-viewer --test-mode'
181
+ ' shader-object'
182
+ ' reflection-api'
183
+ ' hello-world'
184
+ ' gpu-printing'
185
+ ' cpu-hello-world'
186
+ ' cpu-com-example'
203
187
)
204
188
205
- for sample_command in " ${sample_commands[@]} "
206
- do
207
- run_sample $sample_command
208
- echo " "
189
+ for sample_command in " ${sample_commands[@]} " ; do
190
+ run_sample $sample_command
191
+ echo " "
209
192
done
210
193
211
194
echo " "
212
195
echo " Summary: "
213
196
printf " \n$summary \n\n"
214
197
echo " $failure_count failed, and $skip_count skipped, out of $sample_count tests"
215
- if [[ $failure_count -ne 0 ]]
216
- then
217
- exit 1
198
+ if [[ $failure_count -ne 0 ]]; then
199
+ exit 1
218
200
fi
0 commit comments