tests: Use test-name.* style files more consistently

Use params['prefix'] to build the file names for dynamically generated
files.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-05-17 16:03:29 +03:00
parent 78c823de4e
commit 0132a72922
4 changed files with 24 additions and 43 deletions

View file

@ -161,10 +161,9 @@ def run_ap_config_reload_on_sighup(dev, apdev, params, ht=True):
name = "ap_config_reload_on_sighup"
if not ht:
name += "_no_ht"
pidfile = os.path.join(params['logdir'], name + "-hostapd.pid")
logfile = os.path.join(params['logdir'], name + "-hostapd-log")
conffile = os.path.join(os.getcwd(), params['logdir'],
name + "-hostapd.conf")
pidfile = params['prefix'] + ".hostapd.pid"
logfile = params['prefix'] + ".hostapd.log"
conffile = params['prefix'] + ".hostapd.conf"
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
@ -208,11 +207,9 @@ def run_ap_config_reload_on_sighup(dev, apdev, params, ht=True):
def test_ap_config_reload_on_sighup_bss_changes(dev, apdev, params):
"""hostapd configuration reload modification from file on SIGHUP with bss remove/add"""
name = "ap_config_reload_on_sighup_bss_changes"
pidfile = os.path.join(params['logdir'], name + "-hostapd.pid")
logfile = os.path.join(params['logdir'], name + "-hostapd-log")
conffile = os.path.join(os.getcwd(), params['logdir'],
name + "-hostapd.conf")
pidfile = params['prefix'] + ".hostapd.pid"
logfile = params['prefix'] + ".hostapd-log"
conffile = params['prefix'] + ".hostapd.conf"
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
@ -364,7 +361,7 @@ def test_ap_config_invalid_value(dev, apdev, params):
def test_ap_config_eap_user_file_parsing(dev, apdev, params):
"""hostapd eap_user_file parsing"""
tmp = os.path.join(params['logdir'], 'ap_config_eap_user_file_parsing.tmp')
tmp = params['prefix'] + '.tmp'
hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
for i in range(2):

View file

@ -502,8 +502,8 @@ def test_ap_duplicate_bssid(dev, apdev):
def test_ap_bss_config_file(dev, apdev, params):
"""hostapd BSS config file"""
pidfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd.pid")
logfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd-log")
pidfile = params['prefix'] + ".hostapd.pid"
logfile = params['prefix'] + ".hostapd-log"
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'

View file

@ -3850,7 +3850,7 @@ def test_ap_hs20_remediation_sql(dev, apdev, params):
import sqlite3
except ImportError:
raise HwsimSkip("No sqlite3 module available")
dbfile = os.path.join(params['logdir'], "eap-user.db")
dbfile = params['prefix'] + ".eap-user.db"
try:
os.remove(dbfile)
except:
@ -3914,7 +3914,7 @@ def test_ap_hs20_sim_provisioning(dev, apdev, params):
import sqlite3
except ImportError:
raise HwsimSkip("No sqlite3 module available")
dbfile = os.path.join(params['logdir'], "ap_hs20_sim_provisioning-eap-user.db")
dbfile = params['prefix'] + ".eap-user.db"
try:
os.remove(dbfile)
except:
@ -4632,16 +4632,10 @@ def tshark_get_na(cap):
return frames
def _test_proxyarp_open(dev, apdev, params, ebtables=False):
prefix = "proxyarp_open"
if ebtables:
prefix += "_ebtables"
cap_br = os.path.join(params['logdir'], prefix + ".ap-br0.pcap")
cap_dev0 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[0].ifname)
cap_dev1 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[1].ifname)
cap_dev2 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[2].ifname)
cap_br = params['prefix'] + ".ap-br0.pcap"
cap_dev0 = params['prefix'] + ".%s.pcap" % dev[0].ifname
cap_dev1 = params['prefix'] + ".%s.pcap" % dev[1].ifname
cap_dev2 = params['prefix'] + ".%s.pcap" % dev[2].ifname
bssid = apdev[0]['bssid']
params = {'ssid': 'open'}
@ -4960,17 +4954,10 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
# raise Exception("br did not get ARP response for 192.168.1.123")
def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
prefix = "proxyarp_open"
if ebtables:
prefix += "_ebtables"
prefix += "_ipv6"
cap_br = os.path.join(params['logdir'], prefix + ".ap-br0.pcap")
cap_dev0 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[0].ifname)
cap_dev1 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[1].ifname)
cap_dev2 = os.path.join(params['logdir'],
prefix + ".%s.pcap" % dev[2].ifname)
cap_br = params['prefix'] + ".ap-br0.pcap"
cap_dev0 = params['prefix'] + ".%s.pcap" % dev[0].ifname
cap_dev1 = params['prefix'] + ".%s.pcap" % dev[1].ifname
cap_dev2 = params['prefix'] + ".%s.pcap" % dev[2].ifname
bssid = apdev[0]['bssid']
params = {'ssid': 'open'}
@ -6182,7 +6169,7 @@ def run_ap_hs20_terms_and_conditions_sql(dev, apdev, params, url_template,
import sqlite3
except ImportError:
raise HwsimSkip("No sqlite3 module available")
dbfile = os.path.join(params['logdir'], "eap-user.db")
dbfile = params['prefix'] + ".eap-user.db"
try:
os.remove(dbfile)
except:

View file

@ -3853,20 +3853,17 @@ def test_sigma_dut_eap_ttls_uosc_initial_tod_tofu(dev, apdev, params):
def run_sigma_dut_eap_ttls_uosc_initial_tod(dev, apdev, params, tofu):
check_tls_tod(dev[0])
logdir = params['logdir']
name = "sigma_dut_eap_ttls_uosc_initial_tod"
if tofu:
name += "_tofu"
name = params['name']
with open("auth_serv/rsa3072-ca.pem", "r") as f:
with open(os.path.join(logdir, name + ".ca.pem"), "w") as f2:
with open(params['prefix'] + ".ca.pem", "w") as f2:
f2.write(f.read())
if tofu:
src = "auth_serv/server-certpol2.pem"
else:
src = "auth_serv/server-certpol.pem"
dst = os.path.join(logdir, name + ".server.der")
hashdst = os.path.join(logdir, name + ".server.pem.sha256")
dst = params['prefix'] + ".server.der"
hashdst = params['prefix'] + ".server.pem.sha256"
subprocess.check_call(["openssl", "x509", "-in", src, "-out", dst,
"-outform", "DER"],
stderr=open('/dev/null', 'w'))