diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-04-11 19:00:55 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-04-11 19:00:55 +0000 |
commit | fdcc51253bd7b060446b32894881a6f41796081d (patch) | |
tree | 48238b281ed858e25bb70c13e2e9ae03e84e3006 /regress | |
parent | 8e3bc5cb08054aadadccd282c4d7b539e73eaba7 (diff) |
Fix a race in the syslogd test. It did not wait long enough for
syslogd to shutdown. So the test could miss some log messages.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/usr.sbin/syslogd/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/Syslogd.pm | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/regress/usr.sbin/syslogd/Makefile b/regress/usr.sbin/syslogd/Makefile index 7b33571f60d..7b4874a9c17 100644 --- a/regress/usr.sbin/syslogd/Makefile +++ b/regress/usr.sbin/syslogd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.22 2017/10/23 17:37:55 bluhm Exp $ +# $OpenBSD: Makefile,v 1.23 2018/04/11 19:00:54 bluhm Exp $ # The following ports must be installed for the regression tests: # p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets @@ -40,7 +40,7 @@ REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} LDFLAGS += -lutil CLEANFILES += *.log *.log.? *.conf ktrace.out stamp-* CLEANFILES += *.out *.sock *.ktrace *.fstat ttylog *.ph */*.ph -CLEANFILES += *.pem *.req *.key *.crt *.srl empty toobig +CLEANFILES += *.pem *.req *.key *.crt *.srl empty toobig diskimage .MAIN: all diff --git a/regress/usr.sbin/syslogd/Syslogd.pm b/regress/usr.sbin/syslogd/Syslogd.pm index 4bc489602c8..3cec0c04f3e 100644 --- a/regress/usr.sbin/syslogd/Syslogd.pm +++ b/regress/usr.sbin/syslogd/Syslogd.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Syslogd.pm,v 1.22 2016/12/27 19:43:07 bluhm Exp $ +# $OpenBSD: Syslogd.pm,v 1.23 2018/04/11 19:00:54 bluhm Exp $ # Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org> # Copyright (c) 2014 Florian Riehm <mail@friehm.de> @@ -35,7 +35,7 @@ sub new { $args{fstatfile} ||= "syslogd.fstat"; $args{logfile} ||= "syslogd.log"; $args{up} ||= "syslogd: started"; - $args{down} ||= "syslogd: exiting"; + $args{down} ||= "syslogd: exited"; $args{up} = $args{down} = "execute:" if $args{foreground} || $args{daemon}; $args{foreground} && $args{daemon} @@ -230,16 +230,16 @@ sub up { } sub down { - my $self = Proc::up(shift, @_); + my $self = shift; if (my $dir = $self->{tempdir}) { # keep all logs in single directory for easy debugging copy($_, ".") foreach glob("$dir/*"); } - return $self unless $self->{daemon}; + return Proc::down($self, @_) unless $self->{daemon}; - my $timeout = shift || 10; + my $timeout = $_[0] || 10; my $end = time() + $timeout; my @sudo = $ENV{SUDO} ? $ENV{SUDO} : "env"; @@ -251,7 +251,7 @@ sub down { sleep .1; system(@pgrep) && $? != 256 and die ref($self), " system '@pgrep' failed: $?"; - return $self if $? == 256; + return Proc::down($self, @_) if $? == 256; print STDERR "syslogd still running\n"; } while (time() < $end); |