@@ -103,12 +103,12 @@ function show_usage(): void
103
103
Do not delete 'all' files, 'php' test file, 'skip' or 'clean'
104
104
file.
105
105
106
- --set-timeout [n]
106
+ --set-timeout <n>
107
107
Set timeout for individual tests, where [n] is the number of
108
108
seconds. The default value is 60 seconds, or 300 seconds when
109
109
testing for memory leaks.
110
110
111
- --context [n]
111
+ --context <n>
112
112
Sets the number of lines of surrounding context to print for diffs.
113
113
The default value is 3.
114
114
@@ -119,7 +119,7 @@ function show_usage(): void
119
119
'mem'. The result types get written independent of the log format,
120
120
however 'diff' only exists when a test fails.
121
121
122
- --show-slow [n]
122
+ --show-slow <n>
123
123
Show all tests that took longer than [n] milliseconds to run.
124
124
125
125
--no-clean Do not execute clean section if any.
@@ -530,7 +530,11 @@ function main(): void
530
530
$ just_save_results = true ;
531
531
break ;
532
532
case '--set-timeout ' :
533
- $ environment ['TEST_TIMEOUT ' ] = $ argv [++$ i ];
533
+ $ timeout = $ argv [++$ i ] ?? '' ;
534
+ if (!preg_match ('/^\d+$/ ' , $ timeout )) {
535
+ error ("' $ timeout' is not a valid number of seconds, try e.g. --set-timeout 60 for 1 minute " );
536
+ }
537
+ $ environment ['TEST_TIMEOUT ' ] = intval ($ timeout , 10 );
534
538
break ;
535
539
case '--context ' :
536
540
$ context_line_count = $ argv [++$ i ] ?? '' ;
@@ -545,7 +549,11 @@ function main(): void
545
549
}
546
550
break ;
547
551
case '--show-slow ' :
548
- $ slow_min_ms = $ argv [++$ i ];
552
+ $ slow_min_ms = $ argv [++$ i ] ?? '' ;
553
+ if (!preg_match ('/^\d+$/ ' , $ slow_min_ms )) {
554
+ error ("' $ slow_min_ms' is not a valid number of milliseconds, try e.g. --show-slow 1000 for 1 second " );
555
+ }
556
+ $ slow_min_ms = intval ($ slow_min_ms , 10 );
549
557
break ;
550
558
case '--temp-source ' :
551
559
$ temp_source = $ argv [++$ i ];
0 commit comments