aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJonathan Afek <jonathan@wizery.com>2016-05-19 13:06:44 (GMT)
committerJouni Malinen <j@w1.fi>2016-05-28 13:33:48 (GMT)
commit04fd8ea1bad3ba540bcdffa82953a41fa0f0a7f4 (patch)
treefe138006c623c924ae9276e2370fbec8cdcc9309 /tests
parente2f3f0232f42c2293e4cc9a5b4813d3df55fc3af (diff)
downloadhostap-04fd8ea1bad3ba540bcdffa82953a41fa0f0a7f4.zip
hostap-04fd8ea1bad3ba540bcdffa82953a41fa0f0a7f4.tar.gz
hostap-04fd8ea1bad3ba540bcdffa82953a41fa0f0a7f4.tar.bz2
tests/remote: Use a function to add a log file to a remote host
Instead of accessing the logs list member of the remote host directly, use a function to add logs to the remote host to be collected after the test. This enables us to later have different implementation of remote hosts or logs collection without requiring to have this list as the implementation. Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/remotehost.py3
-rw-r--r--tests/remote/monitor.py2
-rw-r--r--tests/remote/rutils.py8
-rw-r--r--tests/remote/test_example.py4
4 files changed, 10 insertions, 7 deletions
diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index 5021b92..39d7253 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -93,6 +93,9 @@ class Host():
if t.isAlive():
t.join(wait)
+ def add_log(self, log_file):
+ self.logs.append(log_file)
+
def get_logs(self, local_log_dir=None):
for log in self.logs:
if local_log_dir:
diff --git a/tests/remote/monitor.py b/tests/remote/monitor.py
index fb621ad..fe67592 100644
--- a/tests/remote/monitor.py
+++ b/tests/remote/monitor.py
@@ -95,7 +95,7 @@ def run(host, setup_params):
log_monitor = log_monitor + "_" + monitor
log = log_dir + tc_name + "_" + host.name + log_monitor + ".pcap"
- host.logs.append(log)
+ host.add_log(log)
thread = host.execute_run([tshark, "-w", log], monitor_res)
host.thread = thread
diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py
index 588566a..fd6127b 100644
--- a/tests/remote/rutils.py
+++ b/tests/remote/rutils.py
@@ -63,7 +63,7 @@ def trace_start_stop(host, setup_params, start):
else:
cmd = stop_trace
trace_dir = setup_params['log_dir'] + host.ifname + "/remote_traces"
- host.logs.append(trace_dir + "/*")
+ host.add_log(trace_dir + "/*")
host.execute([cmd, "-I", host.ifname, "-D", trace_dir])
except:
pass
@@ -88,7 +88,7 @@ def perf_start_stop(host, setup_params, start):
else:
cmd = perf_stop
perf_dir = setup_params['log_dir'] + host.ifname + "/remote_perf"
- host.logs.append(perf_dir + "/*")
+ host.add_log(perf_dir + "/*")
host.execute([cmd, "-I", host.ifname, "-D", perf_dir])
except:
pass
@@ -106,7 +106,7 @@ def run_hostapd(host, setup_params):
log = ""
if log_file:
- host.logs.append(log_file)
+ host.add_log(log_file)
status, buf = host.execute([setup_params['hostapd'], "-B", "-ddt", "-g", "udp:" + host.port, log])
if status != 0:
raise Exception("Could not run hostapd: " + buf)
@@ -123,7 +123,7 @@ def run_wpasupplicant(host, setup_params):
log = ""
if log_file:
- host.logs.append(log_file)
+ host.add_log(log_file)
status, buf = host.execute([setup_params['wpa_supplicant'], "-B", "-ddt", "-g", "udp:" + host.port, log])
if status != 0:
raise Exception("Could not run wpa_supplicant: " + buf)
diff --git a/tests/remote/test_example.py b/tests/remote/test_example.py
index f834c0a..09c7e77 100644
--- a/tests/remote/test_example.py
+++ b/tests/remote/test_example.py
@@ -128,14 +128,14 @@ def test_example(devices, setup_params, refs, duts, monitors):
monitor.remove(sta)
dmesg = setup_params['log_dir'] + setup_params['tc_name'] + "_" + sta.name + "_" + sta.ifname + ".dmesg"
sta.execute(["dmesg", "-c", ">", dmesg])
- sta.logs.append(dmesg)
+ sta.add_log(dmesg)
sta.get_logs(local_log_dir)
sta.execute(["ifconfig", sta.ifname, "down"])
if ap:
monitor.remove(ap)
dmesg = setup_params['log_dir'] + setup_params['tc_name'] + "_" + ap.name + "_" + ap.ifname + ".dmesg"
ap.execute(["dmesg", "-c", ">", dmesg])
- ap.logs.append(dmesg)
+ ap.add_log(dmesg)
ap.get_logs(local_log_dir)
ap.execute(["ifconfig", ap.ifname, " down"])
raise