tests: Store the correct PID in hostapd-test.pid file
The hwsim's 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. Since in VM "sudo" is replaced with a dummy script, pass an additional argument to run-all.sh and start.sh scripts to indicate that they are running inside a VM. This is needed to fix ap_config_reload and ap_config_reload_file test cases on some platforms where sudo is apparently not relaying the signals properly. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
parent
fcc65290d4
commit
79bbafd78c
3 changed files with 23 additions and 3 deletions
|
@ -39,6 +39,7 @@ unset RUN_TEST_ARGS
|
|||
unset BUILD
|
||||
unset BUILD_ARGS
|
||||
unset CODECOV
|
||||
unset VM
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
-v | --valgrind | valgrind)
|
||||
|
@ -71,6 +72,12 @@ while [ "$1" != "" ]; do
|
|||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
-V | --vm)
|
||||
shift
|
||||
echo "$0: running inside a VM"
|
||||
VM=VM
|
||||
;;
|
||||
|
||||
*)
|
||||
RUN_TEST_ARGS="$RUN_TEST_ARGS$1 "
|
||||
shift
|
||||
|
@ -108,7 +115,7 @@ if [ ! -z "$BUILD" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if ! ./start.sh $VALGRIND $TRACE channels=$NUM_CH; then
|
||||
if ! ./start.sh $VM $VALGRIND $TRACE channels=$NUM_CH; then
|
||||
if ! [ -z "$LOGBASEDIR" ] ; then
|
||||
echo "Could not start test environment" > $LOGDIR/run
|
||||
fi
|
||||
|
|
|
@ -71,6 +71,12 @@ done
|
|||
sed "s/group=admin/group=$GROUP/;s%LOGDIR%$LOGDIR%g" "$DIR/auth_serv/as.conf" > "$LOGDIR/as.conf"
|
||||
sed "s/group=admin/group=$GROUP/;s%LOGDIR%$LOGDIR%g" "$DIR/auth_serv/as2.conf" > "$LOGDIR/as2.conf"
|
||||
|
||||
unset VM
|
||||
if [ "$1" = "VM" ]; then
|
||||
VM="y"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$1" = "valgrind" ]; then
|
||||
VALGRIND=y
|
||||
VALGRIND_WPAS="valgrind --log-file=$LOGDIR/valgrind-wlan%d"
|
||||
|
@ -121,7 +127,14 @@ sudo $(printf -- "$VALGRIND_WPAS" 5) $WPAS -g /tmp/wpas-wlan5 -G$GROUP \
|
|||
-ddKt$TRACE -f $LOGDIR/log5 &
|
||||
sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -f $LOGDIR/hostapd &
|
||||
HPID=$!
|
||||
echo $HPID > $LOGDIR/hostapd-test.pid
|
||||
|
||||
if [ -z "$VM" ]; then
|
||||
# Sleep a bit, otherwise pgrep may run before the child is forked
|
||||
sleep 0.1
|
||||
pgrep -P $HPID > $LOGDIR/hostapd-test.pid
|
||||
else
|
||||
echo $HPID > $LOGDIR/hostapd-test.pid
|
||||
fi
|
||||
|
||||
if [ -x $HLR_AUC_GW ]; then
|
||||
cp $DIR/auth_serv/hlr_auc_gw.milenage_db $LOGDIR/hlr_auc_gw.milenage_db
|
||||
|
|
|
@ -113,7 +113,7 @@ else
|
|||
dbus-daemon --config-file=$TESTDIR/vm/dbus.conf --fork
|
||||
|
||||
cd $TESTDIR
|
||||
./run-all.sh $(cat /tmp/host$ARGS) </dev/ttyS0 >/dev/ttyS0 2>&1
|
||||
./run-all.sh --vm $(cat /tmp/host$ARGS) </dev/ttyS0 >/dev/ttyS0 2>&1
|
||||
if test -d /sys/kernel/debug/gcov ; then
|
||||
cp -ar /sys/kernel/debug/gcov /tmp/logs/
|
||||
# these are broken as they're updated while being read ...
|
||||
|
|
Loading…
Reference in a new issue