]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fetch commitid on the host when running tests in a VM
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 14 Apr 2022 08:59:22 +0000 (11:59 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 14 Apr 2022 08:59:22 +0000 (11:59 +0300)
git has started rejecting repositories owned by other users and refusing
to run the "git rev-parse HEAD" command in this type of cases. That
resulted in issues with the VM testing model where the VM is practically
running everything as root while the host is a normal development
environment and likely a non-root user owned files.

Fix this by fetching the commitid on the host and pass it to the VM so
that no git operations need to be run within the VM itself.

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

index 7c50edd79d57b7b8562d8a319a6094e2e257c033..75c3a58b52b98d6b1db7ecc887b617b7b904e30f 100755 (executable)
@@ -16,7 +16,9 @@ if [ -z "$DBFILE" ]; then
     DB=""
 else
     DB="-S $DBFILE"
-    COMMITID="$(git rev-parse HEAD)"
+    if [ -z "$COMMITID" ]; then
+       COMMITID="$(git rev-parse HEAD)"
+    fi
     if [ -n "$COMMITID" ]; then
        DB="$DB --commit $COMMITID"
     fi
index bfcbda631e4f0def607f4efa9b5988c056ba6c44..11ded93f43f18cffd169fb7eb7f34a0edcfca28a 100755 (executable)
@@ -37,6 +37,11 @@ EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline)
 TELNET=$(sed 's/.*TELNET=\([^ ]*\) .*/\1/' /proc/cmdline)
 ARGS=$(sed 's/.*ARGS=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline)
 LOGDIR=$(sed 's/.*LOGDIR=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline)
+if grep -q "commitid=" /proc/cmdline; then
+    COMMITID=$(sed 's/.*commitid=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline)
+else
+    COMMITID=
+fi
 
 mount --bind "$TESTDIR/vm/regdb/" /lib/firmware
 
@@ -146,6 +151,7 @@ else
        export LOGDIR=/tmp/logs
        export DBFILE=$LOGDIR/results.db
        export PREFILL_DB=y
+       export COMMITID
 
        # some tests need CRDA, install a simple uevent helper
        # and preload the 00 domain it will have asked for already
index 06dee068960b9e7620656c47eada4fc1779bad79..7a0273ac4b06732e4366bef9d6abf82b3bd6e051 100755 (executable)
@@ -154,6 +154,10 @@ A+="TELNET=$TELNET_ARG "
 A+="EPATH=$EPATH "
 A+="ARGS=$argsfile "
 A+="console=$KVMOUT "
+COMMITID="$(git rev-parse HEAD)"
+if [ -n "$COMMITID" ]; then
+    A+="commitid=$COMMITID "
+fi
 A+="ro"
 
 if [ -z $KVM ]; then