diff mbox series

[07/12] tests: remotehost: add send_file

Message ID 20200112220226.5056-7-janusz.dziedzic@gmail.com
State Accepted
Headers show
Series [01/12] tests: remote: switch to python3 | expand

Commit Message

Janusz Dziedzic Jan. 12, 2020, 10:02 p.m. UTC
hostapd often using config files
eg, ACLs BSS configs

When execute remote tests (udp) first
we have to send this config files
to correct host.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
---
 tests/hwsim/hostapd.py    | 12 ++++++++++++
 tests/hwsim/remotehost.py |  5 +++++
 2 files changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index e555f75ed..8f2ce02d4 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -135,6 +135,10 @@  class HostapdGlobal:
         self.ctrl.terminate()
         self.ctrl = None
 
+    def send_file(self, src, dst):
+        self.host.send_file(src, dst)
+
+
 class Hostapd:
     def __init__(self, ifname, bssidx=0, hostname=None, port=8877):
         self.hostname = hostname
@@ -521,6 +525,10 @@  class Hostapd:
     def note(self, txt):
         self.request("NOTE " + txt)
 
+    def send_file(self, src, dst):
+        self.host.send_file(src, dst)
+
+
 def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
            global_ctrl_override=None, driver=False):
         if isinstance(apdev, dict):
@@ -741,3 +749,7 @@  def ht40_minus_params(channel="1", ssid=None, country=None):
 def cmd_execute(apdev, cmd, shell=False):
     hapd_global = HostapdGlobal(apdev)
     return hapd_global.cmd_execute(cmd, shell=shell)
+
+def send_file(apdev, src, dst):
+    hapd_global = HostapdGlobal(apdev)
+    return hapd_global.send_file(src, dst)
diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index 50f46c310..138419e47 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -106,3 +106,8 @@  class Host():
                 self.local_execute(["scp", self.user + "@[" + self.host + "]:" + log, local_log_dir])
             self.execute(["rm", log])
         del self.logs[:]
+
+    def send_file(self, src, dst):
+        if self.host is None:
+            return
+        self.local_execute(["scp", src, self.user + "@[" + self.host + "]:" + dst])