From patchwork Mon Apr 29 14:28:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 53150 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6BE0A4C90; Mon, 29 Apr 2019 16:28:48 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 895B33772 for ; Mon, 29 Apr 2019 16:28:46 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0D8181F0E; Mon, 29 Apr 2019 14:28:45 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.205.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B30EC6B8E0; Mon, 29 Apr 2019 14:28:44 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, aconole@redhat.com Date: Mon, 29 Apr 2019 16:28:36 +0200 Message-Id: <1556548116-18458-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 29 Apr 2019 14:28:45 +0000 (UTC) Subject: [dpdk-dev] [PATCH] test: load tests symbols from binary at init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Rather than call nm on the test application binary for each test to consider, call it once at the object init. Signed-off-by: David Marchand Acked-by: Anatoly Burakov Acked-by: Aaron Conole --- With a little patch of mine, before: # make O=master test /root/dpdk/master/app/test -c f -n 4 Filtering tests took 24s <=== Running tests with 4 workers Test name Test result Test Total ================================================================================ Skipped autotests: devargs: Skipped [Not compiled] [00m 00s] cryptodev_sw_mrvl: Skipped [Not compiled] [00m 00s] ... After: # make O=master test /root/dpdk/master/app/test -c f -n 4 Filtering tests took 0s <=== Running tests with 4 workers Test name Test result Test Total ================================================================================ Skipped autotests: devargs: Skipped [Not compiled] [00m 00s] cryptodev_sw_mrvl: Skipped [Not compiled] [00m 00s] ... --- app/test/autotest_runner.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py index 36941a4..b72716e 100644 --- a/app/test/autotest_runner.py +++ b/app/test/autotest_runner.py @@ -192,7 +192,6 @@ class AutotestRunner: def __init__(self, cmdline, target, blacklist, whitelist, n_processes): self.cmdline = cmdline self.target = target - self.binary = cmdline.split()[0] self.blacklist = blacklist self.whitelist = whitelist self.skipped = [] @@ -201,6 +200,16 @@ def __init__(self, cmdline, target, blacklist, whitelist, n_processes): self.n_processes = n_processes self.active_processes = 0 + # parse the binary for available test commands + binary = cmdline.split()[0] + stripped = 'not stripped' not in \ + subprocess.check_output(['file', binary]) + if not stripped: + symbols = subprocess.check_output(['nm', binary]).decode('utf-8') + self.avail_cmds = re.findall('test_register_(\w+)', symbols) + else: + self.avail_cmds = None + # log file filename logfile = "%s.log" % target csvfile = "%s.csv" % target @@ -275,20 +284,10 @@ def __filter_test(self, test): return False # if test wasn't compiled in, remove it as well - - # parse the binary for available test commands - stripped = 'not stripped' not in \ - subprocess.check_output(['file', self.binary]) - if not stripped: - symbols = subprocess.check_output(['nm', - self.binary]).decode('utf-8') - avail_cmds = re.findall('test_register_(\w+)', symbols) - - if test_cmd not in avail_cmds: - # notify user - result = 0, "Skipped [Not compiled]", test_id, 0, "", None - self.skipped.append(tuple(result)) - return False + if self.avail_cmds and test_cmd not in self.avail_cmds: + result = 0, "Skipped [Not compiled]", test_id, 0, "", None + self.skipped.append(tuple(result)) + return False return True