From dd04326693fdab3dab6d0e8e2ac96ccfef45270d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 13 Aug 2015 12:02:45 +1000 Subject: [PATCH] autotest: cope with symlinks in vehicle path --- Tools/autotest/sim_vehicle.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Tools/autotest/sim_vehicle.sh b/Tools/autotest/sim_vehicle.sh index 01e817043b..48ebf99008 100755 --- a/Tools/autotest/sim_vehicle.sh +++ b/Tools/autotest/sim_vehicle.sh @@ -188,7 +188,12 @@ SIMOUT_PORT="127.0.0.1:"$((5501+10*$INSTANCE)) FG_PORT="127.0.0.1:"$((5503+10*$INSTANCE)) [ -z "$VEHICLE" ] && { - VEHICLE=$(basename $PWD) + CDIR="$PWD" + rpath=$(which realpath) + [ -n "rpath" ] && { + CDIR=$(realpath $CDIR) + } + VEHICLE=$(basename $CDIR) } [ -z "$FRAME" -a "$VEHICLE" = "APMrover2" ] && { @@ -287,8 +292,12 @@ autotest="../Tools/autotest" # the location of the sim_vehicle.sh script to find the path autotest=$(dirname $(readlink -e $0)) } -pushd $autotest/../../$VEHICLE || { - echo "Failed to change to vehicle directory for $VEHICLE" +VEHICLEDIR="$autotest/../../$VEHICLE" +[ -d "$VEHICLEDIR" ] || { + VEHICLEDIR=$(dirname $(readlink -e $VEHICLEDIR)) +} +pushd $VEHICLEDIR || { + echo "Failed to change to vehicle directory for $VEHICLEDIR" usage exit 1 }