| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | repo_root="$(cd "$(dirname "$0")/.." && pwd)" |
| 5 | runtime_dir="$(mktemp -d)" |
| 6 | introspection_file="$(mktemp)" |
| 7 | log_file="$(mktemp)" |
| 8 | |
| 9 | cleanup() { |
| 10 | rm -f "$introspection_file" "$log_file" |
| 11 | rm -rf "$runtime_dir" |
| 12 | } |
| 13 | trap cleanup EXIT |
| 14 | |
| 15 | DBUS_FATAL_WARNINGS=0 dbus-run-session -- bash -lc ' |
| 16 | set -euo pipefail |
| 17 | export XDG_RUNTIME_DIR="'"$runtime_dir"'" |
| 18 | cd "'"$repo_root"'" |
| 19 | |
| 20 | cargo run -q -p garwarp -- daemon >"'"$log_file"'" 2>&1 & |
| 21 | pid=$! |
| 22 | |
| 23 | for _ in $(seq 1 200); do |
| 24 | if dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus \ |
| 25 | org.freedesktop.DBus.NameHasOwner string:org.freedesktop.impl.portal.desktop.garwarp \ |
| 26 | | rg -q "boolean true"; then |
| 27 | break |
| 28 | fi |
| 29 | sleep 0.05 |
| 30 | done |
| 31 | |
| 32 | dbus-send --session --print-reply \ |
| 33 | --dest=org.freedesktop.impl.portal.desktop.garwarp \ |
| 34 | /org/freedesktop/portal/desktop \ |
| 35 | org.freedesktop.DBus.Introspectable.Introspect >"'"$introspection_file"'" |
| 36 | |
| 37 | cargo run -q -p garwarpctl -- stop >/dev/null |
| 38 | wait "$pid" |
| 39 | ' |
| 40 | |
| 41 | rg -q "org.freedesktop.impl.portal.Screenshot" "$introspection_file" |
| 42 | rg -q "org.freedesktop.impl.portal.FileChooser" "$introspection_file" |
| 43 | rg -q "org.freedesktop.impl.portal.AppChooser" "$introspection_file" |
| 44 | rg -q "method name=\"Screenshot\"" "$introspection_file" |
| 45 | rg -q "method name=\"PickColor\"" "$introspection_file" |
| 46 | rg -q "method name=\"OpenFile\"" "$introspection_file" |
| 47 | rg -q "method name=\"SaveFile\"" "$introspection_file" |
| 48 | rg -q "method name=\"SaveFiles\"" "$introspection_file" |
| 49 | rg -q "method name=\"ChooseApplication\"" "$introspection_file" |
| 50 | rg -q "method name=\"UpdateChoices\"" "$introspection_file" |
| 51 | |
| 52 | printf "dbus interface export smoke test passed\n" |