tests: Flag inside VM using an environment variable
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@intel.com>
This commit is contained in:
parent
ab98ad397b
commit
1e08a8990d
2 changed files with 3 additions and 5 deletions
|
@ -134,7 +134,7 @@ if [ "$(id -u)" != 0 ]; then
|
||||||
else
|
else
|
||||||
SUDO=
|
SUDO=
|
||||||
fi
|
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
|
./stop.sh
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,8 @@ def wait_fail_trigger(dev, cmd, note="Failure not triggered", max_iter=40,
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
|
|
||||||
def require_under_vm():
|
def require_under_vm():
|
||||||
with open('/proc/1/cmdline', 'r') as f:
|
if os.getenv('VM') != 'VM':
|
||||||
cmd = f.read()
|
raise HwsimSkip("Not running under VM")
|
||||||
if "inside.sh" not in cmd:
|
|
||||||
raise HwsimSkip("Not running under VM")
|
|
||||||
|
|
||||||
def iface_is_in_bridge(bridge, ifname):
|
def iface_is_in_bridge(bridge, ifname):
|
||||||
fname = "/sys/class/net/"+ifname+"/brport/bridge"
|
fname = "/sys/class/net/"+ifname+"/brport/bridge"
|
||||||
|
|
Loading…
Reference in a new issue