diff mbox series

[for-next,7/7] selftests/net: Fix ./ns-XXXXXX not cleanup

Message ID 20241025014010.6533-7-lizhijian@fujitsu.com (mailing list archive)
State New
Headers show
Series [for-next,1/7] selftests/alsa: Add a few missing gitignore files | expand

Commit Message

Zhijian Li (Fujitsu) Oct. 25, 2024, 1:40 a.m. UTC
```
readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
readonly BASE=`basename $STATS`
```
It could be a mistake to write to $BASE rather than $STATS, where $STATS
is used to save the NSTAT_HISTORY and it will be cleaned up before exit.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
Cc: netdev@vger.kernel.org

---
Hello,
Cover letter is here.

This patch set aims to make 'git status' clear after 'make' and 'make
run_tests' for kselftests.
---
V2: nothing change
---
 tools/testing/selftests/net/veth.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Oct. 29, 2024, 11:43 p.m. UTC | #1
On Fri, 25 Oct 2024 09:40:10 +0800 Li Zhijian wrote:
> ```
> readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
> readonly BASE=`basename $STATS`
> ```
> It could be a mistake to write to $BASE rather than $STATS, where $STATS
> is used to save the NSTAT_HISTORY and it will be cleaned up before exit.

Agreed, although since we've been creating the wrong file this whole
time and everything worked -- should we just just delete those two
lines completely?

Similarly to patch 6 - please repost as a standalone patch so that our
CI will test it. If you only CC a mailing list on subset of patches
they are likely to be ignored by automation..
Jakub Kicinski Oct. 29, 2024, 11:43 p.m. UTC | #2
On Tue, 29 Oct 2024 16:43:06 -0700 Jakub Kicinski wrote:
> Similarly to patch 6 

I meant patch 4, not patch 6
Zhijian Li (Fujitsu) Oct. 30, 2024, 12:54 a.m. UTC | #3
On 30/10/2024 07:43, Jakub Kicinski wrote:
> On Fri, 25 Oct 2024 09:40:10 +0800 Li Zhijian wrote:
>> ```
>> readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
>> readonly BASE=`basename $STATS`
>> ```
>> It could be a mistake to write to $BASE rather than $STATS, where $STATS
>> is used to save the NSTAT_HISTORY and it will be cleaned up before exit.
> 
> Agreed, although since we've been creating the wrong file this whole
> time and everything worked
>-- should we just just delete those two lines completely?

Yes, it also works.


> 
> Similarly to patch 6 - please repost as a standalone patch so that our
> CI will test it. If you only CC a mailing list on subset of patches
> they are likely to be ignored by automation..

Got it

Thanks
Zhijian
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index 4f1edbafb946..457312ef135a 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -46,8 +46,8 @@  create_ns() {
 		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
 		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
 	done
-	echo "#kernel" > $BASE
-	chmod go-rw $BASE
+	echo "#kernel" > $STATS
+	chmod go-rw $STATS
 }
 
 __chk_flag() {