Add vncdotool for integration tests

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
pull/242/head
Jim Ramsay 2023-02-25 21:48:33 -05:00
parent 9384bf3819
commit ba99e7180e
5 changed files with 33 additions and 5 deletions

View File

@ -14,6 +14,7 @@ packages:
- sway - sway
- jq - jq
- lsof - lsof
- vncdotool
sources: sources:
- http://github.com/any1/wayvnc - http://github.com/any1/wayvnc

View File

@ -18,6 +18,7 @@ packages:
- textproc/jq - textproc/jq
- sysutils/lsof - sysutils/lsof
- shells/bash - shells/bash
- devel/py-pip
sources: sources:
- http://github.com/any1/wayvnc - http://github.com/any1/wayvnc
@ -25,6 +26,8 @@ sources:
- http://github.com/any1/aml - http://github.com/any1/aml
tasks: tasks:
- pip-vncdotool: |
sudo pip install vncdotool
- aml: | - aml: |
cd aml cd aml
meson --prefix=/usr build meson --prefix=/usr build

View File

@ -27,6 +27,7 @@ jobs:
sudo apt-get install -y meson libdrm-dev libxkbcommon-dev libwlroots-dev libjansson-dev libpam0g-dev libgnutls28-dev libavfilter-dev libavcodec-dev libavutil-dev libturbojpeg0-dev scdoc sudo apt-get install -y meson libdrm-dev libxkbcommon-dev libwlroots-dev libjansson-dev libpam0g-dev libgnutls28-dev libavfilter-dev libavcodec-dev libavutil-dev libturbojpeg0-dev scdoc
# runtime deps for integration testing: # runtime deps for integration testing:
sudo apt-get install -y sway jq lsof sudo apt-get install -y sway jq lsof
pip install vncdotool
- name: configure - name: configure
run: meson build -D tests=true run: meson build -D tests=true
- name: compile - name: compile

View File

@ -36,6 +36,8 @@
# - Override by setting $SWAY and $SWAYMSG # - Override by setting $SWAY and $SWAYMSG
# - jq for parsing json output is in the $PATH # - jq for parsing json output is in the $PATH
# - lsof for TCP port checking is in the $PATH # - lsof for TCP port checking is in the $PATH
# - vncdo for client testing is in the $PATH
# (pip install vncdotool)
set -e set -e
@ -53,6 +55,8 @@ SWAYMSG=${SWAYMSG:-$(which swaymsg)}
echo "Found: $WAYVNC $WAYVNCCTL $SWAY $SWAYMSG" echo "Found: $WAYVNC $WAYVNCCTL $SWAY $SWAYMSG"
$WAYVNC --version $WAYVNC --version
$SWAY --version $SWAY --version
VNCDO=${VNCDO:-$(which vncdo)}
$VNCDO --version 2>/dev/null
export XDG_CONFIG_HOME=$INTEGRATION_ROOT/xdg_config export XDG_CONFIG_HOME=$INTEGRATION_ROOT/xdg_config
export XDG_RUNTIME_DIR=/tmp/wayvnc-integration-$$ export XDG_RUNTIME_DIR=/tmp/wayvnc-integration-$$
@ -113,12 +117,12 @@ stop_sway() {
} }
WAYVNC_PID= WAYVNC_PID=
WAYVNC_ADDRESS=localhost WAYVNC_ADDRESS=127.0.0.1
WAYVNC_PORT=5999 WAYVNC_PORT=5999
start_wayvnc() { start_wayvnc() {
echo "Starting wayvnc..." echo "Starting wayvnc..."
WAYVNC_LOG=$XDG_RUNTIME_DIR/wayvnc.log WAYVNC_LOG=$XDG_RUNTIME_DIR/wayvnc.log
$WAYVNC "$WAYVNC_ADDRESS" "$WAYVNC_PORT" &>$WAYVNC_LOG & $WAYVNC -L debug "$WAYVNC_ADDRESS" "$WAYVNC_PORT" &>$WAYVNC_LOG &
WAYVNC_PID=$! WAYVNC_PID=$!
# Wait for the VNC listening port # Wait for the VNC listening port
echo " Started $WAYVNC_PID" echo " Started $WAYVNC_PID"
@ -145,11 +149,15 @@ cleanup() {
if [[ $result != 0 ]]; then if [[ $result != 0 ]]; then
echo SWAY LOG echo SWAY LOG
echo -------- echo --------
cat $SWAY_LOG cat "$SWAY_LOG"
echo echo
echo WAYVNC_LOG echo WAYVNC_LOG
echo ---------- echo ----------
cat $WAYVNC_LOG cat "$WAYVNC_LOG"
echo
echo VNCDO_LOG
echo ----------
cat "$VNCDO_LOG"
exit exit
fi fi
rm -rf $XDG_RUNTIME_DIR rm -rf $XDG_RUNTIME_DIR
@ -179,7 +187,7 @@ test_output_list_ipc() {
} }
test_exit_ipc() { test_exit_ipc() {
echo "Cbecking wayvnc-exit command" echo "Checking wayvnc-exit command"
# Ignore errors because killing the socket races vs receiving # Ignore errors because killing the socket races vs receiving
# a return message: https://github.com/any1/wayvnc/issues/233 # a return message: https://github.com/any1/wayvnc/issues/233
$WAYVNCCTL wayvnc-exit &>/dev/null || true $WAYVNCCTL wayvnc-exit &>/dev/null || true
@ -189,11 +197,25 @@ test_exit_ipc() {
echo "ok" echo "ok"
} }
client() {
VNCDO_LOG=$XDG_RUNTIME_DIR/vncdo.log
$VNCDO -v --server=$WAYVNC_ADDRESS::$WAYVNC_PORT "$@" &>>$VNCDO_LOG
}
test_client_connect() {
echo "Connecting to send ctrl+t"
client key ctrl-t
echo " Looking for the result..."
[[ -f $XDG_RUNTIME_DIR/test.txt ]]
echo "Ok"
}
smoke_test() { smoke_test() {
start_sway start_sway
start_wayvnc start_wayvnc
test_version_ipc test_version_ipc
test_output_list_ipc test_output_list_ipc
test_client_connect
test_exit_ipc test_exit_ipc
stop_sway stop_sway
} }

View File

@ -1,2 +1,3 @@
xwayland disable xwayland disable
bindsym Ctrl+t exec bash -c "echo OK > $XDG_RUNTIME_DIR/test.txt"
exec bash -c "env > $XDG_RUNTIME_DIR/sway.env" exec bash -c "env > $XDG_RUNTIME_DIR/sway.env"