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" name = "ap_config_reload_on_sighup"
if not ht: if not ht:
name += "_no_ht" name += "_no_ht"
pidfile = os.path.join(params['logdir'], name + "-hostapd.pid") pidfile = params['prefix'] + ".hostapd.pid"
logfile = os.path.join(params['logdir'], name + "-hostapd-log") logfile = params['prefix'] + ".hostapd.log"
conffile = os.path.join(os.getcwd(), params['logdir'], conffile = params['prefix'] + ".hostapd.conf"
name + "-hostapd.conf")
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd') prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg): if not os.path.exists(prg):
prg = '../../hostapd/hostapd' 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): def test_ap_config_reload_on_sighup_bss_changes(dev, apdev, params):
"""hostapd configuration reload modification from file on SIGHUP with bss remove/add""" """hostapd configuration reload modification from file on SIGHUP with bss remove/add"""
name = "ap_config_reload_on_sighup_bss_changes" pidfile = params['prefix'] + ".hostapd.pid"
pidfile = os.path.join(params['logdir'], name + "-hostapd.pid") logfile = params['prefix'] + ".hostapd-log"
logfile = os.path.join(params['logdir'], name + "-hostapd-log") conffile = params['prefix'] + ".hostapd.conf"
conffile = os.path.join(os.getcwd(), params['logdir'],
name + "-hostapd.conf")
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd') prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg): if not os.path.exists(prg):
prg = '../../hostapd/hostapd' 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): def test_ap_config_eap_user_file_parsing(dev, apdev, params):
"""hostapd eap_user_file parsing""" """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"}) hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
for i in range(2): 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): def test_ap_bss_config_file(dev, apdev, params):
"""hostapd BSS config file""" """hostapd BSS config file"""
pidfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd.pid") pidfile = params['prefix'] + ".hostapd.pid"
logfile = os.path.join(params['logdir'], "ap_bss_config_file-hostapd-log") logfile = params['prefix'] + ".hostapd-log"
prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd') prg = os.path.join(params['logdir'], 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg): if not os.path.exists(prg):
prg = '../../hostapd/hostapd' prg = '../../hostapd/hostapd'

View File

@ -3850,7 +3850,7 @@ def test_ap_hs20_remediation_sql(dev, apdev, params):
import sqlite3 import sqlite3
except ImportError: except ImportError:
raise HwsimSkip("No sqlite3 module available") raise HwsimSkip("No sqlite3 module available")
dbfile = os.path.join(params['logdir'], "eap-user.db") dbfile = params['prefix'] + ".eap-user.db"
try: try:
os.remove(dbfile) os.remove(dbfile)
except: except:
@ -3914,7 +3914,7 @@ def test_ap_hs20_sim_provisioning(dev, apdev, params):
import sqlite3 import sqlite3
except ImportError: except ImportError:
raise HwsimSkip("No sqlite3 module available") 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: try:
os.remove(dbfile) os.remove(dbfile)
except: except:
@ -4632,16 +4632,10 @@ def tshark_get_na(cap):
return frames return frames
def _test_proxyarp_open(dev, apdev, params, ebtables=False): def _test_proxyarp_open(dev, apdev, params, ebtables=False):
prefix = "proxyarp_open" cap_br = params['prefix'] + ".ap-br0.pcap"
if ebtables: cap_dev0 = params['prefix'] + ".%s.pcap" % dev[0].ifname
prefix += "_ebtables" cap_dev1 = params['prefix'] + ".%s.pcap" % dev[1].ifname
cap_br = os.path.join(params['logdir'], prefix + ".ap-br0.pcap") cap_dev2 = params['prefix'] + ".%s.pcap" % dev[2].ifname
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)
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
params = {'ssid': 'open'} 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") # raise Exception("br did not get ARP response for 192.168.1.123")
def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False): def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
prefix = "proxyarp_open" cap_br = params['prefix'] + ".ap-br0.pcap"
if ebtables: cap_dev0 = params['prefix'] + ".%s.pcap" % dev[0].ifname
prefix += "_ebtables" cap_dev1 = params['prefix'] + ".%s.pcap" % dev[1].ifname
prefix += "_ipv6" cap_dev2 = params['prefix'] + ".%s.pcap" % dev[2].ifname
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)
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
params = {'ssid': 'open'} params = {'ssid': 'open'}
@ -6182,7 +6169,7 @@ def run_ap_hs20_terms_and_conditions_sql(dev, apdev, params, url_template,
import sqlite3 import sqlite3
except ImportError: except ImportError:
raise HwsimSkip("No sqlite3 module available") raise HwsimSkip("No sqlite3 module available")
dbfile = os.path.join(params['logdir'], "eap-user.db") dbfile = params['prefix'] + ".eap-user.db"
try: try:
os.remove(dbfile) os.remove(dbfile)
except: 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): def run_sigma_dut_eap_ttls_uosc_initial_tod(dev, apdev, params, tofu):
check_tls_tod(dev[0]) check_tls_tod(dev[0])
logdir = params['logdir'] logdir = params['logdir']
name = params['name']
name = "sigma_dut_eap_ttls_uosc_initial_tod"
if tofu:
name += "_tofu"
with open("auth_serv/rsa3072-ca.pem", "r") as f: 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()) f2.write(f.read())
if tofu: if tofu:
src = "auth_serv/server-certpol2.pem" src = "auth_serv/server-certpol2.pem"
else: else:
src = "auth_serv/server-certpol.pem" src = "auth_serv/server-certpol.pem"
dst = os.path.join(logdir, name + ".server.der") dst = params['prefix'] + ".server.der"
hashdst = os.path.join(logdir, name + ".server.pem.sha256") hashdst = params['prefix'] + ".server.pem.sha256"
subprocess.check_call(["openssl", "x509", "-in", src, "-out", dst, subprocess.check_call(["openssl", "x509", "-in", src, "-out", dst,
"-outform", "DER"], "-outform", "DER"],
stderr=open('/dev/null', 'w')) stderr=open('/dev/null', 'w'))