Thread (12 messages) flat view 12 messages, 2 authors, 2026-05-06
STALE125d

Revision v3 of 2 in this series.

Revisions (2)
  1. v2 [diff vs current]
  2. v3 current

[PATCH net-next v3 07/10] selftests: rds: Remove tmp pcaps

From: Allison Henderson <achender@kernel.org>
Date: 2026-05-04 05:41:49
Also in: linux-kselftest, linux-rdma
Subsystem: kernel selftest framework, networking [general], rds - reliable datagram sockets, the rest · Maintainers: Shuah Khan, Shuah Khan, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Allison Henderson, Linus Torvalds

This patch removes the initial tmp tcpdumps and instead saves
the pcaps directly to the logdir if it is set.

Signed-off-by: Allison Henderson <achender@kernel.org>
---
 tools/testing/selftests/net/rds/test.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
index 7a3616ac288f..a7be57ef6ece 100755
--- a/tools/testing/selftests/net/rds/test.py
+++ b/tools/testing/selftests/net/rds/test.py
@@ -14,8 +14,6 @@ import signal
 import socket
 import subprocess
 import sys
-import tempfile
-import shutil
 
 # Allow utils module to be imported from different directory
 this_dir = os.path.dirname(os.path.realpath(__file__))
@@ -133,17 +131,16 @@ tcpdump_procs = []
 if logdir is not None:
     for net in [NET0, NET1]:
         pcap = logdir+'/'+net+'.pcap'
-        fd, pcap_tmp = tempfile.mkstemp(suffix=".pcap", prefix=f"{net}-", dir="/tmp")
 
         tcpdump_cmd = ['ip', 'netns', 'exec', net, '/usr/sbin/tcpdump']
         sudo_user = os.environ.get('SUDO_USER')
         if sudo_user:
             tcpdump_cmd.extend(['-Z', sudo_user])
-        tcpdump_cmd.extend(['-i', 'any', '-w', pcap_tmp])
+        tcpdump_cmd.extend(['-i', 'any', '-w', pcap])
 
         # pylint: disable-next=consider-using-with
         p = subprocess.Popen(tcpdump_cmd)
-        tcpdump_procs.append((p, pcap_tmp, pcap, fd))
+        tcpdump_procs.append(p)
 
 # simulate packet loss, duplication and corruption
 for net, iface in [(NET0, VETH0), (NET1, VETH1)]:
@@ -260,11 +257,9 @@ print(f"getsockopt(): {nr_success}/{nr_error}")
 
 if logdir is not None:
     print("Stopping network packet captures")
-    for p, pcap_tmp, pcap, fd in tcpdump_procs:
+    for p in tcpdump_procs:
         p.terminate()
         p.wait()
-        os.close(fd)
-        shutil.move(pcap_tmp, pcap)
 
 # We're done sending and receiving stuff, now let's check if what
 # we received is what we sent.
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help