tests: Simplify Michael MIC test file writing
Since run-tests.py is now required to run as root, there is no need to use the somewhat awkward "sudo tee" construction; instead, just write directly to the file. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ae13ad6413
commit
dc4c3dc4a2
1 changed files with 8 additions and 25 deletions
|
@ -5,7 +5,6 @@
|
|||
# See README for more details.
|
||||
|
||||
import time
|
||||
import subprocess
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
import os.path
|
||||
|
@ -47,22 +46,14 @@ def test_ap_cipher_tkip_countermeasures_ap(dev, apdev):
|
|||
pairwise="TKIP", group="TKIP", scan_freq="2412")
|
||||
|
||||
dev[0].dump_monitor()
|
||||
cmd = subprocess.Popen(["sudo", "tee", testfile],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
cmd.stdin.write(apdev[0]['bssid'])
|
||||
cmd.stdin.close()
|
||||
cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
with open(testfile, "w") as f:
|
||||
f.write(apdev[0]['bssid'])
|
||||
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
|
||||
if ev is not None:
|
||||
raise Exception("Unexpected disconnection on first Michael MIC failure")
|
||||
|
||||
cmd = subprocess.Popen(["sudo", "tee", testfile],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
cmd.stdin.write("ff:ff:ff:ff:ff:ff")
|
||||
cmd.stdin.close()
|
||||
cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
with open(testfile, "w") as f:
|
||||
f.write("ff:ff:ff:ff:ff:ff")
|
||||
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("No disconnection after two Michael MIC failures")
|
||||
|
@ -89,22 +80,14 @@ def test_ap_cipher_tkip_countermeasures_sta(dev, apdev):
|
|||
pairwise="TKIP", group="TKIP", scan_freq="2412")
|
||||
|
||||
dev[0].dump_monitor()
|
||||
cmd = subprocess.Popen(["sudo", "tee", testfile],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
cmd.stdin.write(dev[0].p2p_dev_addr())
|
||||
cmd.stdin.close()
|
||||
cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
with open(testfile, "w") as f:
|
||||
f.write(dev[0].p2p_dev_addr())
|
||||
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
|
||||
if ev is not None:
|
||||
raise Exception("Unexpected disconnection on first Michael MIC failure")
|
||||
|
||||
cmd = subprocess.Popen(["sudo", "tee", testfile],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
cmd.stdin.write("ff:ff:ff:ff:ff:ff")
|
||||
cmd.stdin.close()
|
||||
cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
with open(testfile, "w") as f:
|
||||
f.write("ff:ff:ff:ff:ff:ff")
|
||||
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("No disconnection after two Michael MIC failures")
|
||||
|
|
Loading…
Reference in a new issue