Skip to content

Commit f0d1c44

Browse files
committed
Use consistent interval in t/01_run.t
This won't change most occurrences and reduce the interval from 0.1 to 0.01 in some to speed up the test execution. Related ticket: https://progress.opensuse.org/issues/178183
1 parent 8624a44 commit f0d1c44

1 file changed

Lines changed: 42 additions & 42 deletions

File tree

t/01_run.t

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ subtest 'process basic functions' => sub {
4444
"Process with no code nor execute command, will fail";
4545

4646
$p = Mojo::IOLoop::ReadWriteProcess->new(
47-
kill_sleeptime => 0.01,
48-
sleeptime_during_kill => 0.01
47+
kill_sleeptime => $interval,
48+
sleeptime_during_kill => $interval
4949
);
5050
eval { $p->_fork(); };
5151
ok $@, "Error expected";
@@ -56,8 +56,8 @@ subtest 'process basic functions' => sub {
5656
pipe(PARENT, CHILD);
5757

5858
my $p = Mojo::IOLoop::ReadWriteProcess->new(
59-
kill_sleeptime => 0.01,
60-
sleeptime_during_kill => 0.01,
59+
kill_sleeptime => $interval,
60+
sleeptime_during_kill => $interval,
6161
code => sub {
6262
close(PARENT);
6363
open STDERR, ">&", \*CHILD or die $!;
@@ -133,7 +133,7 @@ subtest 'process execute()' => sub {
133133
my $test_script = check_bin("$FindBin::Bin/data/process_check.sh");
134134
my $test_script_sigtrap = check_bin("$FindBin::Bin/data/term_trap.sh");
135135
my $p = Mojo::IOLoop::ReadWriteProcess->new(
136-
sleeptime_during_kill => 0.1,
136+
sleeptime_during_kill => $interval,
137137
execute => $test_script
138138
)->start();
139139
is $p->getline, "TEST normal print\n", 'Get right output from stdout';
@@ -146,8 +146,8 @@ subtest 'process execute()' => sub {
146146
is $p->is_running, 0, 'process is not running anymore';
147147

148148
$p = Mojo::IOLoop::ReadWriteProcess->new(
149-
kill_sleeptime => 0.01,
150-
sleeptime_during_kill => 0.01,
149+
kill_sleeptime => $interval,
150+
sleeptime_during_kill => $interval,
151151
execute => $test_script,
152152
args => [
153153
qw(FOO
@@ -165,7 +165,7 @@ subtest 'process execute()' => sub {
165165
is $p->exit_status, 100, 'able to retrieve function return';
166166

167167
$p = Mojo::IOLoop::ReadWriteProcess->new(
168-
sleeptime_during_kill => 0.1,
168+
sleeptime_during_kill => $interval,
169169
execute => $test_script
170170
)->args([qw(FOO BAZ)])->start();
171171
is $p->stdout, "TEST normal print\n", 'Get right output from stdout';
@@ -181,8 +181,8 @@ subtest 'process execute()' => sub {
181181

182182
my $patience = $timeout / $interval;
183183
$p = Mojo::IOLoop::ReadWriteProcess->new(
184-
kill_sleeptime => 0.01,
185-
sleeptime_during_kill => 0.01,
184+
kill_sleeptime => $interval,
185+
sleeptime_during_kill => $interval,
186186
separate_err => 0,
187187
execute => $test_script
188188
);
@@ -196,8 +196,8 @@ subtest 'process execute()' => sub {
196196
'Still able to get stdout output, always in getline()';
197197

198198
my $p2 = Mojo::IOLoop::ReadWriteProcess->new(
199-
kill_sleeptime => 0.01,
200-
sleeptime_during_kill => 0.01,
199+
kill_sleeptime => $interval,
200+
sleeptime_during_kill => $interval,
201201
separate_err => 0,
202202
execute => $test_script,
203203
set_pipes => 0
@@ -209,8 +209,8 @@ subtest 'process execute()' => sub {
209209
'take exit status even with set_pipes = 0 (we killed it)';
210210

211211
$p = Mojo::IOLoop::ReadWriteProcess->new(
212-
kill_sleeptime => 0.01,
213-
sleeptime_during_kill => 0.01,
212+
kill_sleeptime => $interval,
213+
sleeptime_during_kill => $interval,
214214
verbose => 1,
215215
separate_err => 0,
216216
execute => $test_script_sigtrap,
@@ -237,8 +237,8 @@ subtest 'process execute()' => sub {
237237

238238

239239
$p = Mojo::IOLoop::ReadWriteProcess->new(
240-
kill_sleeptime => 0.01,
241-
sleeptime_during_kill => 0.01,
240+
kill_sleeptime => $interval,
241+
sleeptime_during_kill => $interval,
242242
verbose => 1,
243243
separate_err => 0,
244244
blocking_stop => 1,
@@ -251,8 +251,8 @@ subtest 'process execute()' => sub {
251251

252252
my $pidfile = tempfile;
253253
$p = Mojo::IOLoop::ReadWriteProcess->new(
254-
kill_sleeptime => 0.01,
255-
sleeptime_during_kill => 0.01,
254+
kill_sleeptime => $interval,
255+
sleeptime_during_kill => $interval,
256256
verbose => 1,
257257
separate_err => 0,
258258
blocking_stop => 1,
@@ -268,8 +268,8 @@ subtest 'process execute()' => sub {
268268

269269
$pidfile = tempfile;
270270
$p = Mojo::IOLoop::ReadWriteProcess->new(
271-
kill_sleeptime => 0.01,
272-
sleeptime_during_kill => 0.01,
271+
kill_sleeptime => $interval,
272+
sleeptime_during_kill => $interval,
273273
verbose => 1,
274274
separate_err => 0,
275275
blocking_stop => 1,
@@ -284,8 +284,8 @@ subtest 'process execute()' => sub {
284284
is -e $pidfile, undef, 'Pidfile got removed after stop()';
285285

286286
$p = Mojo::IOLoop::ReadWriteProcess->new(
287-
kill_sleeptime => 0.01,
288-
sleeptime_during_kill => 0.01,
287+
kill_sleeptime => $interval,
288+
sleeptime_during_kill => $interval,
289289
verbose => 1,
290290
separate_err => 0,
291291
blocking_stop => 1,
@@ -312,8 +312,8 @@ subtest 'process(execute => /bin/true)' => sub {
312312

313313
subtest 'process code()' => sub {
314314
my $p = Mojo::IOLoop::ReadWriteProcess->new(
315-
kill_sleeptime => 0.01,
316-
sleeptime_during_kill => 0.01,
315+
kill_sleeptime => $interval,
316+
sleeptime_during_kill => $interval,
317317
code => sub {
318318
my ($self) = shift;
319319
my $parent_output = $self->channel_out;
@@ -367,8 +367,8 @@ subtest 'process code()' => sub {
367367
is $p->is_running, 0, 'process is not running';
368368

369369
$p = Mojo::IOLoop::ReadWriteProcess->new(
370-
kill_sleeptime => 0.01,
371-
sleeptime_during_kill => 0.01,
370+
kill_sleeptime => $interval,
371+
sleeptime_during_kill => $interval,
372372
separate_err => 0,
373373
code => sub {
374374
my ($self) = shift;
@@ -385,8 +385,8 @@ subtest 'process code()' => sub {
385385
is $p->is_running, 0, 'process is not running';
386386
is $p->return_status, 256, 'right return code';
387387

388-
$p = Mojo::IOLoop::ReadWriteProcess->new(sub { die "Fatal error"; },
389-
sleeptime_during_kill => 0.1);
388+
$p = Mojo::IOLoop::ReadWriteProcess->new(sub { die "Fatal error" },
389+
sleeptime_during_kill => $interval);
390390
my $event_fired = 0;
391391
$p->on(
392392
process_error => sub {
@@ -404,8 +404,8 @@ subtest 'process code()' => sub {
404404

405405
$p = Mojo::IOLoop::ReadWriteProcess->new(
406406
sub { return 42 },
407-
kill_sleeptime => 0.01,
408-
sleeptime_during_kill => 0.01,
407+
kill_sleeptime => $interval,
408+
sleeptime_during_kill => $interval,
409409
internal_pipes => 0
410410
);
411411
$p->start();
@@ -416,8 +416,8 @@ subtest 'process code()' => sub {
416416

417417
$p = Mojo::IOLoop::ReadWriteProcess->new(
418418
sub { die "Bah" },
419-
kill_sleeptime => 0.01,
420-
sleeptime_during_kill => 0.01,
419+
kill_sleeptime => $interval,
420+
sleeptime_during_kill => $interval,
421421
internal_pipes => 0
422422
);
423423
$p->start();
@@ -428,8 +428,8 @@ subtest 'process code()' => sub {
428428
# XXX: flaky test temporarly skip it. is !!$p->exit_status, 1, 'Exit status is there';
429429

430430
$p = Mojo::IOLoop::ReadWriteProcess->new(
431-
kill_sleeptime => 0.01,
432-
sleeptime_during_kill => 0.01,
431+
kill_sleeptime => $interval,
432+
sleeptime_during_kill => $interval,
433433
separate_err => 0,
434434
set_pipes => 0,
435435
code => sub {
@@ -443,8 +443,8 @@ subtest 'process code()' => sub {
443443
is $p->return_status, 256, "grab exit_status even if no pipes are set";
444444

445445
$p = Mojo::IOLoop::ReadWriteProcess->new(
446-
kill_sleeptime => 0.01,
447-
sleeptime_during_kill => 0.01,
446+
kill_sleeptime => $interval,
447+
sleeptime_during_kill => $interval,
448448
separate_err => 0,
449449
set_pipes => 1,
450450
code => sub {
@@ -454,8 +454,8 @@ subtest 'process code()' => sub {
454454
is $p->exit_status, 100, "grab exit_status even if no pipes are set";
455455

456456
$p = Mojo::IOLoop::ReadWriteProcess->new(
457-
kill_sleeptime => 0.01,
458-
sleeptime_during_kill => 0.01,
457+
kill_sleeptime => $interval,
458+
sleeptime_during_kill => $interval,
459459
separate_err => 0,
460460
code => sub {
461461
print STDERR "TEST error print\n" for (1 .. 6);
@@ -534,8 +534,8 @@ subtest process_debug => sub {
534534
eval "no warnings; require Mojo::IOLoop::ReadWriteProcess"; ## no critic
535535
Mojo::IOLoop::ReadWriteProcess->new(
536536
code => sub { 1; },
537-
kill_sleeptime => 0.01,
538-
sleeptime_during_kill => 0.01
537+
kill_sleeptime => $interval,
538+
sleeptime_during_kill => $interval
539539
)->start()->stop();
540540
}
541541

@@ -551,8 +551,8 @@ process';
551551
eval "no warnings; require Mojo::IOLoop::ReadWriteProcess"; ## no critic
552552
Mojo::IOLoop::ReadWriteProcess->new(
553553
execute => "$FindBin::Bin/data/process_check.sh",
554-
kill_sleeptime => 0.01,
555-
sleeptime_during_kill => 0.01,
554+
kill_sleeptime => $interval,
555+
sleeptime_during_kill => $interval,
556556
)->start()->stop();
557557
}
558558

0 commit comments

Comments
 (0)