@@ -187,6 +187,34 @@ maestro_test_paths() {
187187 echo " $paths "
188188}
189189
190+ normalize_maestro_output () {
191+ sed ' s/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' " $1 "
192+ }
193+
194+ is_tag_filter_miss () {
195+ normalize_maestro_output " $1 " | grep -Eqi \
196+ ' did not match any [Ff]lows|no flows matched|Error: no test flows found'
197+ }
198+
199+ is_maestro_run_success () {
200+ local output
201+ output=$( normalize_maestro_output " $1 " )
202+
203+ is_tag_filter_miss " $1 " && return 0
204+
205+ if echo " $output " | grep -Eqi ' Failed: [1-9][0-9]*' ; then
206+ return 1
207+ fi
208+ if echo " $output " | grep -Eqi ' ✗ FAIL' ; then
209+ return 1
210+ fi
211+ if echo " $output " | grep -Eqi ' Tests completed|Failed: 0|✓ PASS' ; then
212+ return 0
213+ fi
214+
215+ return 1
216+ }
217+
190218run_maestro_with_targets () {
191219 local test_targets=" $1 "
192220 shift
@@ -215,13 +243,10 @@ run_maestro_with_targets() {
215243 fi
216244 rc=${PIPESTATUS[0]}
217245
218- if [ " $rc " -eq 0 ]; then
219- rm -f " $tmp "
220- return 0
221- fi
222-
223- if sed ' s/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' " $tmp " | grep -Eqi " did not match any [Ff]lows|no flows matched" ; then
224- echo " warn: no flows matched the tag filter — treating as success" >&2
246+ if is_maestro_run_success " $tmp " || { [ " $rc " -eq 0 ] && ! is_driver_startup_crash " $tmp " ; }; then
247+ if is_tag_filter_miss " $tmp " ; then
248+ echo " warn: no flows matched the tag filter — treating as success" >&2
249+ fi
225250 rm -f " $tmp "
226251 return 0
227252 fi
@@ -259,17 +284,26 @@ run_maestro_with_targets() {
259284}
260285
261286run_maestro () {
287+ local tag_args=(" $@ " )
288+
289+ # Tag-filtered suites skip most flows; run them in one batch so we don't
290+ # invoke maestro once per file only to get "no test flows found".
291+ if is_ci && [[ " ${tag_args[*]} " == * " --include-tags " * ]]; then
292+ run_maestro_with_targets " $FLOWS " " ${tag_args[@]} "
293+ return $?
294+ fi
295+
262296 if is_ci; then
263297 local flow failed=0
264298 while IFS= read -r flow; do
265299 [ -z " $flow " ] && continue
266300 echo " === Running flow: $flow ==="
267- run_maestro_with_targets " $( maestro_test_paths " $flow " ) " " $@ " || failed=1
301+ run_maestro_with_targets " $( maestro_test_paths " $flow " ) " " ${tag_args[@]} " || failed=1
268302 done < <( collect_flow_files)
269303 return " $failed "
270304 fi
271305
272- run_maestro_with_targets " $FLOWS " " $@ "
306+ run_maestro_with_targets " $FLOWS " " ${tag_args[@]} "
273307}
274308
275309set +e
0 commit comments