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:
Jouni Malinen 2015-02-07 00:15:01 +02:00 committed by Jouni Malinen
parent 592015c3c1
commit b638f70316
2 changed files with 17 additions and 5 deletions

View file

@ -2057,8 +2057,14 @@ def test_ap_wpa2_eap_fast_pac_file(dev, apdev, params):
phase1="fast_pac_format=binary",
pac_file=pac_file2)
finally:
subprocess.call(['sudo', 'rm', pac_file])
subprocess.call(['sudo', 'rm', pac_file2])
try:
os.remove(pac_file)
except:
pass
try:
os.remove(pac_file2)
except:
pass
def test_ap_wpa2_eap_fast_binary_pac(dev, apdev):
"""WPA2-Enterprise connection using EAP-FAST and binary PAC format"""

View file

@ -1536,7 +1536,7 @@ def test_ap_wps_pin_request_file(dev, apdev):
ssid = "wps"
pinfile = "/tmp/ap_wps_pin_request_file.log"
if os.path.exists(pinfile):
subprocess.call(['sudo', 'rm', pinfile])
os.remove(pinfile)
hostapd.add_ap(apdev[0]['ifname'],
{ "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wps_pin_requests": pinfile,
@ -1564,7 +1564,10 @@ def test_ap_wps_pin_request_file(dev, apdev):
if not success:
raise Exception("PIN request entry not in the log file")
finally:
subprocess.call(['sudo', 'rm', pinfile])
try:
os.remove(pinfile)
except:
pass
def test_ap_wps_auto_setup_with_config_file(dev, apdev):
"""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']:
raise Exception("Incorrect configuration: " + str(vals))
finally:
subprocess.call(['sudo', 'rm', conffile])
try:
os.remove(conffile)
except:
pass
def test_ap_wps_pbc_timeout(dev, apdev, params):
"""wpa_supplicant PBC walk time [long]"""