From patchwork Wed May 16 12:39:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 914593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mDXh046rz9s2R for ; Wed, 16 May 2018 22:39:45 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 254591A95CC for ; Wed, 16 May 2018 14:39:43 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 64AA43E7125 for ; Wed, 16 May 2018 14:39:41 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id F36FE601A37 for ; Wed, 16 May 2018 14:39:39 +0200 (CEST) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5432FABC3; Wed, 16 May 2018 12:39:39 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 16 May 2018 14:39:22 +0200 Message-Id: <20180516123924.11047-1-pvorel@suse.cz> X-Mailer: git-send-email 2.16.3 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [RFC PATCH 0/2] Shell API: TST_TESTFUNC_DATA X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Hi, this patch is maybe controversial as 1) it adds yet another way how to run tests in new shell API 2) it does not support new C API. It simply workaround missing POSIX support for arrays (in C we do similar things with array struct). Some network functions which use old API run several times with for loop. Here, in dccp_ipsec.sh, $IPSEC_SIZE_ARRAY gets changed with getopts in ipsec_lib.sh. runtest/net_stress.ipsec_dccp dccp4_ipsec01 dccp_ipsec.sh -s "100 500 1000" ... testcases/network/stress/dccp/dccp_ipsec.sh (simplified) TCID=dccp_ipsec TST_TOTAL=3 . ipsec_lib.sh do_test() { for p in $IPSEC_SIZE_ARRAY; do tst_netload -H $(tst_ipaddr rhost) -T dccp -n $p -N $p \ -r $IPSEC_REQUESTS done } do_test tst_exit --- Running it: /opt/ltp/testscripts/network.sh -D ... <<>> tag=dccp4_ipsec01 stime=1526471999 cmdline="dccp_ipsec.sh -s 100:500:1000" contacts="" analysis=exit <<>> dccp_ipsec 1 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-24771/LTP_dccp_ipsec.uHpwIo4sw4' dccp_ipsec 1 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 100 -N 100 -a 2 -r 500 -d tst_netload.res -g 43799' dccp_ipsec 1 TPASS: netstress passed, time spent '116' ms dccp_ipsec 2 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-24771/LTP_dccp_ipsec.uHpwIo4sw4' dccp_ipsec 2 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 500 -N 500 -a 2 -r 500 -d tst_netload.res -g 39537' dccp_ipsec 2 TPASS: netstress passed, time spent '11' ms dccp_ipsec 3 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-24771/LTP_dccp_ipsec.uHpwIo4sw4' dccp_ipsec 3 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 1000 -N 1000 -a 2 -r 500 -d tst_netload.res -g 34207' dccp_ipsec 3 TPASS: netstress passed, time spent '9' ms ... When rewritten into new API (simplified): TST_TESTFUNC=do_test . ipsec_lib.sh do_test() { for p in $IPSEC_SIZE_ARRAY; do tst_netload -H $(tst_ipaddr rhost) -T dccp -n $p -N $p \ -r $IPSEC_REQUESTS done } tst_run --- The problem is we lost counters: ... <<>> dccp_ipsec 1 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-20326/LTP_dccp_ipsec.6mH0vypvZC' dccp_ipsec 1 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 100 -N 100 -a 2 -r 500 -d tst_netload.res -g 44791' dccp_ipsec 1 TPASS: netstress passed, time spent '18' ms dccp_ipsec 1 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-20326/LTP_dccp_ipsec.6mH0vypvZC' dccp_ipsec 1 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 500 -N 500 -a 2 -r 500 -d tst_netload.res -g 39661' dccp_ipsec 1 TPASS: netstress passed, time spent '16' ms dccp_ipsec 1 TINFO: run server 'netstress -T dccp -R 500000 -B /tmp/netpan-20326/LTP_dccp_ipsec.6mH0vypvZC' dccp_ipsec 1 TINFO: run client 'netstress -l -T dccp -H 10.0.0.1 -n 1000 -N 1000 -a 2 -r 500 -d tst_netload.res -g 41279' dccp_ipsec 1 TPASS: netstress passed, time spent '12' ms UDP IPsec tests (udp_ipsec.sh, udp_ipsec_vti.sh) have TST_TOTAL=6, so it gets a bit unclear with just '1'. With TST_TESTFUNC_DATA and TST_TESTFUNC_DATA_IFS we can 1) simplify 7 tests now without creating special helper 2) keep ids. Second patch isn't applicable, it's just for demonstrating how it works as it expects further changes, I'll post with bigger patch for rewriting net/{stress,virt} tests. What is missing here is rewritten dccp/dccp_ipsec.sh and ipsec_lib.sh into new shell API and changes to runtest/net_stress.ipsec_dccp: -dccp4_ipsec01 dccp_ipsec.sh -s "100 500 1000" +dccp4_ipsec01 dccp_ipsec.sh -s 100:500:1000 Kind regards, Petr Petr Vorel (2): lib/tst_test.sh: TST_TESTFUNC_DATA and TST_TESTFUNC_DATA_IFS net/{stress,virt}: Use TST_TESTFUNC_DATA and TST_TESTFUNC_DATA_IFS doc/test-writing-guidelines.txt | 23 +++++++++++++++++++++++ testcases/lib/tst_test.sh | 20 ++++++++++++++++++-- testcases/network/stress/dccp/dccp_ipsec.sh | 6 ++---- testcases/network/stress/ipsec/ipsec_lib.sh | 3 ++- 4 files changed, 45 insertions(+), 7 deletions(-)