🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3068

[PATCH net-next] selftests: net: exit with test failure status

#3068
From: Hangbin Liu
Date: Wed, 14 Oct 2026 05:32
84 lines
8200 bytes
From: Hangbin Liu <liuhangbin@kylinos.cn>

fdb_flush.sh, fib-onlink-tests.sh and l2tp.sh can print [FAIL]
subtests while still exiting with status 0. Their log_test(), aka
log_test_expected() in lib.sh, helpers record a failure in ret, but
the scripts never propagate ret to the exit code, so a kselftest runner
treats the run as a pass.

Initialize ret and exit with it at the end of each script so failed
subtests are reflected in the exit status.

Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
The patch doesn't fix a regression, nothing is failing (or passing when it
shouldn't) because of it. So target the patch to net-next.
---
 tools/testing/selftests/net/fdb_flush.sh        | 3 +++
 tools/testing/selftests/net/fib-onlink-tests.sh | 3 +++
 tools/testing/selftests/net/l2tp.sh             | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/tools/testing/selftests/net/fdb_flush.sh b/tools/testing/selftests/net/fdb_flush.sh
index 4965e52d5ef5..0827fdd60f8c 100755
--- a/tools/testing/selftests/net/fdb_flush.sh
+++ b/tools/testing/selftests/net/fdb_flush.sh
@@ -6,6 +6,7 @@
 # some combinations of arguments.
 
 source lib.sh
+ret=0
 
 FLUSH_BY_STATE_TESTS="
 	vxlan_test_flush_by_permanent
@@ -778,3 +779,5 @@ for t in $TESTS
 do
 	setup; $t; cleanup;
 done
+
+exit $ret
diff --git a/tools/testing/selftests/net/fib-onlink-tests.sh b/tools/testing/selftests/net/fib-onlink-tests.sh
index a26075abf7d2..325da693c918 100755
--- a/tools/testing/selftests/net/fib-onlink-tests.sh
+++ b/tools/testing/selftests/net/fib-onlink-tests.sh
@@ -6,6 +6,7 @@
 source lib.sh
 PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
 VERBOSE=0
+ret=0
 
 # Network interfaces
 # - odd in current namespace; even in peer ns
@@ -473,3 +474,5 @@ if [ "$TESTS" != "none" ]; then
 	printf "\nTests passed: %3d\n" ${nsuccess}
 	printf "Tests failed: %3d\n"   ${nfail}
 fi
+
+exit $ret
diff --git a/tools/testing/selftests/net/l2tp.sh b/tools/testing/selftests/net/l2tp.sh
index 41e8b19d1bd3..de4b5da2da1b 100755
--- a/tools/testing/selftests/net/l2tp.sh
+++ b/tools/testing/selftests/net/l2tp.sh
@@ -16,6 +16,7 @@
 source lib.sh
 VERBOSE=0
 PAUSE_ON_FAIL=no
+ret=0
 
 which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
 
@@ -357,3 +358,5 @@ cleanup
 
 printf "\nTests passed: %3d\n" ${nsuccess}
 printf "Tests failed: %3d\n"   ${nfail}
+
+exit $ret

---
base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
change-id: 20261014-self_ret-83b030f32ba3

Best regards,
-- 
Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID: <20261014-self_ret-v1-1-6b5a95ba6106@kylinos.cn>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346027-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346027-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next] selftests: net: exit with test failure status
Date: Wed, 14 Oct 2026 13:32:24 +0800
Organization: Usenet Network
Message-ID: <20261014-self_ret-v1-1-6b5a95ba6106@kylinos.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2224980"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:rqIoZuPeo4kyx9dX2gZwieT6rzU= sha256:JAKGGrgzjZxoeyVl4mus8MVgFWhRvxkHH7JeuLrd+pM=
	sha1:WxW3NNyO4Z1/vMeNmd79CKsM19I= sha256:4otEdNB4nWM4XbXUw4Nv/H6J7Fe/kGVjl6mKzEw4lDY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 5D48010FFDE; Wed, 14 Oct 2026 08:33:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id WE8luK6uaARr;
	Wed, 14 Oct 2026 08:32:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-346027-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 3BDAC10FFDF; Wed, 14 Oct 2026 08:32:46 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sto.lore.kernel.org (Postfix) with ESMTP id 305EF609C08; Wed, 14 Oct 2026 05:32:45 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C7F2740F744;
	Wed, 14 Oct 2026 05:32:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="U6RqeYfQ"
X-Received: from mta0.migadu.com (out-8.mta0.migadu.com [91.218.175.8])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E68FD2F12AB
	for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 05:32:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.8
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791955964; cv=none; b=LN4ehgD0HKZwHAYy/kxbIcrfmr3m7itCFoBy5ZRXuqKLddrkZnFgrx+NmoLgOEDGwhaj0mekpfZbant2jDo8Y9t4DDwGjUy71j26hursonn7qXVsiDgkwLmP8sJtVeOHILW/uZONFNl88KvfKuagfNISOzt/p+AbS+ic23j05Ys=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791955964; c=relaxed/simple;
	bh=DeeQ1mnSlJJadwW9+vWEJShMOdLCTlYD4T0We+pBlNo=;
	h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=pg9sqbuJA0xnNNcxSoHR6DQtJpjMYxuSi08cmA4QsD7FyG82kBQsBxTnN8yBs50sUV/jlwvh+VoXHnccEJfhHQjKlgI/K7HFpwYlQnOA+rcNMDtI4K5sGsDwqfzvkG//Gmm35BIeRSdnyYypC8MbljKGAzcjsVvyGez3DwGsNvk=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=U6RqeYfQ; arc=none smtp.client-ip=91.218.175.8
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=DeeQ1mnSlJJadwW9+vWEJShMOdLCTlYD4T0We+pBlNo=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1791955960; v=1; x=1792560760;
 b=U6RqeYfQsa9t8wcGp8m2XqD4BFIwN3noHxt+ui1QMNky1qOcLUTGIpQP8c9S96r+DEeAo4cD
 pi0/F/aykZmwCCeWKINE0jRj8HV2StoSlH6NZi8HWGdAVsApDiP3cVI1s9jwZbXmrP94M/CFWPl
 M7FujYHPWrzRM495bG4c7Au8=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id 172f82703bb1138b;
	Wed, 14 Oct 2026 05:32:39 +0000
X-Mizu-Trace-ID: 172f82703bb1138b
X-Migadu-Flow: FLOW_OUT
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MWwqAIBBA0a3IfCf4iIi2EhFaYw2EhUoI4t6TP
 i8cboGIgTDCxAoEfCnS7VvIjsF2Gn8gp701KKEGKWTPI15uDZj4qK3QwmlljYbGn4CO8r+awTf
 gMSdYav0AissFWWQAAAA=
X-Change-ID: 20261014-self_ret-83b030f32ba3
X-Cc: Hangbin Liu <hangbin.liu@linux.dev>, netdev@vger.kernel.org, 
 linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, 
 Hangbin Liu <liuhangbin@kylinos.cn>
X-Mailer: b4 0.14.3