diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py index 5054e9318..94679657e 100644 --- a/tests/hwsim/test_ap_ciphers.py +++ b/tests/hwsim/test_ap_ciphers.py @@ -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")