selftests: rds: Fix stale log clean up

Since rds self tests no longer has a default folder, users must
specify a log collection folder if they want to collect logs.
Currently the log folder is deleted and recreated, but this can
be dangerous if the user exports RDS_LOG_DIR=/tmp or /var/log.
This patch corrects the clean up to delete only rds log artifacts
from the log folder, and further prefixes rds specific logs as rds*

Signed-off-by: Allison Henderson <achender@kernel.org>
Link: https://patch.msgid.link/20260507233213.556182-2-achender@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Allison Henderson 2026-05-07 16:32:11 -07:00 committed by Jakub Kicinski
parent bb3402f3df
commit 4840467c84
2 changed files with 8 additions and 4 deletions

View File

@ -189,17 +189,21 @@ check_gcov_conf
TRACE_CMD=()
if [[ -n "$LOG_DIR" ]]; then
rm -fr "$LOG_DIR"
FLAGS+=("-d" "$LOG_DIR")
TRACE_FILE="${LOG_DIR}/rds-strace.txt"
COVR_DIR="${LOG_DIR}/coverage/"
DMESG_FILE="${LOG_DIR}/rds-dmesg.out"
mkdir -p "$LOG_DIR"
mkdir -p "$COVR_DIR"
echo "#Traces will be logged to ${TRACE_FILE}"
rm -f "$TRACE_FILE"
rm -f "$DMESG_FILE"
rm -f "$LOG_DIR"/rds-*.pcap
rm -f "$COVR_DIR"/gcovr*
echo "# Traces will be logged to ${TRACE_FILE}"
TRACE_CMD=(strace -T -tt -o "${TRACE_FILE}")
fi
@ -210,7 +214,7 @@ echo "#running RDS tests..."
test_rc=$?
if [[ -n "$LOG_DIR" ]]; then
dmesg > "${LOG_DIR}/dmesg.out"
dmesg > "${DMESG_FILE}"
fi
if [[ -n "$LOG_DIR" ]] && [ "$GENERATE_GCOV_REPORT" -eq 1 ]; then

View File

@ -151,7 +151,7 @@ tcpdump_procs = []
# Start a packet capture on each network
if logdir is not None:
for net in [NET0, NET1]:
pcap = logdir+'/'+net+'.pcap'
pcap = logdir+'/rds-'+net+'.pcap'
tcpdump_cmd = ['ip', 'netns', 'exec', net, '/usr/sbin/tcpdump']
sudo_user = os.environ.get('SUDO_USER')