From 441954ed84cef7a219e47c09a09c58b516bc2103 Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 5 Oct 2021 17:40:08 +0000 Subject: [PATCH] add missing sudo and handle arguments --- regress/usr.sbin/httpd/tests/Httpd.pm | 4 ++-- regress/usr.sbin/httpd/tests/Makefile | 5 +++-- regress/usr.sbin/httpd/tests/Proc.pm | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/regress/usr.sbin/httpd/tests/Httpd.pm b/regress/usr.sbin/httpd/tests/Httpd.pm index af62dd26f1c..53fed72040c 100644 --- a/regress/usr.sbin/httpd/tests/Httpd.pm +++ b/regress/usr.sbin/httpd/tests/Httpd.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Httpd.pm,v 1.3 2018/05/19 13:57:43 jsing Exp $ +# $OpenBSD: Httpd.pm,v 1.4 2021/10/05 17:40:08 anton Exp $ # Copyright (c) 2010-2015 Alexander Bluhm # Copyright (c) 2015 Reyk Floeter @@ -84,7 +84,7 @@ sub new { sub child { my $self = shift; - my @sudo = $ENV{SUDO} ? $ENV{SUDO} : (); + my @sudo = $ENV{SUDO} ? split(' ', $ENV{SUDO}) : (); my @ktrace = $ENV{KTRACE} ? ($ENV{KTRACE}, "-i") : (); my $httpd = $ENV{HTTPD} ? $ENV{HTTPD} : "httpd"; my @cmd = (@sudo, @ktrace, $httpd, "-dvv", "-f", $self->{conffile}); diff --git a/regress/usr.sbin/httpd/tests/Makefile b/regress/usr.sbin/httpd/tests/Makefile index ace5c50b6f0..e3b977a4441 100644 --- a/regress/usr.sbin/httpd/tests/Makefile +++ b/regress/usr.sbin/httpd/tests/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2020/12/17 00:51:13 bluhm Exp $ +# $OpenBSD: Makefile,v 1.14 2021/10/05 17:40:08 anton 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 @@ -47,8 +47,9 @@ PERLPATH = ${.CURDIR}/ .for a in ${ARGS} REGRESS_TARGETS += run-$a +REGRESS_ROOT_TARGETS += run-$a run-$a: $a ${HTDOCS_MD5} - time SUDO=${SUDO} KTRACE=${KTRACE} HTTPD=${HTTPD} perl ${PERLINC} ${PERLPATH}httpd.pl ${.OBJDIR} ${PERLPATH}$a + time SUDO="${SUDO}" KTRACE=${KTRACE} HTTPD=${HTTPD} perl ${PERLINC} ${PERLPATH}httpd.pl ${.OBJDIR} ${PERLPATH}$a .endfor # populate htdocs diff --git a/regress/usr.sbin/httpd/tests/Proc.pm b/regress/usr.sbin/httpd/tests/Proc.pm index a98cc176d79..e680e692713 100644 --- a/regress/usr.sbin/httpd/tests/Proc.pm +++ b/regress/usr.sbin/httpd/tests/Proc.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Proc.pm,v 1.2 2016/05/03 19:13:04 bluhm Exp $ +# $OpenBSD: Proc.pm,v 1.3 2021/10/05 17:40:08 anton Exp $ # Copyright (c) 2010-2014 Alexander Bluhm # @@ -36,9 +36,9 @@ sub kill_children { push @perms, $pid; } } - if (my $sudo = $ENV{SUDO} and @perms) { + if (my @sudo = split(' ', $ENV{SUDO}) and @perms) { local $?; # do not modify during END block - my @cmd = ($sudo, '/bin/kill', '-TERM', @perms); + my @cmd = (@sudo, '/bin/kill', '-TERM', @perms); system(@cmd); } delete @CHILDREN{@pids}; -- 2.20.1