first commit
This commit is contained in:
commit
1354db6c39
90 files changed
+13123
No files matched your search
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2026 Bryan Joshua Pedini
|
||||
|
||||
# tests/e2e/entrypoint.sh - runs INSIDE one distro container (started by tests/docker/run-e2e.sh,
|
||||
# as root, repository mounted read-only at /work, SU_DISTRO=<label>):
|
||||
# 1. installs the applet as /usr/local/bin/skeptical-updater
|
||||
# 2. builds the deterministic fixture for the package-manager family (su-dummy-{a,b,c}
|
||||
# 1.0 installed, 2.0 offered by a local repo; the distro's own repos are disabled;
|
||||
# su-dummy-orphan: an unrelated, automatically installed package nothing needs)
|
||||
# 3. runs tests/e2e/*.bats with the vendored bats-core against the REAL package manager
|
||||
# Exit status: the bats status (or 1 if the setup failed).
|
||||
set -euo pipefail
|
||||
export LC_ALL=C DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." # repository root (read-only)
|
||||
log() { printf '== entrypoint: %s\n' "$*"; }
|
||||
die() {
|
||||
printf '== entrypoint: ERROR: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ $(id -u) -eq 0 ]] || die "must run as root"
|
||||
t0=$SECONDS
|
||||
|
||||
install -m 0755 skeptical-updater /usr/local/bin/skeptical-updater
|
||||
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
family=pacman
|
||||
# FIXTURE_SYNC=1: a system whose sync database was synced once (--no-refresh lists from it)
|
||||
FIXTURE_ISOLATE=1 FIXTURE_ORPHAN=1 FIXTURE_SYNC=1 bash tests/e2e/fixtures/pacman.sh
|
||||
elif command -v apt-get >/dev/null 2>&1; then
|
||||
family=apt
|
||||
SU_FIXTURE_OFFLINE=1 SU_FIXTURE_ORPHAN=1 SU_FIXTURE_B_AUTO=1 bash tests/e2e/fixtures/apt.sh
|
||||
elif command -v zypper >/dev/null 2>&1 || command -v dnf >/dev/null 2>&1 || command -v yum >/dev/null 2>&1; then
|
||||
family=rpm
|
||||
SU_FIXTURE_ISOLATE=1 SU_FIXTURE_ORPHAN=1 SU_FIXTURE_B_AUTO=1 bash tests/e2e/fixtures/rpm.sh
|
||||
else
|
||||
die "no supported package manager in this image"
|
||||
fi
|
||||
export SU_FAMILY=$family
|
||||
# shellcheck source=/dev/null
|
||||
log "${SU_DISTRO:-?}: family=$family, fixture ready after $((SECONDS - t0))s ($(. /etc/os-release && printf '%s' "$PRETTY_NAME"), bash $BASH_VERSION)"
|
||||
|
||||
TMPDIR=$(mktemp -d /tmp/su-e2e.XXXXXX)
|
||||
export TMPDIR
|
||||
|
||||
# bats needs find(1) to expand a directory argument; openSUSE base images may lack it
|
||||
if command -v find >/dev/null 2>&1; then
|
||||
targets=(tests/e2e)
|
||||
else
|
||||
targets=(tests/e2e/*.bats)
|
||||
fi
|
||||
status=0
|
||||
bash tests/vendor/bats-core/bin/bats --tap "${targets[@]}" || status=$?
|
||||
log "${SU_DISTRO:-?}: bats exited $status after $((SECONDS - t0))s"
|
||||
exit "$status"
|
||||
Reference in new issue
Block a user