]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Handle git rev-parse failures more robustly
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 14 Apr 2022 08:50:41 +0000 (11:50 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 14 Apr 2022 08:50:41 +0000 (11:50 +0300)
Do not add the --commit argument if the current git commitid cannot be
determined. This prevents complete failure to run the tests if the git
command cannot be used for some reason (like a recent change that
stopped allowing root user within the VM from running the git operation
for the case where the host system uses non-root account).

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/run-all.sh

index ee48cd0581c620f4849e4f417123130920d63854..7c50edd79d57b7b8562d8a319a6094e2e257c033 100755 (executable)
@@ -15,7 +15,11 @@ export LOGDIR
 if [ -z "$DBFILE" ]; then
     DB=""
 else
-    DB="-S $DBFILE --commit $(git rev-parse HEAD)"
+    DB="-S $DBFILE"
+    COMMITID="$(git rev-parse HEAD)"
+    if [ -n "$COMMITID" ]; then
+       DB="$DB --commit $COMMITID"
+    fi
     if [ -n "$BUILD" ]; then
        DB="$DB -b $BUILD"
     fi