diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/demo/pasta | 1 | ||||
-rw-r--r-- | test/lib/layout | 2 | ||||
-rwxr-xr-x | test/lib/setup | 23 | ||||
-rwxr-xr-x | test/lib/term | 13 | ||||
-rwxr-xr-x | test/lib/video | 16 | ||||
-rwxr-xr-x | test/run | 7 |
6 files changed, 54 insertions, 8 deletions
diff --git a/test/demo/pasta b/test/demo/pasta index 508323a..073e23e 100644 --- a/test/demo/pasta +++ b/test/demo/pasta @@ -256,6 +256,7 @@ sleep 2 killp PASST killp HOST sleep 2 +ns cd __TEMPDIR__ nsb perf report -g --max-stack 3 sleep 10 diff --git a/test/lib/layout b/test/lib/layout index a07f9c9..7802dac 100644 --- a/test/lib/layout +++ b/test/lib/layout @@ -208,6 +208,7 @@ layout_demo_pasta() { sleep 3 tmux kill-pane -a -t 0 + cmd_write 0 cd ${BASEPATH} cmd_write 0 clear sleep 1 cmd_write 0 clear @@ -244,6 +245,7 @@ layout_demo_passt() { sleep 3 tmux kill-pane -a -t 0 + cmd_write 0 cd ${BASEPATH} cmd_write 0 clear sleep 1 cmd_write 0 clear diff --git a/test/lib/setup b/test/lib/setup index fd68f05..bb4de5f 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -305,6 +305,29 @@ teardown_two_guests() { pane_wait PASST_2 } +# teardown_demo_passt() - Exit namespace, kill qemu, passt and pasta +teardown_demo_passt() { + tmux send-keys -t ${PANE_GUEST} "C-c" + pane_wait GUEST + tmux send-keys -t ${PANE_GUEST} "C-d" + + tmux send-keys -t ${PANE_HOST} "C-d" + + tmux send-keys -t ${PANE_PASST} "C-c" + pane_wait PASST + tmux send-keys -t ${PANE_PASST} "C-d" + + pane_wait GUEST + pane_wait HOST + pane_wait PASST +} + +# teardown_demo_pasta() - Exit namespace from remaining pane +teardown_demo_pasta() { + tmux send-keys -t ${PANE_NS} "C-d" + pane_wait NS +} + # setup() - Run setup_*() functions # $*: Suffix list of setup_*() functions to be called setup() { diff --git a/test/lib/term b/test/lib/term index 48f0f6a..dfe173e 100755 --- a/test/lib/term +++ b/test/lib/term @@ -529,15 +529,24 @@ pause_continue() { # run_term() - Start tmux session, X terminal if requested, running entry point run_term() { export SHELL="/bin/sh" + tmux set-option -g default-shell "/bin/sh" if [ ${CI} -eq 1 ]; then __xterm_done="$(mktemp)" - ${CI_XTERM} "$(pwd)" -e "sh -c \"printf '\e[8;50;240t'; tmux new-session -s passt_test ./ci from_term; echo >${__xterm_done}\"" + if [ ${XVFB} -eq 1 ]; then + xvfb-run -s "-screen 0 4000x4000x24 -ac" ${CI_XTERM} "$(pwd)" -e "sh -c \"printf '\e[8;50;240t'; tmux new-session -s passt_test ./ci from_term; echo >${__xterm_done}\"" + else + ${CI_XTERM} "$(pwd)" -e "sh -c \"printf '\e[8;50;240t'; tmux new-session -s passt_test ./ci from_term; echo >${__xterm_done}\"" + fi while ! [ -s "${__xterm_done}" ]; do sleep 1; done rm "${__xterm_done}" elif [ ${DEMO} -eq 1 ]; then while true; do - ${DEMO_XTERM} "$(pwd)" -e sh -c 'tmux new-session -s passt_test ./run_demo from_term' + if [ ${XVFB} -eq 1 ]; then + xvfb-run -s "-screen 0 4000x4000x24 -ac" ${DEMO_XTERM} "$(pwd)" -e sh -c 'tmux new-session -s passt_test ./run_demo from_term' + else + ${DEMO_XTERM} "$(pwd)" -e sh -c 'tmux new-session -s passt_test ./run_demo from_term' + fi [ $? -ne 0 ] && { tmux kill-session -t passt_test; continue; } break done diff --git a/test/lib/video b/test/lib/video index fd5849b..d4c0680 100755 --- a/test/lib/video +++ b/test/lib/video @@ -73,17 +73,23 @@ video_grab() { echo "${VIDEO_LINKS_TEMPLATE}" > "${BASEPATH}/${VIDEO_NAME}.js" - __x=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left X:[ ]*\([0-9]*\)$/\1/p') - __y=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left Y:[ ]*\([0-9]*\)$/\1/p') - __width=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Width:[ ]*\([0-9]*\)$/\1/p') - __height=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Height:[ ]*\([0-9]*\)$/\1/p') + if [ ${XVFB} -eq 1 ]; then + # Grab the geometry of the first window that's at least 100px wide + eval $(xwininfo -d :99.0 -root -tree | sed -n 's/^[ ]*0x[0-f]*[^0-9]*\([0-9]\{3,\}\)x\([0-9]*\)+\([0-9]*\)+\([0-9]*\).*/__width=\1; __height=\2; __x=\3; __y=\4;/p') + else + __x=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left X:[ ]*\([0-9]*\)$/\1/p') + __y=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left Y:[ ]*\([0-9]*\)$/\1/p') + __width=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Width:[ ]*\([0-9]*\)$/\1/p') + __height=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Height:[ ]*\([0-9]*\)$/\1/p') + fi [ $((__width % 2)) ] && __width=$((__width - 1)) [ $((__height % 2)) ] && __height=$((__height - 1)) sleep 3 VIDEO_START_SECONDS=$(sed -n 's/\([0-9]*\).[0-9]* [0-9]*.[0-9]*/\1/p' /proc/uptime) - ffmpeg -f x11grab -framerate 15 -video_size "${__width}x${__height}" -i "+${__x},${__y}" -vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p -draw_mouse 0 "${BASEPATH}/${VIDEO_NAME}.mp4" & echo $! > "${FFMPEG_PID_FILE}" + [ ${XVFB} -eq 1 ] && __disp=":99.0" || __disp= + ffmpeg -f x11grab -framerate 15 -video_size "${__width}x${__height}" -i "${__disp}+${__x},${__y}" -vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p -draw_mouse 0 "${BASEPATH}/${VIDEO_NAME}.mp4" & echo $! > "${FFMPEG_PID_FILE}" } # video_time_now() - Print current video timestamp, in seconds @@ -35,6 +35,9 @@ DEBUG=${DEBUG:-0} # If set, tell passt and pasta to take packet captures PCAP=${PCAP:-0} +# If set, run X terminals for CI and demos in Xvfb +XVFB=${XVFB:-1} + COMMIT="$(git log --oneline --no-decorate -1)" . lib/util @@ -117,7 +120,7 @@ demo() { MODE=passt test demo video_stop 0 - tmux send-keys -t ${PANE_GUEST} "C-c" + teardown demo_passt layout_demo_pasta video_grab demo_pasta @@ -149,6 +152,8 @@ else trap "" EXIT fi +[ ${DEMO} -eq 1 ] && exit 0 + tail -n1 ${LOGFILE} echo "Log at ${LOGFILE}" exit $(tail -n1 ${LOGFILE} | sed -n 's/.*FAIL: \(.*\)$/\1/p') |