[PATCH 06/12] hwsim: Flag inside VM using an environment variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

It is possible to execute the tests directly inside the a VM without
necessarily running the repository wrapper script to do so. In these
cases, passing the VM flag using an environment variable allows
correctly flagging this fact to the tests.

Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
---
 tests/hwsim/run-all.sh | 2 +-
 tests/hwsim/utils.py   | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index 75c3a58b52..bee753bb69 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -134,7 +134,7 @@ if [ "$(id -u)" != 0 ]; then
 else
 	SUDO=
 fi
-${SUDO} ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $RUN_TEST_ARGS || errors=1
+${SUDO} env VM=$VM ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $RUN_TEST_ARGS || errors=1
 
 ./stop.sh
 
diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py
index d01e1fbbfe..7e36082843 100644
--- a/tests/hwsim/utils.py
+++ b/tests/hwsim/utils.py
@@ -79,10 +79,8 @@ def wait_fail_trigger(dev, cmd, note="Failure not triggered", max_iter=40,
         time.sleep(timeout)
 
 def require_under_vm():
-    with open('/proc/1/cmdline', 'r') as f:
-        cmd = f.read()
-        if "inside.sh" not in cmd:
-            raise HwsimSkip("Not running under VM")
+    if os.getenv('VM') != 'VM':
+        raise HwsimSkip("Not running under VM")
 
 def iface_is_in_bridge(bridge, ifname):
     fname = "/sys/class/net/"+ifname+"/brport/bridge"
-- 
2.43.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux