From patchwork Sat Nov 7 10:49:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1396103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=XUu0vMl9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eZb59IC2; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CSvDT4N7gz9sTD for ; Sat, 7 Nov 2020 21:50:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=LJV+vLmT4sag9EsaQar8Of6iil4A1QUhnS2HDkY8D28=; b=XUu0vMl9eAqWjEVLLCCuc6+u21 eBAFnEYjFK4duTD73tzgdfl6dj9OCIVxWrwAe+TQRd0Ld4Y1wYD6SbjZ0XlNxY9vd7m2FCKOywGTn ++VRRW0ignbbAdQiZJ01wWJfRqiLa1cm7f7mM17Pp2i26JhOjEEAAo7o8K+Cj4Y6eN5AdtcV8b0gO m+5WW77ecLm2As0P5AfoqSPXbyzaH/EGoPJc3PPb7qXZdbSwY9INBNIWxOxCN2JeGuv49gaM/gzlv QIq5z1+quHlc5Jn3T27O2DkHQ5MqjD6htXXUgaan4plGuuyAHjM/erTBxo5vpg/3hVDrUcl1hYM94 43HkkG3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbLmp-0000oQ-Qq; Sat, 07 Nov 2020 10:49:35 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbLmn-0000no-BI for hostap@lists.infradead.org; Sat, 07 Nov 2020 10:49:34 +0000 Received: by mail-wr1-x429.google.com with SMTP id c17so3826896wrc.11 for ; Sat, 07 Nov 2020 02:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N0Q863hjHC4d1oGfxMzvkGF3qe30mXSf+3fEL6+ZEls=; b=eZb59IC27aDAYF87hGZj5YBZSYEpXt2ZN+exiPSJKkdbpUcWr+9r9tqccBQ+idOoBw esaQTf8usxoNxOXn9XpStTWVu5LBluXGL9ZbT8QxM5YjfdwwxMfY7lYAqku9kw1QABAG 3o0Gptc2wY1MRJdEakphqosqQYKgduubkOV0eGnVePsJc4s17gqqokmwZVv7ozbMRNYH vVIZHREf2PUfsPM5BdTARvEe5etw28FAQwPiOoYXq8d6yIZ4GHtRSULTsZTOgivBYbx0 DDAopk5RyRwXE7zofoZtwGOb8UAum0dVWeGAcV6cNiPFn1vmXde3IGzC0+qtrZphKTFQ d80g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N0Q863hjHC4d1oGfxMzvkGF3qe30mXSf+3fEL6+ZEls=; b=DZ3NlF7Qaz/Q91flkgaRmfC3rK5cHZlsQkaMUuLeg98mXwr7iHFsRonnfd4b+cxzaW krjtBenEl2dZ2w2r3N+L9wncopd9oyjoie473uXkI0PbUWA66iCyvbPHHtKVG86lUAO2 +thdzQ7lKco4+kj5zV/YoTk89LbgP4SuusIPvJnrSReqmDNx9Nmc0Qwpn5IF2ss6GEN7 CawPY5UzPLAXQsa5w+ZJhTOOMJegc4vAkYqOTo8wGA/vx5eANkP6s5UDIlXIJW38IxeX P31EervWbd/73j4kKpGuXYHnosGyP/LwRT27HyYl2VrzlbJK+Sp1D/VhOjVxzWPxZru+ mxrg== X-Gm-Message-State: AOAM532qdADo6O0oBANH+8Ul4COYYwoNir+iaUjytWTT+2zzVrZvqL7S hQ/0kw7q3N5zS4Noihl53ZTTpPycrRrWXQ== X-Google-Smtp-Source: ABdhPJxuea91aBU6v21dnz1LbZmeM6CnqBi8YzfrbihmrXhl5gZq+6aaW74WXeqXA1rFvnUqlXDosw== X-Received: by 2002:adf:f3d1:: with SMTP id g17mr7575376wrp.156.1604746170288; Sat, 07 Nov 2020 02:49:30 -0800 (PST) Received: from localhost.localdomain ([62.141.200.169]) by smtp.gmail.com with ESMTPSA id a128sm5773717wmf.5.2020.11.07.02.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Nov 2020 02:49:29 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH 1/2] tests: remotehost: use correct name Date: Sat, 7 Nov 2020 11:49:14 +0100 Message-Id: <20201107104915.3557202-1-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201107_054933_423817_30F7454B X-CRM114-Status: GOOD ( 11.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:429 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, Janusz Dziedzic Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org While we start thread use: - thread_run - therad_stop - thread_wait Signed-off-by: Janusz Dziedzic --- tests/hwsim/remotehost.py | 10 +++++----- tests/hwsim/wlantest.py | 4 ++-- tests/remote/monitor.py | 4 ++-- tests/remote/rutils.py | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index dec1ad5a8..b4b837187 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -99,7 +99,7 @@ class Host(): return status, buf.decode() # async execute - def execute_run(self, command, res, use_reaper=True): + def thread_run(self, command, res, use_reaper=True): if use_reaper: filename = gen_reaper_file("reaper") self.send_file(filename, filename) @@ -113,13 +113,13 @@ class Host(): cmd = _command else: cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)] - _cmd = self.name + " execute_run: " + ' '.join(cmd) + _cmd = self.name + " thread_run: " + ' '.join(cmd) logger.debug(_cmd) t = threading.Thread(target=execute_thread, name=filename, args=(cmd, res)) t.start() return t - def execute_stop(self, t): + def thread_stop(self, t): if t.name.find("reaper") == -1: raise Exception("use_reaper required") @@ -148,13 +148,13 @@ class Host(): self.execute(["rm", pid_file]) self.execute(["rm", t.name]) - def wait_execute_complete(self, t, wait=None): + def thread_wait(self, t, wait=None): if wait == None: wait_str = "infinite" else: wait_str = str(wait) + "s" - logger.debug(self.name + " wait_execute_complete(" + wait_str + "): ") + logger.debug(self.name + " thread_wait(" + wait_str + "): ") if t.isAlive(): t.join(wait) diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py index 6d4343b63..16765d27a 100644 --- a/tests/hwsim/wlantest.py +++ b/tests/hwsim/wlantest.py @@ -29,7 +29,7 @@ class Wlantest: return cls.remote_host.execute(["killall", "-9", "wlantest"]) - cls.remote_host.wait_execute_complete(cls.exe_thread, 5) + cls.remote_host.thread_wait(cls.exe_thread, 5) cls.exe_thread = None cls.exe_res = [] @@ -64,7 +64,7 @@ class Wlantest: pcap_file, log_file) cls.remote_host.add_log(log_file) cls.remote_host.add_log(pcap_file) - cls.exe_thread = cls.remote_host.execute_run(cmd.split(), cls.exe_res) + cls.exe_thread = cls.remote_host.thread_run(cmd.split(), cls.exe_res) # Give wlantest a chance to start working time.sleep(1) diff --git a/tests/remote/monitor.py b/tests/remote/monitor.py index 5bd801c61..0f77d500b 100644 --- a/tests/remote/monitor.py +++ b/tests/remote/monitor.py @@ -110,7 +110,7 @@ def run(host, setup_params): log = log_dir + tc_name + "_" + host.name + log_monitor + ".pcap" host.add_log(log) - thread = host.execute_run([tshark, "-w", log], monitor_res) + thread = host.thread_run([tshark, "-w", log], monitor_res) host.thread = thread @@ -122,7 +122,7 @@ def stop(host): if host.thread is None: return - host.execute_stop(host.thread) + host.thread_stop(host.thread) host.thread = None # Add monitor to existing interface diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py index e80901b50..0585480a2 100644 --- a/tests/remote/rutils.py +++ b/tests/remote/rutils.py @@ -342,11 +342,11 @@ def ping_run(host, ip, result, ifname=None, addr_type="ipv4", deadline="5", qos= flush_arp_cache(host) - thread = host.execute_run(ping, result) + thread = host.thread_run(ping, result) return thread def ping_wait(host, thread, timeout=None): - host.wait_execute_complete(thread, timeout) + host.thread_wait(thread, timeout) if thread.isAlive(): raise Exception("ping thread still alive") @@ -496,23 +496,23 @@ def iperf_run(server, client, server_ip, client_res, server_res, flush_arp_cache(server) flush_arp_cache(client) - server_thread = server.execute_run(iperf_server, server_res) + server_thread = server.thread_run(iperf_server, server_res) time.sleep(1) - client_thread = client.execute_run(iperf_client, client_res) + client_thread = client.thread_run(iperf_client, client_res) return server_thread, client_thread def iperf_wait(server, client, server_thread, client_thread, timeout=None, iperf="iperf"): - client.wait_execute_complete(client_thread, timeout) + client.thread_wait(client_thread, timeout) if client_thread.isAlive(): raise Exception("iperf client thread still alive") - server.wait_execute_complete(server_thread, 5) + server.thread_wait(server_thread, 5) if server_thread.isAlive(): server.execute(["killall", "-s", "INT", iperf]) time.sleep(1) - server.wait_execute_complete(server_thread, 5) + server.thread_wait(server_thread, 5) if server_thread.isAlive(): raise Exception("iperf server thread still alive")