@@ -97,12 +97,12 @@ function show_usage(): void
97
97
Do not delete 'all' files, 'php' test file, 'skip' or 'clean'
98
98
file.
99
99
100
- --set-timeout [n]
100
+ --set-timeout <n>
101
101
Set timeout for individual tests, where [n] is the number of
102
102
seconds. The default value is 60 seconds, or 300 seconds when
103
103
testing for memory leaks.
104
104
105
- --context [n]
105
+ --context <n>
106
106
Sets the number of lines of surrounding context to print for diffs.
107
107
The default value is 3.
108
108
@@ -113,7 +113,7 @@ function show_usage(): void
113
113
'mem'. The result types get written independent of the log format,
114
114
however 'diff' only exists when a test fails.
115
115
116
- --show-slow [n]
116
+ --show-slow <n>
117
117
Show all tests that took longer than [n] milliseconds to run.
118
118
119
119
--no-clean Do not execute clean section if any.
@@ -571,7 +571,11 @@ function main(): void
571
571
$ just_save_results = true ;
572
572
break ;
573
573
case '--set-timeout ' :
574
- $ environment ['TEST_TIMEOUT ' ] = $ argv [++$ i ];
574
+ $ timeout = $ argv [++$ i ] ?? '' ;
575
+ if (!preg_match ('/^\d+$/ ' , $ timeout )) {
576
+ error ("' $ timeout' is not a valid number of seconds, try e.g. --set-timeout 60 for 1 minute " );
577
+ }
578
+ $ environment ['TEST_TIMEOUT ' ] = intval ($ timeout , 10 );
575
579
break ;
576
580
case '--context ' :
577
581
$ context_line_count = $ argv [++$ i ] ?? '' ;
@@ -586,7 +590,11 @@ function main(): void
586
590
}
587
591
break ;
588
592
case '--show-slow ' :
589
- $ slow_min_ms = $ argv [++$ i ];
593
+ $ slow_min_ms = $ argv [++$ i ] ?? '' ;
594
+ if (!preg_match ('/^\d+$/ ' , $ slow_min_ms )) {
595
+ error ("' $ slow_min_ms' is not a valid number of milliseconds, try e.g. --show-slow 1000 for 1 second " );
596
+ }
597
+ $ slow_min_ms = intval ($ slow_min_ms , 10 );
590
598
break ;
591
599
case '--temp-source ' :
592
600
$ temp_source = $ argv [++$ i ];
0 commit comments