aboutgitcodebugslistschat
path: root/test/lib
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-02-21 13:35:45 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-02-22 18:34:44 +0100
commitbe2a7898e9de236da7c42d1fb37a5a2017ac192b (patch)
tree76f84351d597a0a1c78699d77f1039f9c2788b82 /test/lib
parente17731ba97e32a52c797023b4563a261f71dd6aa (diff)
downloadpasst-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar.gz
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar.bz2
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar.lz
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar.xz
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.tar.zst
passt-be2a7898e9de236da7c42d1fb37a5a2017ac192b.zip
test: Add demo for Podman with pasta
...showing setup steps, some peculiarities as --net option, and a general side-to-side comparison with slirp4netns(1), including "quick" TCP and UDP throughput and latency benchmarks. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/layout38
-rwxr-xr-xtest/lib/setup21
-rwxr-xr-xtest/lib/term10
-rwxr-xr-xtest/lib/test35
4 files changed, 101 insertions, 3 deletions
diff --git a/test/lib/layout b/test/lib/layout
index 7802dac..2d6b197 100644
--- a/test/lib/layout
+++ b/test/lib/layout
@@ -207,7 +207,6 @@ layout_two_guests() {
layout_demo_pasta() {
sleep 3
- tmux kill-pane -a -t 0
cmd_write 0 cd ${BASEPATH}
cmd_write 0 clear
sleep 1
@@ -244,7 +243,6 @@ layout_demo_pasta() {
layout_demo_passt() {
sleep 3
- tmux kill-pane -a -t 0
cmd_write 0 cd ${BASEPATH}
cmd_write 0 clear
sleep 1
@@ -276,3 +274,39 @@ layout_demo_passt() {
sleep 1
}
+
+# layout_demo_podman() - Four panes for pasta demo with Podman
+layout_demo_podman() {
+ sleep 3
+
+ cmd_write 0 cd ${BASEPATH}
+ cmd_write 0 clear
+ sleep 1
+ cmd_write 0 clear
+
+ tmux split-window -v -l '65%' -t passt_test
+ tmux split-window -h -t passt_test
+ tmux split-window -h -l '42%' -t passt_test:1.0
+
+ PANE_HOST=0
+ PANE_INFO=1
+ PANE_NS1=2
+ PANE_NS2=3
+
+ get_info_cols
+
+ tmux pipe-pane -O -t ${PANE_NS1} "cat >> ${LOGDIR}/pane_ns1.log"
+ tmux select-pane -t ${PANE_NS1} -T "Podman with slirp4netns"
+
+ 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 -t ${PANE_INFO} -N 100 C-m
+ tmux select-pane -t ${PANE_INFO} -T ""
+
+ tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
+ tmux select-pane -t ${PANE_HOST} -T "host"
+
+ sleep 1
+}
diff --git a/test/lib/setup b/test/lib/setup
index df21655..b076eff 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -327,12 +327,31 @@ teardown_demo_passt() {
pane_wait GUEST
pane_wait HOST
pane_wait PASST
+
+ tmux kill-pane -a -t 0
+ tmux send-keys -t 0 "C-c"
}
-# teardown_demo_pasta() - Exit namespace from remaining pane
+# teardown_demo_pasta() - Exit perf and namespace from remaining pane
teardown_demo_pasta() {
+ tmux send-keys -t ${PANE_NS} "q"
+ pane_wait NS
tmux send-keys -t ${PANE_NS} "C-d"
pane_wait NS
+
+ tmux kill-pane -a -t 0
+ tmux send-keys -t 0 "C-c"
+}
+
+# teardown_demo_podman() - Exit namespaces
+teardown_demo_podman() {
+ tmux send-keys -t ${PANE_NS1} "C-d"
+ tmux send-keys -t ${PANE_NS2} "C-d"
+ pane_wait NS1
+ pane_wait NS2
+
+ tmux kill-pane -a -t 0
+ tmux send-keys -t 0 "C-c"
}
# setup() - Run setup_*() functions
diff --git a/test/lib/term b/test/lib/term
index cc6349f..e8a1d38 100755
--- a/test/lib/term
+++ b/test/lib/term
@@ -176,6 +176,15 @@ pane_highlight() {
sleep 3
}
+# pane_resize() - Resize a pane given its name
+# $1: Pane name
+# $2: Direction: U, D, L, or R
+# $3: Adjustment in lines or columns
+pane_resize() {
+ __pane_number=$(eval echo \$PANE_${1})
+ tmux resize-pane -${2} -t ${__pane_number} ${3}
+}
+
# pane_run() - Issue a command in given pane name
# $1: Pane name
# $@: Command to issue
@@ -201,6 +210,7 @@ pane_wait() {
case ${__l} in
'$ ' | '# ' | '# # ' | *"$ " | *"# ") return ;;
*" #[m " | *" #[m [K" | *"]# ["*) return ;;
+ *' $ [6n' | *' # [6n' ) return ;;
esac
do sleep 0.1 || sleep 1; done
}
diff --git a/test/lib/test b/test/lib/test
index 9f6f6e4..2854191 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -218,12 +218,32 @@ test_one_line() {
pane_run NS "${__arg}"
pane_wait NS
;;
+ "ns1")
+ pane_run NS1 "${__arg}"
+ pane_wait NS1
+ ;;
+ "ns2")
+ pane_run NS2 "${__arg}"
+ pane_wait NS2
+ ;;
"nsb")
pane_run NS "${__arg}"
;;
+ "ns1b")
+ pane_run NS1 "${__arg}"
+ ;;
+ "ns2b")
+ pane_run NS2 "${__arg}"
+ ;;
"nsw")
pane_wait NS
;;
+ "ns1w")
+ pane_wait NS1
+ ;;
+ "ns2w")
+ pane_wait NS2
+ ;;
"nstools")
pane_run NS 'which '"${__arg}"' >/dev/null || echo skip'
pane_wait NS
@@ -259,6 +279,18 @@ test_one_line() {
pane_wait NS
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__varname}__" "$(pane_parse NS)")"
;;
+ "ns1out")
+ __varname="${__arg%% *}"
+ pane_run NS1 "${__arg#* }"
+ pane_wait NS1
+ TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__varname}__" "$(pane_parse NS1)")"
+ ;;
+ "ns2out")
+ __varname="${__arg%% *}"
+ pane_run NS2 "${__arg#* }"
+ pane_wait NS2
+ TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__varname}__" "$(pane_parse NS2)")"
+ ;;
"check")
info_check "${__arg}"
__nok=0
@@ -326,6 +358,9 @@ test_one_line() {
"killp")
pane_kill "${__arg}"
;;
+ "resize")
+ pane_resize ${__arg}
+ ;;
*)
__def_body="$(eval printf \"\$TEST_ONE_DEF_$__cmd\")"
if [ -n "${__def_body}" ]; then