From 997ebcfa5cd98afc16b6ce4893cf09b98f65e8b5 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 29 Sep 2013 16:41:17 +0300 Subject: [PATCH] tests: Auto detect group name Some older systems used admin group, but adm group seems to be more common nowadays, so detect this automatically rather than assume admin group is used. Signed-hostap: Jouni Malinen --- tests/hwsim/start.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh index 42f56da70..c1b48e4b9 100755 --- a/tests/hwsim/start.sh +++ b/tests/hwsim/start.sh @@ -6,6 +6,12 @@ WPACLI=$DIR/../../wpa_supplicant/wpa_cli HAPD=$DIR/../../hostapd/hostapd WLANTEST=$DIR/../../wlantest/wlantest +if groups | tr ' ' "\n" | grep -q ^admin$; then + GROUP=admin +else + GROUP=adm +fi + if [ "$1" = "concurrent" ]; then CONCURRENT=y shift @@ -43,22 +49,22 @@ if [ "$VALGRIND" = "y" ]; then for i in 0 1 2; do chmod a+rx $WPAS if [ "$CONCURRENT" = "y" ]; then - sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & + sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & else - sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & + sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & fi done chmod a+rx $HAPD - sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd & + sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G $GROUP -ddKt > $DIR/logs/$DATE-hostapd & else for i in 0 1 2; do if [ "$CONCURRENT" = "y" ]; then - sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & + sudo $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & else - sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & + sudo $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & fi done - sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd & + sudo $HAPD -ddKt -g /var/run/hostapd-global -G $GROUP -ddKt > $DIR/logs/$DATE-hostapd & fi sleep 1 sudo chown $USER $DIR/logs/$DATE-hwsim0.dump