Use the first unrecognized argument as the path name, not the second.
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 17 Aug 2023 05:51:08 +0000 (14:51 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 17 Aug 2023 05:55:20 +0000 (14:55 +0900)
If there are multiple unrecognized arguments,
treat only the first one as the path.

This will allow to ignore invalid arguments if it has given
the path for backward compatibility in the future.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
ssat.sh

diff --git a/ssat.sh b/ssat.sh
index 5461ba3..5916f55 100755 (executable)
--- a/ssat.sh
+++ b/ssat.sh
@@ -34,6 +34,7 @@
 ## - Version          :  1.2.0
 
 TARGET=$(pwd)
+TARGET_ASSIGNED=0
 BASEPATH=`dirname "$0"`
 BASENAME=`basename "$0"`
 TESTCASE="runTest.sh"
@@ -204,7 +205,13 @@ do
        shift
        ;;
        *) # Unknown, which is probably target (the path to root-dir of test groups).
-       TARGET="$1"
+       # If this is the second occurrence, ignore it.
+       # Assume that the previous string is path and the later string is an invalid argument.
+       if [ $TARGET_ASSIGNED -eq 0 ]
+       then
+               TARGET="$1"
+               TARGET_ASSIGNED=1
+       fi
        shift
        esac
 done