Files
connector-popos/smoketest/lib/runner.sh
T
davidandClaude Opus 5.5 bc07e1d3e3 Set up Pop!_OS for a Federated Core, like CoreDesktop's configure
A port of CoreDesktop's configure to Pop!_OS 24.04 with COSMIC, in the shape
of connector-macos: its own install.sh, update and configure, installed in
~/.local/share/federated-connector/connector.

Every configure item is ported: the Core (email, calendars and contacts
through GNOME Online Accounts and Evolution, as COSMIC has no accounts of its
own; Superpanel; files over davfs2; Element; Tally; the email watcher),
Tailscale, backups, AI agents in the sandbox and their sign-ins, languages
with mise, AI servers, printers, network storage and the agent sandbox.
Folders go in the COSMIC Files sidebar. Each item installs what it needs
from apt, Flathub or the tool's own apt repository when you set it up.

smoketest/run checks it in Ubuntu 24.04 containers with Docker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:20:47 -07:00

92 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : Run one smoketest scenario inside the container (smoketest/run
# starts this). Prints ok, FAIL or skip for each check, and exits 1
# if any failed.
#
# Usage: runner.sh <scenario file>
#
# A scenario sets DESCRIPTION and TIER and defines `scenario`, which calls the
# checks below. It runs with what configure gives items (CONNECTOR, CONF_DIR,
# confirm...), answering yes to every question, so it can source items and
# call their functions. A desktop session's D-Bus and an unlocked keyring are
# started first, as COSMIC starts them at login.
CONNECTOR="$HOME/connector"
CONF_DIR="$HOME/.config/federated-connector"
export CONNECTOR CONF_DIR
RED=$'\033[31m' GREEN=$'\033[32m' YELLOW=$'\033[33m' RESET=$'\033[0m'
FAILURES=0
# configure's questions, answered yes
confirm() { echo "$1 [y/N] y"; return 0; }
confirm_yes() { echo "$1 [Y/n] y"; return 0; }
# check <description> <command...>: ok if the command succeeds
check() {
local description="$1" output
shift
if output="$("$@" 2>&1)"; then
echo "${GREEN}ok$RESET $description"
else
echo "${RED}FAIL$RESET $description"
[ -n "$output" ] && printf '%s\n' "$output" | tail -n 15 | sed 's/^/ /'
FAILURES=$((FAILURES + 1))
fi
}
# check_not <description> <command...>: ok if the command fails
check_not() {
local description="$1"
shift
if "$@" > /dev/null 2>&1; then
echo "${RED}FAIL$RESET $description (it succeeded)"
FAILURES=$((FAILURES + 1))
else
echo "${GREEN}ok$RESET $description"
fi
}
# check_eq <description> <expected> <actual>
check_eq() {
if [ "$2" = "$3" ]; then
echo "${GREEN}ok$RESET $1"
else
echo "${RED}FAIL$RESET $1"
echo " expected: $2"
echo " got: $3"
FAILURES=$((FAILURES + 1))
fi
}
skip() {
echo "${YELLOW}skip$RESET $1"
}
step() {
echo "-- $*"
}
# The session D-Bus and keyring
export XDG_RUNTIME_DIR="/tmp/runtime-$UID"
mkdir -p -m 700 "$XDG_RUNTIME_DIR"
eval "$(dbus-launch --sh-syntax)"
echo -n smoketest | gnome-keyring-daemon --unlock --components=secrets > /dev/null
export PATH="$HOME/.local/bin:$PATH"
cd "$HOME" || exit 1
source "$CONNECTOR/configure.d/lib/packages.sh"
source "$CONNECTOR/configure.d/lib/agents.sh"
# shellcheck disable=SC1090
source "$1" || { echo "Couldn't read $1"; exit 1; }
echo "$DESCRIPTION"
echo "($(. /etc/os-release && echo "$PRETTY_NAME"), $(uname -m))"
scenario
echo
if [ $FAILURES -eq 0 ]; then
echo "${GREEN}All checks passed.$RESET"
else
echo "${RED}$FAILURES check(s) failed.$RESET"
exit 1
fi