From edd989f8da3b8c861ac1bdbb51555ed4c686b260 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:28:10 +0300 Subject: [PATCH 01/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 72 ++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index aa5fc5d3..800aeacf 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -35,7 +35,75 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 - - name: Done + + - name: Install Destop Environment + run: | + echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl > /dev/null # appstream # TODO: Cache me! + mkdir $HOME/.icewm/ + echo "ShowTaskBar = 0" > $HOME/.icewm/preferences + echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences + echo "TaskBarShowWorkspaces = 0" > $HOME/.icewm/preferences + echo "TaskBarShowAllWindows = 0" > $HOME/.icewm/preferences + echo "TaskBarShowClock = 0" > $HOME/.icewm/preferences + echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences + echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences + echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences + Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots + + + - name: Test guiscrcpy works run: | - echo Done + sleep 1 + guiscrcpy + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + # Count the windows on screen + NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) + echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" + if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then + echo "ERROR: Could not find a single window on screen :-(" + fi + + # Works with Xvfb but cannot select window by ID + # sudo apt-get -y install scrot + # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" + # mv screenshot_* database/$INPUTBASENAME/ + + # Getting the active window seems to require a window manager + icewm & + sleep 2 + + # We could simulate X11 keyboard/mouse input with xdotool here if needed; + # of course this should not be hardcoded here (this is just an example) + if [ x"$INPUTBASENAME" == xVLC ] ; then + xdotool sleep 0.1 key Return # Click away the data protection window + xdotool sleep 0.1 key shift+F1 # Open the about screen + sleep 1 + fi + if [ x"$INPUTBASENAME" == xSubsurface ] ; then + xdotool sleep 0.1 key Escape # Click away the update check window + sleep 1 + # Get a list of open windows + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + fi + + # Works with Xvfb + # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml + # -display :99 needed here? + # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + mkdir -p database/$INPUTBASENAME/ + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" + convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" + + kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 + killall icewm + + + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + name: guiscrcpy-screenshot.png + path: screenshot.png + From 3654994ec93b7019f36aff56fbbeb08fbccb5b73 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:30:00 +0300 Subject: [PATCH 02/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 800aeacf..547ccb66 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -39,6 +39,7 @@ jobs: - name: Install Destop Environment run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" + sudo apt-get update sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl > /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences From cacb64d1347f2fe39b198f1591be8cd9e989e8f0 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:33:23 +0300 Subject: [PATCH 03/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 547ccb66..19211671 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -36,6 +36,10 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 + - name: Test setup.py + run: | + pip3 install . + - name: Install Destop Environment run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" From 53fb6a3d222ffd7162d0acdeb1e978155f051333 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:36:55 +0300 Subject: [PATCH 04/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 19211671..4c3f656f 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -60,6 +60,7 @@ jobs: - name: Test guiscrcpy works run: | sleep 1 + export QT_DEBUG_PLUGINS=1 guiscrcpy xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' # Count the windows on screen From c948776100475bcf66f6619d3f3da93baf8f2d22 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:45:09 +0300 Subject: [PATCH 05/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 4c3f656f..46bd861e 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl > /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libxcb-iccm4> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences @@ -61,7 +61,8 @@ jobs: run: | sleep 1 export QT_DEBUG_PLUGINS=1 - guiscrcpy + guiscrcpy & + sleep 10 xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' # Count the windows on screen NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) From 55bb008e433f5f058239e6fb4d7abc9c46d4ddde Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:47:55 +0300 Subject: [PATCH 06/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 46bd861e..6939a2d8 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libxcb-iccm4> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From b9a602dd8da0e11303e5a66f943cb25e2fda4030 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:53:20 +0300 Subject: [PATCH 07/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 6939a2d8..f4a792f2 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-icccm4 libxcb-image0 libxcb-render-util0 > /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From 6c850b9fea3f18f713dd45bb6262077b80bb00ad Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 15:57:14 +0300 Subject: [PATCH 08/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index f4a792f2..bbf0f18e 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-icccm4 libxcb-image0 libxcb-render-util0 > /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 > /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From fc7ecaff6b152023143d751976e5ccebaaac3b1b Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:02:06 +0300 Subject: [PATCH 09/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index bbf0f18e..1ee7d3ae 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 > /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11 libxkbcommon0 > /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences @@ -54,11 +54,11 @@ jobs: echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences - Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots - name: Test guiscrcpy works run: | + Xvfb :99 -screen 0 800x600x24 & sleep 1 export QT_DEBUG_PLUGINS=1 guiscrcpy & From 90d6256b52e35da614bc7a202c2db27e22638b17 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:04:31 +0300 Subject: [PATCH 10/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 1ee7d3ae..f34a6501 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11 libxkbcommon0 > /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 > /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From 868a84262dbd0f267122f64cda1aae77c1e7f8f1 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:07:10 +0300 Subject: [PATCH 11/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index f34a6501..90620ac5 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -59,6 +59,8 @@ jobs: - name: Test guiscrcpy works run: | Xvfb :99 -screen 0 800x600x24 & + export DISPLAY=:99 + echo $DISPLAY sleep 1 export QT_DEBUG_PLUGINS=1 guiscrcpy & From 950dd78073b467f10e5952c1136f363ae4cf0612 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:15:35 +0300 Subject: [PATCH 12/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 90620ac5..145c97b0 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -16,7 +16,7 @@ on: jobs: quality: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 > /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From b9bb0f1cfc16be7490e20eec4ffba4898e1cf43c Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:19:25 +0300 Subject: [PATCH 13/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 145c97b0..a3c89bef 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -64,6 +64,7 @@ jobs: sleep 1 export QT_DEBUG_PLUGINS=1 guiscrcpy & + APID=$! sleep 10 xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' # Count the windows on screen From d41305bcc1bc68c1672308e692546086055cc4e7 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:54:06 +0300 Subject: [PATCH 14/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index a3c89bef..4268f37a 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -58,8 +58,9 @@ jobs: - name: Test guiscrcpy works run: | - Xvfb :99 -screen 0 800x600x24 & export DISPLAY=:99 + echo "exec icewm-session" > ~/.xinitrc + startx & echo $DISPLAY sleep 1 export QT_DEBUG_PLUGINS=1 From 54eb01f5006c6f12dea9543bb20a63f367a131f1 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 16:59:19 +0300 Subject: [PATCH 15/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 4268f37a..e97bc0f7 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xinit> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences @@ -60,7 +60,7 @@ jobs: run: | export DISPLAY=:99 echo "exec icewm-session" > ~/.xinitrc - startx & + startx -- :99 & echo $DISPLAY sleep 1 export QT_DEBUG_PLUGINS=1 From 457ca75ed5c3eddcf3811753b82dc8a9e966d38e Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:04:04 +0300 Subject: [PATCH 16/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index e97bc0f7..813baf27 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xinit> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xinit Xorg> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From 032ddb9ec6bec29998f29c574e0efe2fa3e10338 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:11:48 +0300 Subject: [PATCH 17/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 813baf27..bd1f2df4 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xinit Xorg> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xorg xserver-xorg xserver-xorg-core> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences From a22c07508766971c1a096016a2255be1750a6db5 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:25:09 +0300 Subject: [PATCH 18/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 97 ++++++++++++++++----------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index bd1f2df4..b99bd584 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -44,7 +44,7 @@ jobs: run: | echo "adapted from https://github.com/AppImage/appimage.github.io/blob/master/.travis.yml" sudo apt-get update - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy xorg xserver-xorg xserver-xorg-core> /dev/null # appstream # TODO: Cache me! + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev fonts-wqy-microhei libfile-mimeinfo-perl libx11-xcb1 libxcb-xkb1 libxcb-* libxcb-render-util0 libxkbcommon-x11-0 libxkbcommon0 scrcpy> /dev/null # appstream # TODO: Cache me! mkdir $HOME/.icewm/ echo "ShowTaskBar = 0" > $HOME/.icewm/preferences echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences @@ -56,59 +56,58 @@ jobs: echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences - - name: Test guiscrcpy works - run: | - export DISPLAY=:99 - echo "exec icewm-session" > ~/.xinitrc - startx -- :99 & - echo $DISPLAY - sleep 1 - export QT_DEBUG_PLUGINS=1 - guiscrcpy & - APID=$! - sleep 10 - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - # Count the windows on screen - NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) - echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" - if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then - echo "ERROR: Could not find a single window on screen :-(" - fi + - name: Run headless test + uses: GabrielBB/xvfb-action@v1 + with: + working-directory: ./ + run: | + echo $DISPLAY + sleep 1 + export QT_DEBUG_PLUGINS=1 + guiscrcpy & + APID=$! + sleep 10 + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + # Count the windows on screen + NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) + echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" + if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then + echo "ERROR: Could not find a single window on screen :-(" + fi - # Works with Xvfb but cannot select window by ID - # sudo apt-get -y install scrot - # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" - # mv screenshot_* database/$INPUTBASENAME/ + # Works with Xvfb but cannot select window by ID + # sudo apt-get -y install scrot + # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" + # mv screenshot_* database/$INPUTBASENAME/ - # Getting the active window seems to require a window manager - icewm & - sleep 2 + # Getting the active window seems to require a window manager + icewm & + sleep 2 - # We could simulate X11 keyboard/mouse input with xdotool here if needed; - # of course this should not be hardcoded here (this is just an example) - if [ x"$INPUTBASENAME" == xVLC ] ; then - xdotool sleep 0.1 key Return # Click away the data protection window - xdotool sleep 0.1 key shift+F1 # Open the about screen - sleep 1 - fi - if [ x"$INPUTBASENAME" == xSubsurface ] ; then - xdotool sleep 0.1 key Escape # Click away the update check window - sleep 1 - # Get a list of open windows - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - fi + # We could simulate X11 keyboard/mouse input with xdotool here if needed; + # of course this should not be hardcoded here (this is just an example) + if [ x"$INPUTBASENAME" == xVLC ] ; then + xdotool sleep 0.1 key Return # Click away the data protection window + xdotool sleep 0.1 key shift+F1 # Open the about screen + sleep 1 + fi + if [ x"$INPUTBASENAME" == xSubsurface ] ; then + xdotool sleep 0.1 key Escape # Click away the update check window + sleep 1 + # Get a list of open windows + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + fi - # Works with Xvfb - # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml - # -display :99 needed here? - # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - mkdir -p database/$INPUTBASENAME/ - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" - convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" + # Works with Xvfb + # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml + # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + mkdir -p database/$INPUTBASENAME/ + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" + convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" - kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 - killall icewm + kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 + killall icewm - name: Upload artifact From c1af6194a0bfc904b170cbc2882703e05cfc9fe6 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:33:37 +0300 Subject: [PATCH 19/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 53 ++------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index b99bd584..139822c8 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -57,57 +57,8 @@ jobs: - name: Run headless test - uses: GabrielBB/xvfb-action@v1 - with: - working-directory: ./ - run: | - echo $DISPLAY - sleep 1 - export QT_DEBUG_PLUGINS=1 - guiscrcpy & - APID=$! - sleep 10 - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - # Count the windows on screen - NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) - echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" - if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then - echo "ERROR: Could not find a single window on screen :-(" - fi - - # Works with Xvfb but cannot select window by ID - # sudo apt-get -y install scrot - # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" - # mv screenshot_* database/$INPUTBASENAME/ - - # Getting the active window seems to require a window manager - icewm & - sleep 2 - - # We could simulate X11 keyboard/mouse input with xdotool here if needed; - # of course this should not be hardcoded here (this is just an example) - if [ x"$INPUTBASENAME" == xVLC ] ; then - xdotool sleep 0.1 key Return # Click away the data protection window - xdotool sleep 0.1 key shift+F1 # Open the about screen - sleep 1 - fi - if [ x"$INPUTBASENAME" == xSubsurface ] ; then - xdotool sleep 0.1 key Escape # Click away the update check window - sleep 1 - # Get a list of open windows - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - fi - - # Works with Xvfb - # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml - # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - mkdir -p database/$INPUTBASENAME/ - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" - convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" - - kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 - killall icewm + run: | + /usr/bin/xvfb-run --auto-servernum scripts/display_ci.sh - name: Upload artifact From 3749e5f092c49774131c08eb548b7de7c18912de Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:37:06 +0300 Subject: [PATCH 20/22] Create display-ci.sh --- scripts/display-ci.sh | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/display-ci.sh diff --git a/scripts/display-ci.sh b/scripts/display-ci.sh new file mode 100644 index 00000000..5c29bee3 --- /dev/null +++ b/scripts/display-ci.sh @@ -0,0 +1,47 @@ +echo $DISPLAY + sleep 1 + export QT_DEBUG_PLUGINS=1 + guiscrcpy & + APID=$! + sleep 10 + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + # Count the windows on screen + NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) + echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" + if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then + echo "ERROR: Could not find a single window on screen :-(" + fi + + # Works with Xvfb but cannot select window by ID + # sudo apt-get -y install scrot + # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" + # mv screenshot_* database/$INPUTBASENAME/ + + # Getting the active window seems to require a window manager + icewm & + sleep 2 + + # We could simulate X11 keyboard/mouse input with xdotool here if needed; + # of course this should not be hardcoded here (this is just an example) + if [ x"$INPUTBASENAME" == xVLC ] ; then + xdotool sleep 0.1 key Return # Click away the data protection window + xdotool sleep 0.1 key shift+F1 # Open the about screen + sleep 1 + fi + if [ x"$INPUTBASENAME" == xSubsurface ] ; then + xdotool sleep 0.1 key Escape # Click away the update check window + sleep 1 + # Get a list of open windows + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' + fi + + # Works with Xvfb + # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml + # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + mkdir -p database/$INPUTBASENAME/ + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" + # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" + convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" + + kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 + killall icewm From 4e23e78661a57ad5a7e31143435e4b791db24e25 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 17:38:20 +0300 Subject: [PATCH 21/22] Update pythonapp.yml --- .github/workflows/pythonapp.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 139822c8..72372c48 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -58,7 +58,8 @@ jobs: - name: Run headless test run: | - /usr/bin/xvfb-run --auto-servernum scripts/display_ci.sh + chmod +x scripts/display-ci.sh + /usr/bin/xvfb-run --auto-servernum ./scripts/display-ci.sh - name: Upload artifact From 08413564e7118fa7b70fb31baba66b495370c59b Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Fri, 4 Sep 2020 18:51:16 +0300 Subject: [PATCH 22/22] Update display-ci.sh --- scripts/display-ci.sh | 84 ++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/scripts/display-ci.sh b/scripts/display-ci.sh index 5c29bee3..05d69a43 100644 --- a/scripts/display-ci.sh +++ b/scripts/display-ci.sh @@ -1,47 +1,49 @@ +#!/bin/bash + echo $DISPLAY - sleep 1 - export QT_DEBUG_PLUGINS=1 - guiscrcpy & - APID=$! - sleep 10 - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - # Count the windows on screen - NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) - echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" - if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then - echo "ERROR: Could not find a single window on screen :-(" - fi +sleep 1 +export QT_DEBUG_PLUGINS=1 +guiscrcpy & +APID=$! +sleep 10 +xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' +# Count the windows on screen +NUMBER_OF_WINDOWS=$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | wc -l) +echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS" +if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then + echo "ERROR: Could not find a single window on screen :-(" +fi - # Works with Xvfb but cannot select window by ID - # sudo apt-get -y install scrot - # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" - # mv screenshot_* database/$INPUTBASENAME/ +# Works with Xvfb but cannot select window by ID +# sudo apt-get -y install scrot +# scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" +# mv screenshot_* database/$INPUTBASENAME/ - # Getting the active window seems to require a window manager - icewm & - sleep 2 +# Getting the active window seems to require a window manager +icewm & +sleep 2 - # We could simulate X11 keyboard/mouse input with xdotool here if needed; - # of course this should not be hardcoded here (this is just an example) - if [ x"$INPUTBASENAME" == xVLC ] ; then - xdotool sleep 0.1 key Return # Click away the data protection window - xdotool sleep 0.1 key shift+F1 # Open the about screen - sleep 1 - fi - if [ x"$INPUTBASENAME" == xSubsurface ] ; then - xdotool sleep 0.1 key Escape # Click away the update check window - sleep 1 - # Get a list of open windows - xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' - fi +# We could simulate X11 keyboard/mouse input with xdotool here if needed; +# of course this should not be hardcoded here (this is just an example) +if [ x"$INPUTBASENAME" == xVLC ] ; then + xdotool sleep 0.1 key Return # Click away the data protection window + xdotool sleep 0.1 key shift+F1 # Open the about screen + sleep 1 +fi +if [ x"$INPUTBASENAME" == xSubsurface ] ; then + xdotool sleep 0.1 key Escape # Click away the update check window + sleep 1 + # Get a list of open windows + xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' +fi - # Works with Xvfb - # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml - # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - mkdir -p database/$INPUTBASENAME/ - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" - # xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" - convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" +# Works with Xvfb +# sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml +# xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" +mkdir -p database/$INPUTBASENAME/ +# xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" +# xwd -id $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) -silent | xwdtopnm | pnmtopng > database/$INPUTBASENAME/screenshot.png && echo "Snap!" +convert x:$(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//' | head -n 1 | cut -d " " -f 1) screenshot.png && echo "Snap!" - kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 - killall icewm +kill $APID && printf "\n\n\n* * * SUCCESS :-) * * *\n\n\n" || exit 1 +killall icewm