|
| 1 | +#!/bin/sh -eu |
| 2 | +# |
| 3 | +# THis scripts is called by .github/workflows/daily_tests.yml |
| 4 | +# The idea is to do some further functional UltraGrid tests |
| 5 | + |
| 6 | +# see also (taken from) .github/scripts/Linux/utils/Dockerfile.ubuntu |
| 7 | +ubuntu_packages=" |
| 8 | + libasound2t64\ |
| 9 | + libegl1\ |
| 10 | + libfontconfig1\ |
| 11 | + libglx-mesa0\ |
| 12 | + libgmp10\ |
| 13 | + libharfbuzz0b\ |
| 14 | + libopengl0\ |
| 15 | + libp11-kit0\ |
| 16 | + libx11-6\ |
| 17 | + openbox\ |
| 18 | + xvfb" |
| 19 | + |
| 20 | +case "$RUNNER_OS" in |
| 21 | + Linux) |
| 22 | + sudo apt update |
| 23 | + sudo apt -y install $ubuntu_packages |
| 24 | + Xvfb :99 -screen 0 1920x1080x24 & |
| 25 | + export DISPLAY=:99 |
| 26 | + openbox & |
| 27 | + |
| 28 | + ug_build=UltraGrid-continuous-x86_64.AppImage |
| 29 | + prepare() { |
| 30 | + chmod +x "$ug_build" |
| 31 | + ./"$ug_build" --appimage-extract |
| 32 | + } |
| 33 | + run_uv=squashfs-root/AppRun |
| 34 | + run_reflector="squashfs-root/AppRun -o hd-rum-transcode" |
| 35 | + ;; |
| 36 | + Windows) |
| 37 | + ug_build=UltraGrid-continuous-win64.zip |
| 38 | + prepare() { |
| 39 | + unzip "$ug_build" |
| 40 | + } |
| 41 | + run_uv=UltraGrid-continuous-win64/uv.exe |
| 42 | + run_reflector=UltraGrid-continuous-win64/hd-rum-transcode.exe |
| 43 | + ;; |
| 44 | + macOS) |
| 45 | + ug_build=UltraGrid-continuous-arm64.dmg |
| 46 | + prepare() { |
| 47 | + hdiutil mount "$ug_build" |
| 48 | + } |
| 49 | + brew install coreutils |
| 50 | + alias timeout=gtimeout |
| 51 | + run_uv=/Volumes/ULTRAGRID/uv-qt.app/Contents/MacOS/uv |
| 52 | + run_reflector=/Volumes/ULTRAGRID/uv-qt.app/Contents/MacOS/\ |
| 53 | +hd-rum-transcode |
| 54 | +esac |
| 55 | + |
| 56 | +curl -LOf https://github.com/CESNET/UltraGrid/releases/download/continuous/\ |
| 57 | +"$ug_build" |
| 58 | + |
| 59 | +prepare |
| 60 | + |
| 61 | +## used by run_test_data.sh |
| 62 | +## @param $1 args |
| 63 | +## @param $2 opts (optional, separated by comma) - should_fail or should_timeout, |
| 64 | +## run_reflector |
| 65 | +add_test() { |
| 66 | + eval "test_${test_count}_args=\${1?}" |
| 67 | + eval "test_${test_count}_opts=\${2-}" |
| 68 | + test_count=$((test_count + 1)) |
| 69 | +} |
| 70 | + |
| 71 | +test_count=0 |
| 72 | +. "$(dirname "$0")"/run_tests_data.sh |
| 73 | + |
| 74 | +set +e |
| 75 | +i=0 |
| 76 | +while [ $i -lt $test_count ]; do |
| 77 | + eval "args=\$test_${i}_args" |
| 78 | + eval "opts=\$test_${i}_opts" |
| 79 | + |
| 80 | + exec=$run_uv |
| 81 | + tool=uv |
| 82 | + if expr -- "$opts" : '.*run_reflector' >/dev/null; then |
| 83 | + tool=reflector |
| 84 | + exec=$run_reflector |
| 85 | + fi |
| 86 | + |
| 87 | + timeout=5 |
| 88 | + timeout $timeout $exec $args |
| 89 | + rc=$? |
| 90 | + |
| 91 | + if [ $rc = 124 ]; then |
| 92 | + if ! expr -- "$opts" : '.*should_timeout' >/dev/null; then |
| 93 | + printf "$tool with arguments %s timeout (limit: %d sec)!\n" \ |
| 94 | + "$args" "$timeout" |
| 95 | + exit 1 |
| 96 | + fi |
| 97 | + elif expr -- "$opts" : '.*should_fail' >/dev/null; then |
| 98 | + if [ $rc -eq 0 ]; then |
| 99 | + printf "$tool with arguments %s should have failed but\ |
| 100 | + returned 0!\n" "$args" |
| 101 | + exit 1 |
| 102 | + fi |
| 103 | + else |
| 104 | + if [ $rc -ne 0 ]; then |
| 105 | + printf "$tool with arguments %s returned %d but should have\ |
| 106 | + succeeeded!\n" "$args" "$rc" |
| 107 | + exit 1 |
| 108 | + fi |
| 109 | + |
| 110 | + fi |
| 111 | + |
| 112 | + i=$((i + 1)) |
| 113 | +done |
| 114 | + |
0 commit comments