public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH v5 05/14] test: Move passt_test_log_pipe to state directory
Date: Tue, 13 Sep 2022 14:35:20 +1000	[thread overview]
Message-ID: <20220913043529.3079003-6-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220913043529.3079003-1-david@gibson.dropbear.id.au>

[-- Attachment #1: Type: text/plain, Size: 5953 bytes --]

We use this fifo to send messages to the information pane.  Put it in the
state directory so it doesn't need its own cleanup.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/lib/layout | 16 ++++++++--------
 test/lib/term   | 12 ++++++------
 test/run        |  7 ++-----
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/test/lib/layout b/test/lib/layout
index cc7c688..cf319bf 100644
--- a/test/lib/layout
+++ b/test/lib/layout
@@ -27,7 +27,7 @@ layout_host() {
 
 	get_info_cols
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T "test log"
 
@@ -61,7 +61,7 @@ layout_pasta() {
 
 	get_info_cols
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T "test log"
 
@@ -92,7 +92,7 @@ layout_passt() {
 
 	get_info_cols
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T "test log"
 
@@ -128,7 +128,7 @@ layout_passt_in_pasta() {
 	pane_watch_contexts ${PANE_GUEST} "guest" qemu guest
 	pane_watch_contexts ${PANE_NS} "namespace" ns
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T "test log"
 
@@ -171,7 +171,7 @@ layout_two_guests() {
 	pane_watch_contexts ${PANE_GUEST_1} "guest #1 in namespace #1" qemu_1 guest_1
 	pane_watch_contexts ${PANE_GUEST_2} "guest #2 in namespace #2" qemu_2 guest_2
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T "test log"
 
@@ -207,7 +207,7 @@ layout_demo_pasta() {
 	tmux pipe-pane -O -t ${PANE_NS} "cat >> ${LOGDIR}/pane_ns.log"
 	tmux select-pane -t ${PANE_NS} -T "namespace"
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T ""
 
@@ -243,7 +243,7 @@ layout_demo_passt() {
 	tmux pipe-pane -O -t ${PANE_GUEST} "cat >> ${LOGDIR}/pane_guest.log"
 	tmux select-pane -t ${PANE_GUEST} -T "guest"
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T ""
 
@@ -282,7 +282,7 @@ layout_demo_podman() {
 	tmux pipe-pane -O -t ${PANE_NS2} "cat >> ${LOGDIR}/pane_ns2.log"
 	tmux select-pane -t ${PANE_NS2} -T "Podman with pasta"
 
-	tmux send-keys -l -t ${PANE_INFO} 'while cat /tmp/.passt_test_log_pipe; do :; done'
+	tmux send-keys -l -t ${PANE_INFO} 'while cat '"$STATEBASE/log_pipe"'; do :; done'
 	tmux send-keys -t ${PANE_INFO} -N 100 C-m
 	tmux select-pane -t ${PANE_INFO} -T ""
 
diff --git a/test/lib/term b/test/lib/term
index 8b8ad56..9a3ef7f 100755
--- a/test/lib/term
+++ b/test/lib/term
@@ -31,7 +31,7 @@ PR_DELAY_INIT=100 # ms
 # $@:	Message to print
 info() {
 	tmux select-pane -t ${PANE_INFO}
-	echo "${@}" >> /tmp/.passt_test_log_pipe
+	echo "${@}" >> $STATEBASE/log_pipe
 	echo "${@}" >> "${LOGFILE}"
 }
 
@@ -39,7 +39,7 @@ info() {
 # $@:	Message to print
 info_n() {
 	tmux select-pane -t ${PANE_INFO}
-	printf "${@}" >> /tmp/.passt_test_log_pipe
+	printf "${@}" >> $STATEBASE/log_pipe
 	printf "${@}" >> "${LOGFILE}"
 }
 
@@ -47,7 +47,7 @@ info_n() {
 # $@:	Message to print
 info_nolog() {
 	tmux select-pane -t ${PANE_INFO}
-	echo "${@}" >> /tmp/.passt_test_log_pipe
+	echo "${@}" >> $STATEBASE/log_pipe
 }
 
 # info_nolog() - Print message to log file
@@ -365,7 +365,7 @@ status_test_start() {
 info_check() {
 	switch_pane ${PANE_INFO}
 
-	printf "${PR_YELLOW}?${PR_NC} ${@}" >> /tmp/.passt_test_log_pipe
+	printf "${PR_YELLOW}?${PR_NC} ${@}" >> $STATEBASE/log_pipe
 	printf "? ${@}" >> "${LOGFILE}"
 }
 
@@ -373,7 +373,7 @@ info_check() {
 info_check_passed() {
 	switch_pane ${PANE_INFO}
 
-	printf "\n" >> /tmp/.passt_test_log_pipe
+	printf "\n" >> $STATEBASE/log_pipe
 	printf "\n" >> ${LOGFILE}
 }
 
@@ -381,7 +381,7 @@ info_check_passed() {
 info_check_failed() {
 	switch_pane ${PANE_INFO}
 
-	printf " ${PR_RED}!${PR_NC}\n" >> /tmp/.passt_test_log_pipe
+	printf " ${PR_RED}!${PR_NC}\n" >> $STATEBASE/log_pipe
 	printf " < failed.\n" >> "${LOGFILE}"
 }
 
diff --git a/test/run b/test/run
index 58d9b49..4bb9cd8 100755
--- a/test/run
+++ b/test/run
@@ -49,13 +49,11 @@ COMMIT="$(git log --oneline --no-decorate -1)"
 # cleanup() - Remove temporary files
 cleanup() {
 	[ ${DEBUG} -eq 1 ] || rm -rf "${STATEBASE}"
-	rm -f /tmp/.passt_test_log_pipe
 }
 
 # run() - Call setup functions, run tests, handle exit from test session
 run() {
-	rm -f /tmp/.passt_test_log_pipe
-	mkfifo /tmp/.passt_test_log_pipe
+	mkfifo $STATEBASE/log_pipe
 
 	term
 	perf_init
@@ -131,8 +129,7 @@ run() {
 
 # demo() - Simpler path for demo purposes
 demo() {
-	rm -f /tmp/.passt_test_log_pipe
-	mkfifo /tmp/.passt_test_log_pipe
+	mkfifo $STATEBASE/log_pipe
 
 	FAST=0
 
-- 
@@ -49,13 +49,11 @@ COMMIT="$(git log --oneline --no-decorate -1)"
 # cleanup() - Remove temporary files
 cleanup() {
 	[ ${DEBUG} -eq 1 ] || rm -rf "${STATEBASE}"
-	rm -f /tmp/.passt_test_log_pipe
 }
 
 # run() - Call setup functions, run tests, handle exit from test session
 run() {
-	rm -f /tmp/.passt_test_log_pipe
-	mkfifo /tmp/.passt_test_log_pipe
+	mkfifo $STATEBASE/log_pipe
 
 	term
 	perf_init
@@ -131,8 +129,7 @@ run() {
 
 # demo() - Simpler path for demo purposes
 demo() {
-	rm -f /tmp/.passt_test_log_pipe
-	mkfifo /tmp/.passt_test_log_pipe
+	mkfifo $STATEBASE/log_pipe
 
 	FAST=0
 
-- 
2.37.3


  parent reply	other threads:[~2022-09-13  4:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  4:35 [PATCH v5 00/14] Improve handling of test temporary files David Gibson
2022-09-13  4:35 ` [PATCH v5 01/14] test: Group tests by mode then protocol, rather than the reverse David Gibson
2022-09-13  4:35 ` [PATCH v5 02/14] test: Remove unused variable FFMPEG_PID_FILE David Gibson
2022-09-13  4:35 ` [PATCH v5 03/14] test: Actually run cleanup function David Gibson
2022-09-13  4:35 ` [PATCH v5 04/14] test: Create common state directories for temporary files David Gibson
2022-09-13  4:35 ` David Gibson [this message]
2022-09-13  4:35 ` [PATCH v5 06/14] test: Move context temporary files to state dir David Gibson
2022-09-13  4:35 ` [PATCH v5 07/14] test: Don't redundantly regenerate small test file in pasta/tcp David Gibson
2022-09-13  4:35 ` [PATCH v5 08/14] test: Use paths in __STATEDIR__ instead of 'temp' and 'tempdir' directives David Gibson
2022-09-13  4:35 ` [PATCH v5 09/14] test: Move pause temporary file to state directory David Gibson
2022-09-13  4:35 ` [PATCH v5 10/14] test: Store pcap files in $LOGDIR instead of /tmp David Gibson
2022-09-13  4:35 ` [PATCH v5 11/14] test: Move pidfiles and nsholder sockets into state directory David Gibson
2022-09-13  4:35 ` [PATCH v5 12/14] demo: Move pidfiles to " David Gibson
2022-09-13  4:35 ` [PATCH v5 13/14] test: Move video processing files to $STATEBASE David Gibson
2022-09-13  4:35 ` [PATCH v5 14/14] test: Move perf.js report file to $LOGDIR/web David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220913043529.3079003-6-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).