Browse Source

tests: Skip radius_acct_unreachable3 when not running under VM

It looks like the IP routing table changes used here to trigger
unreachability and following reachability of the server do not work very
well with full IP routing configuration, so run this test case only when
executed under vm-run.sh.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 10 years ago
parent
commit
96cbb7b561
2 changed files with 8 additions and 1 deletions
  1. 2 1
      tests/hwsim/test_radius.py
  2. 6 0
      tests/hwsim/utils.py

+ 2 - 1
tests/hwsim/test_radius.py

@@ -16,7 +16,7 @@ import threading
 import time
 
 import hostapd
-from utils import HwsimSkip
+from utils import HwsimSkip, require_under_vm
 
 def connect(dev, ssid, wait_connect=True):
     dev.connect(ssid, key_mgmt="WPA-EAP", scan_freq="2412",
@@ -124,6 +124,7 @@ def test_radius_acct_unreachable2(dev, apdev):
 
 def test_radius_acct_unreachable3(dev, apdev):
     """RADIUS Accounting server initially unreachable, but then available"""
+    require_under_vm()
     subprocess.call(['ip', 'ro', 'replace', 'blackhole', '192.168.213.18'])
     as_hapd = hostapd.Hostapd("as")
     as_mib_start = as_hapd.get_mib(param="radius_server")

+ 6 - 0
tests/hwsim/utils.py

@@ -33,3 +33,9 @@ class alloc_fail(object):
         if type is None:
             if self._dev.request("GET_ALLOC_FAIL") != "0:%s" % self._funcs:
                 raise Exception("Allocation failure did not trigger")
+
+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")