salsa.debian.org/debian / smcroute

autopkgtests: daemon-init-scripts: Try to make tricky operations succeed

Micha Lenk · 5 years ago commit 9fbc3f2 · parent c59470c · child c698bcd · patch
diff --git a/debian/tests/daemon-init-scripts b/debian/tests/daemon-init-scripts
index b241005..caf5d5c 100755
--- a/debian/tests/daemon-init-scripts
+++ b/debian/tests/daemon-init-scripts
@@ -30,13 +30,17 @@ $smcroute_pid = capture EXIT_ANY, 'pgrep', 'smcroute'; chomp $smcroute_pid;
 is $EXITVAL, 1, "smcroute is really stopped".( $EXITVAL ? '' : " (pid $smcroute_pid)" );
 
 # Try to start the daemon again
+sleep(1);
 my $start_output = capture EXIT_ANY, INIT_SCRIPT, 'start';
 is $EXITVAL, 0, "starting smcroute";
+sleep(1);
 my $new_smcroute_pid = capture EXIT_ANY, 'pgrep', 'smcroute'; chomp $new_smcroute_pid;
 is $EXITVAL, 0, "smcroute is really running".( $EXITVAL ? '' : " (pid $new_smcroute_pid)" );
 isnt $new_smcroute_pid, $initial_smcroute_pid, "smcroute pid changed ($new_smcroute_pid != $initial_smcroute_pid)";
 
+sleep(1);
 my $double_start_output = capture EXIT_ANY, INIT_SCRIPT, 'start';
 is $EXITVAL, 0, "starting smcroute twice in a row";
+sleep(1);
 $smcroute_pid = capture EXIT_ANY, 'pgrep', 'smcroute'; chomp $smcroute_pid;
 is $EXITVAL, 0, "smcroute is really running".( $EXITVAL ? '' : " (pid $smcroute_pid)" );