From: Jouni Malinen Date: Thu, 14 Apr 2022 08:50:41 +0000 (+0300) Subject: tests: Handle git rev-parse failures more robustly X-Git-Tag: hostap_2_11~2082 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58701128e80d02a154bb055c79cb44d7e7fd4864;p=thirdparty%2Fhostap.git tests: Handle git rev-parse failures more robustly 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 --- diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh index ee48cd058..7c50edd79 100755 --- a/tests/hwsim/run-all.sh +++ b/tests/hwsim/run-all.sh @@ -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