Re: [PATCH nft v3 2/6] tests/shell: check and generate JSON dump files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2023-11-16 at 17:10 +0100, Pablo Neira Ayuso wrote:
> It seems that handles are a problem in this diff.


Hi,


It's a bit surprising that this happens. Do you use unshare (the
default), to create a separate netns for each test? For me, those
handles then grow incrementally from 1. 


A possible workaround would be the following (and a `DUMPGEN=y` run)



diff --git c/tests/shell/helpers/json-sanitize-ruleset.sh w/tests/shell/helpers/json-sanitize-ruleset.sh
index 270a6107e0aa..22a57d72110e 100755
--- c/tests/shell/helpers/json-sanitize-ruleset.sh
+++ w/tests/shell/helpers/json-sanitize-ruleset.sh
@@ -6,7 +6,12 @@ die() {
 }
 
 do_sed() {
-	sed '1s/\({"nftables": \[{"metainfo": {"version": "\)[0-9.]\+\(", "release_name": "\)[^"]\+\(", "\)/\1VERSION\2RELEASE_NAME\3/' "$@"
+	# Also normalize all "handle". Optimally, those handles would be stable
+	# and reproducible. However, they are not.
+	sed \
+		-e '1s/\({"nftables": \[{"metainfo": {"version": "\)[0-9.]\+\(", "release_name": "\)[^"]\+\(", "\)/\1VERSION\2RELEASE_NAME\3/' \
+		-e '1s/"handle": [0-9]\+\>/"handle": 1/g' \
+		"$@"
 }
 
 if [ "$#" = 0 ] ; then








[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux