From patchwork Fri Nov 24 15:42:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13467801 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20230601.gappssmtp.com header.i=@mojatatu-com.20230601.gappssmtp.com header.b="G3gH/Zts" Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5C4F19B2 for ; Fri, 24 Nov 2023 07:43:47 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cfaaa79766so3169595ad.3 for ; Fri, 24 Nov 2023 07:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1700840627; x=1701445427; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GHXRjbF4FK0x25SPkE0rzr/gozBo2w/FyphnZEoI1JI=; b=G3gH/Zts4FXqiiVv/KUaDyoZHJhnNw456SDIhwXU1uHkBtMjk8a2VnrH5CEhKA7xes 7npj8w6MAeXMRtL+lpb/Ka8UiKcqITVmusp2tbUIoZ8XEcKUqgtef9lJn0MT5EbCPjen pb5a604LiCG4lOMncXHoI26UW2EoBonJRHudjENO3esUkPQbmDbFn6JFyLzrQoTDIc4n Cot9+CCJrYnpvhAHgaImrl6RzyavdZzo9B85FEpFJEDm/0YRWcl8ckYYsXnyb3aAQr1c NVLVfs4dwIesCGtWV21D3WFHMFTYIe5Q7VpbRENLOWevRVMM5/TjPJfSHgPDyy8R0gF1 OSVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700840627; x=1701445427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GHXRjbF4FK0x25SPkE0rzr/gozBo2w/FyphnZEoI1JI=; b=kheWVFDvV3ggzqz30hUHxN8K6UjzZqbp768lfrrGOtA0PgymkO2ikq4JfMFmbEbLST AbULQZKu6o9Ac7B3WVv/W+6PJwqHsipu2Q76VOn5JUr8CrxrpYPNaOFlJClNJ1nMijLE v9OTFKDGZ/vL39jqG4SU6enzxdQw5KM5ZGE+t6ElKA+kKGjs9NsaMRFJ57bOTOPfc/IQ O2qbIkJmwn/sJOTgphRNu36CAgSeqGnjUtxFRz+vgC7ncyhsw+qd9pgXEBIlxix/Ijr/ NddDFJWL4E9L7pVr9duy2wWlBk/otHypHdZa1hyG7itPhlPetB56ddCMpBAzMVtuw5MB 1HeQ== X-Gm-Message-State: AOJu0Yyovn++xeJX6st9RLPJrofyAqqlR9wwXE7avuuolwdwqncRsUN0 HORW+PVji2uBbMnewS43ziawYw== X-Google-Smtp-Source: AGHT+IGADI4SbDEek9IpA5X++dRMOmqbyuC2DMEf12tlqQgDeGsl6SI4kOp2xfOVVuaSvm0NC6L/7A== X-Received: by 2002:a17:902:f68e:b0:1cf:8364:ec24 with SMTP id l14-20020a170902f68e00b001cf8364ec24mr3922437plg.4.1700840627221; Fri, 24 Nov 2023 07:43:47 -0800 (PST) Received: from rogue-one.tail33bf8.ts.net ([201.17.86.134]) by smtp.gmail.com with ESMTPSA id g6-20020a170902740600b001cf9eac2d3asm1919743pll.118.2023.11.24.07.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:43:46 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Pedro Tammela , Davide Caratti Subject: [PATCH net-next 1/5] selftests: tc-testing: remove buildebpf plugin Date: Fri, 24 Nov 2023 12:42:44 -0300 Message-Id: <20231124154248.315470-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124154248.315470-1-pctammela@mojatatu.com> References: <20231124154248.315470-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As tdc only tests loading/deleting and anything more complicated is better left to the ebpf test suite, provide a pre-compiled version of 'action.c' and don't bother compiling it in kselftests or on the fly at all. Cc: Davide Caratti Signed-off-by: Pedro Tammela --- tools/testing/selftests/tc-testing/Makefile | 29 +------- tools/testing/selftests/tc-testing/README | 2 - .../testing/selftests/tc-testing/action-ebpf | Bin 0 -> 856 bytes .../tc-testing/plugin-lib/buildebpfPlugin.py | 67 ------------------ .../tc-testing/tc-tests/actions/bpf.json | 14 ++-- .../tc-testing/tc-tests/filters/bpf.json | 10 ++- tools/testing/selftests/tc-testing/tdc.sh | 2 +- 7 files changed, 11 insertions(+), 113 deletions(-) create mode 100644 tools/testing/selftests/tc-testing/action-ebpf delete mode 100644 tools/testing/selftests/tc-testing/plugin-lib/buildebpfPlugin.py diff --git a/tools/testing/selftests/tc-testing/Makefile b/tools/testing/selftests/tc-testing/Makefile index b1fa2e177e2f..e8b3dde4fa16 100644 --- a/tools/testing/selftests/tc-testing/Makefile +++ b/tools/testing/selftests/tc-testing/Makefile @@ -1,31 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -include ../../../scripts/Makefile.include -top_srcdir = $(abspath ../../../..) -APIDIR := $(top_scrdir)/include/uapi -TEST_GEN_FILES = action.o +TEST_PROGS += ./tdc.sh +TEST_FILES := action-ebpf tdc*.py Tdc*.py plugins plugin-lib tc-tests scripts include ../lib.mk - -PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1) - -ifeq ($(PROBE),) - CPU ?= probe -else - CPU ?= generic -endif - -CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - &1 \ - | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') - -CLANG_FLAGS = -I. -I$(APIDIR) \ - $(CLANG_SYS_INCLUDES) \ - -Wno-compare-distinct-pointer-types - -$(OUTPUT)/%.o: %.c - $(CLANG) $(CLANG_FLAGS) \ - -O2 --target=bpf -emit-llvm -c $< -o - | \ - $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@ - -TEST_PROGS += ./tdc.sh -TEST_FILES := tdc*.py Tdc*.py plugins plugin-lib tc-tests scripts diff --git a/tools/testing/selftests/tc-testing/README b/tools/testing/selftests/tc-testing/README index be7b00799b3e..fc8e858ff119 100644 --- a/tools/testing/selftests/tc-testing/README +++ b/tools/testing/selftests/tc-testing/README @@ -195,8 +195,6 @@ directory: and the other is a test whether the command leaked memory or not. (This one is a preliminary version, it may not work quite right yet, but the overall template is there and it should only need tweaks.) - - buildebpfPlugin.py: - builds all programs in $EBPFDIR. ACKNOWLEDGEMENTS diff --git a/tools/testing/selftests/tc-testing/action-ebpf b/tools/testing/selftests/tc-testing/action-ebpf new file mode 100644 index 0000000000000000000000000000000000000000..4879479b2ee5c046279be0fe8f9ca313dfb7e618 GIT binary patch literal 856 zcmb_ayKcfj5L_FFP=-`UX`o1n`2r$0A&n*IpgTFnLKX%`_!N;U`3b&--wH~R684VW zGukMra)oDhcIIBb_s4kTdmixc;2Y|SRe;%r7+E=j7CQH2*%9vjGf8`~C9?lCIqPKq z0V7lbI2>i;4uxB2IQfRywbcWscZm%V+i>M{cKD3|LY-|jB&p8JwOW?M`i`k`$r`e- zC|*}8na?*>z5rF^X|}F1GK49FmEP#&8S!mp@PEb_r>Rd{&-q1E)skfwzsJ=^YYJZ^ zYA*SHxV}g7SDx>m{VgVh?O*Z}>URklWc~pgW_@`FFBFjbmFFLrY 0: - foutput = serr.decode("utf-8") - else: - foutput = rawout.decode("utf-8") - - proc.stdout.close() - proc.stderr.close() - return proc, foutput diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json index 91832400ddbd..6e00bf32ef9a 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json @@ -54,9 +54,6 @@ "actions", "bpf" ], - "plugins": { - "requires": "buildebpfPlugin" - }, "setup": [ [ "$TC action flush action bpf", @@ -65,10 +62,10 @@ 255 ] ], - "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ok index 667", + "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ok index 667", "expExitCode": "0", "verifyCmd": "$TC action get action bpf index 667", - "matchPattern": "action order [0-9]*: bpf action.o:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref", + "matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref", "matchCount": "1", "teardown": [ "$TC action flush action bpf" @@ -81,9 +78,6 @@ "actions", "bpf" ], - "plugins": { - "requires": "buildebpfPlugin" - }, "setup": [ [ "$TC action flush action bpf", @@ -92,10 +86,10 @@ 255 ] ], - "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ko index 667", + "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ko index 667", "expExitCode": "255", "verifyCmd": "$TC action get action bpf index 667", - "matchPattern": "action order [0-9]*: bpf action.o:\\[action-ko\\] id [0-9].*index 667 ref", + "matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ko\\] id [0-9].*index 667 ref", "matchCount": "0", "teardown": [ [ diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/bpf.json b/tools/testing/selftests/tc-testing/tc-tests/filters/bpf.json index 013fb983bc3f..725d406a30ac 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/bpf.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/bpf.json @@ -52,17 +52,16 @@ ], "plugins": { "requires": [ - "buildebpfPlugin", "nsPlugin" ] }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ok", + "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action-ebpf section action-ok", "expExitCode": "0", "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf", - "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ok\\].*tag [0-9a-f]{16}( jited)?", + "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action-ebpf:\\[action-ok\\].*tag [0-9a-f]{16}( jited)?", "matchCount": "1", "teardown": [ "$TC qdisc del dev $DEV1 ingress" @@ -77,17 +76,16 @@ ], "plugins": { "requires": [ - "buildebpfPlugin", "nsPlugin" ] }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ko", + "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action-ebpf section action-ko", "expExitCode": "1", "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf", - "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ko\\].*tag [0-9a-f]{16}( jited)?", + "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action-ebpf:\\[action-ko\\].*tag [0-9a-f]{16}( jited)?", "matchCount": "0", "teardown": [ "$TC qdisc del dev $DEV1 ingress" diff --git a/tools/testing/selftests/tc-testing/tdc.sh b/tools/testing/selftests/tc-testing/tdc.sh index 4dbe50bde5a0..407fa53822a0 100755 --- a/tools/testing/selftests/tc-testing/tdc.sh +++ b/tools/testing/selftests/tc-testing/tdc.sh @@ -64,5 +64,5 @@ try_modprobe sch_hfsc try_modprobe sch_hhf try_modprobe sch_htb try_modprobe sch_teql -./tdc.py -J`nproc` -c actions --nobuildebpf +./tdc.py -J`nproc` -c actions ./tdc.py -J`nproc` -c qdisc From patchwork Fri Nov 24 15:42:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13467802 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20230601.gappssmtp.com header.i=@mojatatu-com.20230601.gappssmtp.com header.b="g2h4yIKc" Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9F81BD6 for ; Fri, 24 Nov 2023 07:43:51 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1cfa168faefso7195735ad.3 for ; Fri, 24 Nov 2023 07:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1700840630; x=1701445430; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=em900Y8e2LU3XRCCvv0FDkDi7n3dBJKfbFWfFC6kde4=; b=g2h4yIKcRCiGUBdbbw049JOaX8gkYOd6SQ6T99P+OMPPPXK4PkYhOiEqfOo7KGHlzG WG2vg4OwFs/9UM/2S6NXdXcyFTMN8cZhkXkXNG+q5LiSnfZ1J903q0oKmohrNRaJgpx1 15brsdrt/UOXFxb0XI6isJLmSfejVR4uv5yL0DqpmoS7ZQKSrAh0nUcS3RrFpT8UDsTC MqNYW3jLTEHwXHl4FA4VowxpvuG6iIP5UvQfzRgmWO4aeUblNNGZy7hawGgr8boDX4RR r8+kdWRQvZYkhKRneamvo+WtfRV1X6bAWKOFi1AZNA0BJH3XURWAtoLZlVnbpJ0958Uz 0xgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700840630; x=1701445430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=em900Y8e2LU3XRCCvv0FDkDi7n3dBJKfbFWfFC6kde4=; b=QFvWS1578KZXrqm0evppHQKlOR9WP3/GTIWM4D1HCeMDTqK84sNNR6I1DLeixmIS8V ctKr6rZmbx+HJWqpMPVpbpoV+MFSpr+3T5kBvEDUa063Hij1iFdpQzJ5HVfkDC/AEMIT lzyAfqv92AY2rs1lLBNF8Oap+OneUqyT4WUkXjF3B1jy3NJ9pi2EdsbYCfAE3vHJqHs2 vCYuU0QqPrABsMyS0XQX/SGGko4nmd64dT719fdUJRAg7WWl33/zt82gdKWC4NbTSBuU HXJtQcb6ezj0RVm1VP5QqwfRCBaU7byFSMcyEBVLl5sHid/qr+lje/wa/gy127wC+sMe hgoQ== X-Gm-Message-State: AOJu0Yx1JpUXgErCxI1wyoouGrp6/1NMwh01zymMq/tc4XNSg7/SSk5W wyct03RXW5DCTlby/xeZTh0OHg== X-Google-Smtp-Source: AGHT+IG0IVo5gbTJiAwdNes86R04nbY78iq46TZ/OBOFdNhXqvu3+DDy8kv81uFwc6TOrj3smBh/nA== X-Received: by 2002:a17:902:d303:b0:1cc:2f70:4865 with SMTP id b3-20020a170902d30300b001cc2f704865mr3218515plc.26.1700840630674; Fri, 24 Nov 2023 07:43:50 -0800 (PST) Received: from rogue-one.tail33bf8.ts.net ([201.17.86.134]) by smtp.gmail.com with ESMTPSA id g6-20020a170902740600b001cf9eac2d3asm1919743pll.118.2023.11.24.07.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:43:50 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Pedro Tammela Subject: [PATCH net-next 2/5] selftests: tc-testing: remove unnecessary time.sleep Date: Fri, 24 Nov 2023 12:42:45 -0300 Message-Id: <20231124154248.315470-3-pctammela@mojatatu.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124154248.315470-1-pctammela@mojatatu.com> References: <20231124154248.315470-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This operation is redundant and it's not stabilizing nor waiting for anything. Signed-off-by: Pedro Tammela --- tools/testing/selftests/tc-testing/tdc.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py index 669ec89ebfe1..c5ec861687b6 100755 --- a/tools/testing/selftests/tc-testing/tdc.py +++ b/tools/testing/selftests/tc-testing/tdc.py @@ -497,11 +497,6 @@ def prepare_run(pm, args, testlist): pm.call_post_suite(1) return emergency_exit_message - if args.verbose: - print('give test rig 2 seconds to stabilize') - - time.sleep(2) - def purge_run(pm, index): pm.call_post_suite(index) From patchwork Fri Nov 24 15:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13467803 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20230601.gappssmtp.com header.i=@mojatatu-com.20230601.gappssmtp.com header.b="B/EgoYYR" Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F380D19A5 for ; Fri, 24 Nov 2023 07:43:54 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1cf89e31773so13658055ad.0 for ; Fri, 24 Nov 2023 07:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1700840634; x=1701445434; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QI5gs5undxsY3d7gpx1BT78LGzAvxgEfNmwdo9O1W20=; b=B/EgoYYRKvl2l91cJluzrTTyKLE2J2RXV1DiS9R8oYXA7TIhoDjFvvIhTqiSRy92gh rAK002tjsdojq+mS30lHTEr/bxRRnN/y79QfNlMq/pPmK/xX9UtWj9Koai8pshiPmOOv 2OMuM/lyOqt9UhhXBFVX1Epq7P0k2WTBEPG68pB3XCkoBIhW9Qdtf1gtF4Y/YTgwfYAn 6g6cuI17Dywzn0B5ftDPcUeM8b4NzFsNTKfD9p8xDOOfyK/ti0ONUFS8CE5O1/J0qiag tvaVf5DPWiPekY5C1IAjNwMCxyk8Q2s8io3asise1DmV5Ovk74v2LWeWtltPgmESVIPx RrNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700840634; x=1701445434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QI5gs5undxsY3d7gpx1BT78LGzAvxgEfNmwdo9O1W20=; b=XujxOEc7TuAlB3lP67d29q+1N4d49KrcTrGsHa2V/QfoA6NBBgp21A3QU0cJ4SytmV YwkgNOvA7YG/Jyk3zerIz2376AkO0ucJkaEMWcukYYxyj75+VryA5hArm1eiYRmZvjiM nBZuXEFPq7+oXLwVOv+9G1GowjcS+vQ4HX2jW448RTD2sQpwQ/NrstGoPXGsw/t82YZw PKqIiOtBJLN4Oxzbq/ESViYsPLq91Nwh2qedRCg3JsIY5aGaBL//L4mi6PDZw58ox42i n7Tn6iXT2YKB7ws9w9KYeevdK5+NbI3S1GRHqJ33Gg3I3oKAcJlJqnQvtrgq0fKVQ4oj +MXA== X-Gm-Message-State: AOJu0YxWmq1+ID2TMPpKDsilolcrAC0ZRZEipe1vFsn26+sZB9c3Stuu qdWmDGJbzKSlgD6e8FvPqD8XWg== X-Google-Smtp-Source: AGHT+IHjL5+9IkJrkQHCVZiSdxWSDRWph5fyPR/F+l48erJe0XmC6bse9B75u6rGy8t52KT2Qxy76g== X-Received: by 2002:a17:903:264f:b0:1cf:6584:4860 with SMTP id je15-20020a170903264f00b001cf65844860mr2968301plb.10.1700840634435; Fri, 24 Nov 2023 07:43:54 -0800 (PST) Received: from rogue-one.tail33bf8.ts.net ([201.17.86.134]) by smtp.gmail.com with ESMTPSA id g6-20020a170902740600b001cf9eac2d3asm1919743pll.118.2023.11.24.07.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:43:54 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Pedro Tammela , Simon Horman Subject: [PATCH net-next 3/5] selftests: tc-testing: prefix iproute2 functions with "ipr2" Date: Fri, 24 Nov 2023 12:42:46 -0300 Message-Id: <20231124154248.315470-4-pctammela@mojatatu.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124154248.315470-1-pctammela@mojatatu.com> References: <20231124154248.315470-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As suggested by Simon, prefix the functions that operate on iproute2 commands in contrast with the "nl" netlink prefix. Cc: Simon Horman Signed-off-by: Pedro Tammela --- .../selftests/tc-testing/plugin-lib/nsPlugin.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py index 65c8f3f983b9..dc7a0597cf44 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py @@ -37,7 +37,7 @@ class SubPlugin(TdcPlugin): if netlink == True: self._nl_ns_create() else: - self._ns_create() + self._ipr2_ns_create() # Make sure the netns is visible in the fs ticks = 20 @@ -71,7 +71,7 @@ class SubPlugin(TdcPlugin): if netlink == True: self._nl_ns_destroy() else: - self._ns_destroy() + self._ipr2_ns_destroy() def post_suite(self, index): if self.args.verbose: @@ -161,7 +161,7 @@ class SubPlugin(TdcPlugin): ticks -= 1 continue - def _ns_create_cmds(self): + def _ipr2_ns_create_cmds(self): cmds = [] ns = self.args.NAMES['NS'] @@ -181,26 +181,26 @@ class SubPlugin(TdcPlugin): return cmds - def _ns_create(self): + def _ipr2_ns_create(self): ''' Create the network namespace in which the tests will be run and set up the required network devices for it. ''' - self._exec_cmd_batched('pre', self._ns_create_cmds()) + self._exec_cmd_batched('pre', self._ipr2_ns_create_cmds()) def _nl_ns_destroy(self): ns = self.args.NAMES['NS'] netns.remove(ns) - def _ns_destroy_cmd(self): + def _ipr2_ns_destroy_cmd(self): return self._replace_keywords('netns delete {}'.format(self.args.NAMES['NS'])) - def _ns_destroy(self): + def _ipr2_ns_destroy(self): ''' Destroy the network namespace for testing (and any associated network devices as well) ''' - self._exec_cmd('post', self._ns_destroy_cmd()) + self._exec_cmd('post', self._ipr2_ns_destroy_cmd()) @cached_property def _proc(self): From patchwork Fri Nov 24 15:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13467804 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20230601.gappssmtp.com header.i=@mojatatu-com.20230601.gappssmtp.com header.b="qam3F906" Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD7CE1BCD for ; Fri, 24 Nov 2023 07:44:00 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1cf80a7be0aso16743565ad.1 for ; Fri, 24 Nov 2023 07:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1700840640; x=1701445440; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=meBAQ3i5bzteTDjsadEVqP3IdyNZUBxruoeAMf+7W4k=; b=qam3F906LMRyLWAhhlGWfMRMmxHneO5O/2B11kLv9M99EnjJsSBqlyeT6HrIQG2ZDi XYNegTrx04O1mZE+NHyQngFQsXa/HUPrlynIF1aOHzQQKIo8TcJzp1K6GqoHqzsnz1g2 m+QEr1ilS5wPIJanPxwRPhRksHsUz9EQ+XY/8xH38V2ZCKo2UdT79w5lLlDOm5kpjsTQ 2Uwjv2wbpZM4DL96f8EgAwuUcrXJq3WZarkgyPWHywtxZlSP6oDcCco3WpQsxEPAkByd LO1mluHnyFntGE4yBztOSXI1DV8U5qxGTgdCiePbHxRi0wJxOiNDo1TxyJRUXBjhs1AQ HclQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700840640; x=1701445440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=meBAQ3i5bzteTDjsadEVqP3IdyNZUBxruoeAMf+7W4k=; b=VVLOPLq9c5iqjn5yq4CM0B+oUFBQxPzwi885GT9VYEcmor25RtlUT/hJh3kbxYN0Ti 4WXF+vzhIPuJMAKk3QsuLGoEI+Da38ZOWM8t4pDX95FA0AfHvFN+kdRCYu0SQ6GZ6mQf 5LQLrq9tS1NAD2lzg0krSYoefBlY5GePFzSNtRCUyniJPMSJGFn8ifyAe+ium2lnbUiq PoEgRH4L46HDKIlm/7cJfYLenitc0BN1xno34Q9b2b67QN65mU69YOaGqnNurA7y2AwS h2YvMkhIPLw/GWy/5b3N/kIGvadn5OCcOLGV+n/15CS5mb2A/sfhIzpCwEM78D9Q4gCy GCgA== X-Gm-Message-State: AOJu0YyNr7qO+lqWxWaN5Gv2WY/SLP0hTOZMyj101DMUhE94SE1OGLzd JmCSyMxhJD2Be+pzflUMcdPV4g== X-Google-Smtp-Source: AGHT+IEI/gV9/wjUMlivgVIkBGWHfGfGb1pfZNnDlb9nUwelvrY0VHUqAQAEdEhIc9BPVn6KNayM2w== X-Received: by 2002:a17:902:e752:b0:1cf:6aae:5998 with SMTP id p18-20020a170902e75200b001cf6aae5998mr4296165plf.0.1700840638351; Fri, 24 Nov 2023 07:43:58 -0800 (PST) Received: from rogue-one.tail33bf8.ts.net ([201.17.86.134]) by smtp.gmail.com with ESMTPSA id g6-20020a170902740600b001cf9eac2d3asm1919743pll.118.2023.11.24.07.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:43:57 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Pedro Tammela Subject: [PATCH net-next 4/5] selftests: tc-testing: cleanup on Ctrl-C Date: Fri, 24 Nov 2023 12:42:47 -0300 Message-Id: <20231124154248.315470-5-pctammela@mojatatu.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124154248.315470-1-pctammela@mojatatu.com> References: <20231124154248.315470-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Cleanup net namespaces and other resources if we get a SIGINT (Ctrl-C). As user visible resources are allocated on a per test basis, it's only required to catch this condition when (possibly) running tests. So far calling post_suite is enough to free up anything that might linger. A missing keyword replacement for nsPlugin is also included. Signed-off-by: Pedro Tammela --- tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py | 2 +- tools/testing/selftests/tc-testing/tdc.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py index dc7a0597cf44..77b1106b8388 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py @@ -78,7 +78,7 @@ class SubPlugin(TdcPlugin): print('{}.post_suite'.format(self.sub_class)) # Make sure we don't leak resources - cmd = "$IP -a netns del" + cmd = self._replace_keywords("$IP -a netns del") if self.args.verbose > 3: print('_exec_cmd: command "{}"'.format(cmd)) diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py index c5ec861687b6..caeacc691587 100755 --- a/tools/testing/selftests/tc-testing/tdc.py +++ b/tools/testing/selftests/tc-testing/tdc.py @@ -1018,7 +1018,11 @@ def main(): if args.verbose > 2: print('args is {}'.format(args)) - set_operation_mode(pm, parser, args, remaining) + try: + set_operation_mode(pm, parser, args, remaining) + except KeyboardInterrupt: + # Cleanup on Ctrl-C + pm.call_post_suite(None) if __name__ == "__main__": main() From patchwork Fri Nov 24 15:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13467805 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20230601.gappssmtp.com header.i=@mojatatu-com.20230601.gappssmtp.com header.b="EvJvufEG" Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672DA1BC3 for ; Fri, 24 Nov 2023 07:44:04 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cfa71b6029so4085105ad.1 for ; Fri, 24 Nov 2023 07:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1700840644; x=1701445444; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XxH4h/fUgyjGMKXsAUdrvTbwQh/c4Jyei7tUpRPE518=; b=EvJvufEGOk2ljoM/xXOhxSCw9Ssx7QlYUP4qjwlIzigo8y3MO6y/ipzVHg6zfDd8Wj WtIe8+0NEeczc/8T9VzzpHZSRibjuvgLoYxONFJzloZWWeap0dp9Q/8g3HhczLPjIqIE VF51yzwv9MhRBOc0IZcCOY8rACxuctZqnLUmXeUp2aHKZ3NmInpCLFM4qgUkmQUN+lLk crcSR5GiIfv+1TX4u1tZ9f/aN9MkznY8g/pHbjvB9vBIiiooJPxGYMHPb/Vg1SJ/MSMT ltZdz18AJlF41sI0qEYZrtNgcGalP8LUu0VoRuSqtOb5RPiyaipSu+mDzgRh1z8x8QWJ W/vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700840644; x=1701445444; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XxH4h/fUgyjGMKXsAUdrvTbwQh/c4Jyei7tUpRPE518=; b=LCPI9DRQVEafMyvIV9ELpYGPj61TcZl6jPUlAC8mAhMUAuP4zI39XA0FH+FJVUcuMC dTe+cDzR5sMswa15DsPw1z6bJtaQu2dd/u9CAvt3eVummmEaBKfpmNW7A3uaQiHBTY98 RrCOFm5vf/zQqUfsQx3g2NaLNYfiOPrcjSTnNQcdL06424EqUIoQDI/rxukHAdAo9dNc 5khptiVZp0qBKfj+U3dTVvu/qrKzKDQTzPyia1eAnkTbKD6G3ck5PmO8Nbpf10oS5Kj/ 1V4tLeo0jjcXZqG4ggyBPKPP6rGQK0D307PtONMbP+2iCxVsqbfLr0yM4OZ+smk3qIp8 EnjQ== X-Gm-Message-State: AOJu0YyLmPvV38ifPtKxNTNFXvd4BsPi01trPJLMwulBzGJCK0S058Hs 0cAVZZZJh0hAzkcjogC4up1iDw== X-Google-Smtp-Source: AGHT+IESTfwIV1Y4e9dxiuOb6Fx6zh8dfzPm+t7NgGLnsuKfIve4gS4FKHwaEbYY0Jg2cMPODWHT/A== X-Received: by 2002:a17:902:7d8a:b0:1c9:ca02:645c with SMTP id a10-20020a1709027d8a00b001c9ca02645cmr2977675plm.36.1700840643802; Fri, 24 Nov 2023 07:44:03 -0800 (PST) Received: from rogue-one.tail33bf8.ts.net ([201.17.86.134]) by smtp.gmail.com with ESMTPSA id g6-20020a170902740600b001cf9eac2d3asm1919743pll.118.2023.11.24.07.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:44:03 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Pedro Tammela Subject: [PATCH net-next 5/5] selftests: tc-testing: remove unused import Date: Fri, 24 Nov 2023 12:42:48 -0300 Message-Id: <20231124154248.315470-6-pctammela@mojatatu.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124154248.315470-1-pctammela@mojatatu.com> References: <20231124154248.315470-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove this leftover from the times we pre-allocated everything Signed-off-by: Pedro Tammela --- tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py index 77b1106b8388..bb19b8b76d3b 100644 --- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py +++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py @@ -23,8 +23,6 @@ class SubPlugin(TdcPlugin): super().__init__() def pre_suite(self, testcount, testlist): - from itertools import cycle - super().pre_suite(testcount, testlist) def prepare_test(self, test):