Re: [PATCH] tests: Store the correct PID in hostapd-test.pid file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 22, 2018 at 08:31:43PM +0300, Andrei Otcheretianski wrote:
> The ./start.sh script spawns hostapd process using "sudo".
> Since sudo forks a child process, $! holds the pid of sudo itself.
> Fix that by storing the PID of the child process instead.

> diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
> @@ -121,7 +121,10 @@ sudo $(printf -- "$VALGRIND_WPAS" 5) $WPAS -g /tmp/wpas-wlan5 -G$GROUP \
>  sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -f $LOGDIR/hostapd &
>  HPID=$!
> -echo $HPID > $LOGDIR/hostapd-test.pid
> +
> +# Sleep a bit, otherwise pgrep may run before the child is forked
> +sleep 0.1
> +pgrep -P $HPID > $LOGDIR/hostapd-test.pid

This breaks inside-VM testing where sudo is a dummy script (see
tests/hwsim/inside.sh generating the sudo scripts). In addition, sudo is
documented to relay signals. Could you please clarify what you are
trying to fix here?

That $VALGRIND_HAPD part could be a yet another program in the chain, so
it might make more sense to to determine the actual hostapd PID through
a new test command on the control interface to make this more robust.
 
-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux