From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B603C06511 for ; Thu, 4 Jul 2019 00:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3002218A3 for ; Thu, 4 Jul 2019 00:46:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20150623.gappssmtp.com header.i=@mojatatu-com.20150623.gappssmtp.com header.b="pz/1pZEp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbfGDAqB (ORCPT ); Wed, 3 Jul 2019 20:46:01 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:38693 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbfGDAp7 (ORCPT ); Wed, 3 Jul 2019 20:45:59 -0400 Received: by mail-io1-f65.google.com with SMTP id j6so9270832ioa.5 for ; Wed, 03 Jul 2019 17:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RHK7SlJqiYa2Rq9rqHsf5d7QBoTdkJldScxSF9BOtuU=; b=pz/1pZEpqZKzvjCwryblYlm5TzBXTZ79bh34dYtgekZlnc/frPKC+bMOoqra881RMO DBG/c5XYpQi4vKAdcYu2R1s/lj9v8id2Vv2pzcglRW4DOs816EJULPdd2lQQCMITBpnz 3LMLIX3om3uBXyv+cnbsQkAj3HT1ky1PPwlzo3fvSKv+eaNlwWwL7IuvQJSGzQAH48Nm FHhDtbE1W4cNG1gRgdAmHmPhcyOKma1VfHyF+I4JDh/QmFYVO4M/0/DDgoGythnPA+c1 OTZfizSQJppTMZkhvxSFnO1pPnf/6R6mCr5pHrGABv9jcXQi4A64yvjPvFxliK8Qr+zx RHFA== 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:in-reply-to :references; bh=RHK7SlJqiYa2Rq9rqHsf5d7QBoTdkJldScxSF9BOtuU=; b=ry3aXhl8IDCTfS8EMxPD2qlgKeSkZzbA/S0ri1cGb7Y3izSYUGfcFau2Mb94pgk8wQ FCnFfrlItJ6CCJtnRi5l/oCF78x0mMk8vy3Di5JWKXDt5Kg6Al45Cy5HABGZQLnhipuX oAJysIe6/mpmLXmsb/B/8lDm6CcHVJ3g2cyTfNhvkmfUF+AcmyJNNyNTxm91mUXHiWrU W6r7PQX+QYyFImKD5B/Fl/J8cgr2S95rB1WH2Buplw6hV5RmIPua2Y6ZA4pX1pIk2nQc e7sjBV1KaojqUe/59ZskYPWr/GAeTi41DVHihi6NcRyoTT5yvrc4U2D4NmRtHZ2VZZEy IjDg== X-Gm-Message-State: APjAAAVPBfNue09dwu+NSrWAyaGVrwGRfVrvc9gCC7ZkoSwGBsE+gEs8 9P0frx93vSdz24/g3K+aKz2vhg== X-Google-Smtp-Source: APXvYqzdQYa+cczENRt6f03cb+9WnCIMchrkDSBeUtBG2vpc3iGNeT1Wbvubj+MUsnfXJydCzhxOcA== X-Received: by 2002:a5d:8195:: with SMTP id u21mr12086889ion.260.1562201158884; Wed, 03 Jul 2019 17:45:58 -0700 (PDT) Received: from mojatatu.com ([2607:f2c0:e4b2:adf:4494:a7b3:9aab:d513]) by smtp.gmail.com with ESMTPSA id l5sm5619776ioq.83.2019.07.03.17.45.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jul 2019 17:45:58 -0700 (PDT) From: Lucas Bates To: davem@davemloft.net Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, mleitner@redhat.com, vladbu@mellanox.com, dcaratti@redhat.com, kernel@mojatatu.com, Lucas Bates Subject: [PATCH v2 net-next 2/3] tc-testing: Allow tdc plugins to see test case data Date: Wed, 3 Jul 2019 20:45:01 -0400 Message-Id: <1562201102-4332-3-git-send-email-lucasb@mojatatu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562201102-4332-1-git-send-email-lucasb@mojatatu.com> References: <1562201102-4332-1-git-send-email-lucasb@mojatatu.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Instead of only passing the test case name and ID, pass the entire current test case down to the plugins. This change allows plugins to start accepting commands and directives from the test cases themselves, for greater flexibility in testing. Signed-off-by: Lucas Bates --- tools/testing/selftests/tc-testing/TdcPlugin.py | 5 ++--- tools/testing/selftests/tc-testing/tdc.py | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/tc-testing/TdcPlugin.py b/tools/testing/selftests/tc-testing/TdcPlugin.py index b980a56..79f3ca8 100644 --- a/tools/testing/selftests/tc-testing/TdcPlugin.py +++ b/tools/testing/selftests/tc-testing/TdcPlugin.py @@ -18,12 +18,11 @@ class TdcPlugin: if self.args.verbose > 1: print(' -- {}.post_suite'.format(self.sub_class)) - def pre_case(self, testid, test_name, test_skip): + def pre_case(self, caseinfo, test_skip): '''run commands before test_runner does one test''' if self.args.verbose > 1: print(' -- {}.pre_case'.format(self.sub_class)) - self.args.testid = testid - self.args.test_name = test_name + self.args.caseinfo = caseinfo self.args.test_skip = test_skip def post_case(self): diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py index 1afa803..de7da9a 100755 --- a/tools/testing/selftests/tc-testing/tdc.py +++ b/tools/testing/selftests/tc-testing/tdc.py @@ -126,15 +126,15 @@ class PluginMgr: for pgn_inst in reversed(self.plugin_instances): pgn_inst.post_suite(index) - def call_pre_case(self, testid, test_name, *, test_skip=False): + def call_pre_case(self, caseinfo, *, test_skip=False): for pgn_inst in self.plugin_instances: try: - pgn_inst.pre_case(testid, test_name, test_skip) + pgn_inst.pre_case(caseinfo, test_skip) except Exception as ee: print('exception {} in call to pre_case for {} plugin'. format(ee, pgn_inst.__class__)) print('test_ordinal is {}'.format(test_ordinal)) - print('testid is {}'.format(testid)) + print('testid is {}'.format(caseinfo['id'])) raise def call_post_case(self): @@ -379,14 +379,14 @@ def run_one_test(pm, args, index, tidx): res = TestResult(tidx['id'], tidx['name']) res.set_result(ResultState.skip) res.set_errormsg('Test case designated as skipped.') - pm.call_pre_case(tidx['id'], tidx['name'], test_skip=True) + pm.call_pre_case(tidx, test_skip=True) pm.call_post_execute() return res # populate NAMES with TESTID for this test NAMES['TESTID'] = tidx['id'] - pm.call_pre_case(tidx['id'], tidx['name']) + pm.call_pre_case(tidx) prepare_env(args, pm, 'setup', "-----> prepare stage", tidx["setup"]) if (args.verbose > 0): -- 2.7.4