Browse Source

tests: Fix current log dir symbolic link

Fix updating of the current symbolic link when LOGDIR is already set.
The current symbolic link was only set, if LOGDIR has not been
previously defined. If the user had chosen to cancel the running test
iteration and run it again by running start.sh again, the current
symbolic link was not updated.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
Eduardo Abinader 11 years ago
parent
commit
3bdc651a62
1 changed files with 6 additions and 3 deletions
  1. 6 3
      tests/hwsim/start.sh

+ 6 - 3
tests/hwsim/start.sh

@@ -7,13 +7,11 @@ HAPD=$DIR/../../hostapd/hostapd
 HAPD_AS=$DIR/../../hostapd/hostapd
 HAPD_AS=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 WLANTEST=$DIR/../../wlantest/wlantest
 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
+DATE="$(date +%s)"
 
 
 if [ -z "$LOGDIR" ] ; then
 if [ -z "$LOGDIR" ] ; then
-    DATE="$(date +%s)"
     LOGDIR="$DIR/logs/$DATE"
     LOGDIR="$DIR/logs/$DATE"
     mkdir -p $LOGDIR
     mkdir -p $LOGDIR
-    rm -rf $DIR/logs/current
-    ln -sf $DATE $DIR/logs/current
 else
 else
     if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ]; then
     if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ]; then
 	WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
 	WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
@@ -29,6 +27,11 @@ else
     fi
     fi
 fi
 fi
 
 
+if test -w "$DIR/logs" ; then
+    rm -rf $DIR/logs/current
+    ln -sf $DATE $DIR/logs/current
+fi
+
 if groups | tr ' ' "\n" | grep -q ^admin$; then
 if groups | tr ' ' "\n" | grep -q ^admin$; then
     GROUP=admin
     GROUP=admin
 else
 else