tests: Replace subprocess.call for rm with os.remove()
There is no need to use sudo and external rm to remove files now that run-tests.py is required to run as root. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
592015c3c1
commit
b638f70316
2 changed files with 17 additions and 5 deletions
|
@ -2057,8 +2057,14 @@ def test_ap_wpa2_eap_fast_pac_file(dev, apdev, params):
|
||||||
phase1="fast_pac_format=binary",
|
phase1="fast_pac_format=binary",
|
||||||
pac_file=pac_file2)
|
pac_file=pac_file2)
|
||||||
finally:
|
finally:
|
||||||
subprocess.call(['sudo', 'rm', pac_file])
|
try:
|
||||||
subprocess.call(['sudo', 'rm', pac_file2])
|
os.remove(pac_file)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
os.remove(pac_file2)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def test_ap_wpa2_eap_fast_binary_pac(dev, apdev):
|
def test_ap_wpa2_eap_fast_binary_pac(dev, apdev):
|
||||||
"""WPA2-Enterprise connection using EAP-FAST and binary PAC format"""
|
"""WPA2-Enterprise connection using EAP-FAST and binary PAC format"""
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ def test_ap_wps_pin_request_file(dev, apdev):
|
||||||
ssid = "wps"
|
ssid = "wps"
|
||||||
pinfile = "/tmp/ap_wps_pin_request_file.log"
|
pinfile = "/tmp/ap_wps_pin_request_file.log"
|
||||||
if os.path.exists(pinfile):
|
if os.path.exists(pinfile):
|
||||||
subprocess.call(['sudo', 'rm', pinfile])
|
os.remove(pinfile)
|
||||||
hostapd.add_ap(apdev[0]['ifname'],
|
hostapd.add_ap(apdev[0]['ifname'],
|
||||||
{ "ssid": ssid, "eap_server": "1", "wps_state": "2",
|
{ "ssid": ssid, "eap_server": "1", "wps_state": "2",
|
||||||
"wps_pin_requests": pinfile,
|
"wps_pin_requests": pinfile,
|
||||||
|
@ -1564,7 +1564,10 @@ def test_ap_wps_pin_request_file(dev, apdev):
|
||||||
if not success:
|
if not success:
|
||||||
raise Exception("PIN request entry not in the log file")
|
raise Exception("PIN request entry not in the log file")
|
||||||
finally:
|
finally:
|
||||||
subprocess.call(['sudo', 'rm', pinfile])
|
try:
|
||||||
|
os.remove(pinfile)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def test_ap_wps_auto_setup_with_config_file(dev, apdev):
|
def test_ap_wps_auto_setup_with_config_file(dev, apdev):
|
||||||
"""WPS auto-setup with configuration file"""
|
"""WPS auto-setup with configuration file"""
|
||||||
|
@ -1602,7 +1605,10 @@ def test_ap_wps_auto_setup_with_config_file(dev, apdev):
|
||||||
if vals['ieee80211n'] != '1' or vals['wps_state'] != '2' or "WPA-PSK" not in vals['wpa_key_mgmt']:
|
if vals['ieee80211n'] != '1' or vals['wps_state'] != '2' or "WPA-PSK" not in vals['wpa_key_mgmt']:
|
||||||
raise Exception("Incorrect configuration: " + str(vals))
|
raise Exception("Incorrect configuration: " + str(vals))
|
||||||
finally:
|
finally:
|
||||||
subprocess.call(['sudo', 'rm', conffile])
|
try:
|
||||||
|
os.remove(conffile)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def test_ap_wps_pbc_timeout(dev, apdev, params):
|
def test_ap_wps_pbc_timeout(dev, apdev, params):
|
||||||
"""wpa_supplicant PBC walk time [long]"""
|
"""wpa_supplicant PBC walk time [long]"""
|
||||||
|
|
Loading…
Reference in a new issue