@@ -103,12 +103,12 @@ function show_usage(): void
103103 Do not delete 'all' files, 'php' test file, 'skip' or 'clean'
104104 file.
105105
106- --set-timeout [n]
106+ --set-timeout <n>
107107 Set timeout for individual tests, where [n] is the number of
108108 seconds. The default value is 60 seconds, or 300 seconds when
109109 testing for memory leaks.
110110
111- --context [n]
111+ --context <n>
112112 Sets the number of lines of surrounding context to print for diffs.
113113 The default value is 3.
114114
@@ -119,7 +119,7 @@ function show_usage(): void
119119 'mem'. The result types get written independent of the log format,
120120 however 'diff' only exists when a test fails.
121121
122- --show-slow [n]
122+ --show-slow <n>
123123 Show all tests that took longer than [n] milliseconds to run.
124124
125125 --no-clean Do not execute clean section if any.
@@ -530,7 +530,11 @@ function main(): void
530530 $ just_save_results = true ;
531531 break ;
532532 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 );
534538 break ;
535539 case '--context ' :
536540 $ context_line_count = $ argv [++$ i ] ?? '' ;
@@ -545,7 +549,11 @@ function main(): void
545549 }
546550 break ;
547551 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 );
549557 break ;
550558 case '--temp-source ' :
551559 $ temp_source = $ argv [++$ i ];
0 commit comments