Merge smoketest-siblings: sibling projects in the smoketest, and the bugs it found
shellcheck / shellcheck (push) Successful in 18s
shellcheck / shellcheck (push) Successful in 18s
Sibling projects (HamPack first) can now have smoketest scenarios run on top of CoreDesktop's, with coredesktop-dev smoketest --with. Their first runs found three install bugs, fixed here: sibling add on a system not upgraded lately, and install.sh failing when its upgrade replaced the kernel (now kept working with kernel-modules-hook). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -270,7 +270,7 @@ A sibling project is another git repository that builds on CoreDesktop. To insta
|
||||
sibling
|
||||
```
|
||||
|
||||
It asks for the repository's git URL, clones it into ~/.local/share/siblings/, runs the project's "install.sh" (if it has one), and confirms the install. After that, every "update" pulls the latest version of each sibling and runs its "update.sh" (if it has one).
|
||||
It asks for the repository's git URL, clones it into ~/.local/share/siblings/, runs the project's "install.sh" (if it has one), and confirms the install. If the system hasn't been upgraded in the last day, it runs "update" first: a sibling's install.sh installs packages, and on an out-of-date system the mirrors no longer have the versions pacman would ask for. After that, every "update" pulls the latest version of each sibling and runs its "update.sh" (if it has one).
|
||||
|
||||
Use "sibling list" to see what's installed, with each project's version, and "sibling remove {name}" to uninstall one. A project's version is its latest release tag (e.g. v1.4.0), or, if it has none, the date and short hash of its latest commit, like CoreDesktop's own.
|
||||
|
||||
|
||||
+14
-2
@@ -145,7 +145,11 @@ ensure_federated_repo
|
||||
|
||||
# Bring the system fully up to date before installing anything new
|
||||
echo "Updating system..."
|
||||
sudo pacman -Sy --needed --noconfirm archlinux-keyring
|
||||
# kernel-modules-hook first, in a transaction of its own so its hooks are loaded
|
||||
# for the upgrade: if the upgrade replaces the kernel, it keeps the running
|
||||
# kernel's modules, which the rest of the install (Docker, the firewall) needs
|
||||
# until the reboot it ends with
|
||||
sudo pacman -Sy --needed --noconfirm archlinux-keyring kernel-modules-hook
|
||||
# Logged for check_initramfs, before finish-install offers a reboot. Not
|
||||
# through script(1): this file is usually piped into bash, and script would
|
||||
# read the rest of it from stdin.
|
||||
@@ -242,7 +246,15 @@ echo "Configuring Bitwarden SSH agent..."
|
||||
# Group membership takes effect at next login (newgrp would start an interactive shell)
|
||||
sudo usermod -aG docker $USER
|
||||
sudo systemctl enable docker.service
|
||||
sudo systemctl start docker.service
|
||||
# Docker needs kernel modules (overlay, bridge, netfilter). If this install
|
||||
# upgraded the kernel, the running kernel's are gone until a reboot (as in
|
||||
# updates.d/99-reboot-check.sh), so Docker can't start yet: it starts after
|
||||
# the reboot the install ends with.
|
||||
if [ -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
sudo systemctl start docker.service
|
||||
else
|
||||
echo "Docker will start after you reboot: this install upgraded the kernel."
|
||||
fi
|
||||
|
||||
# Enable and start Tailscale daemon
|
||||
if ! systemctl is-enabled tailscaled &> /dev/null; then
|
||||
|
||||
@@ -111,6 +111,9 @@ MAINTENANCE=(
|
||||
gnome-extra
|
||||
gnome-keyring
|
||||
pacman-contrib
|
||||
# Keeps the running kernel's modules after a kernel upgrade, until a reboot
|
||||
# (install.sh installs it before anything else)
|
||||
kernel-modules-hook
|
||||
# Keeps the mirrorlist on up-to-date mirrors (system/mirrors.sh)
|
||||
reflector
|
||||
)
|
||||
@@ -164,6 +167,8 @@ SERVICES=(
|
||||
cups.service
|
||||
fwupd-refresh.timer
|
||||
gdm.service
|
||||
# kernel-modules-hook's: removes the old kernel's kept modules after a reboot
|
||||
linux-modules-cleanup.service
|
||||
NetworkManager.service
|
||||
reflector.timer
|
||||
sshd.service
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
# the commit's date and short hash, e.g. 2026.11.02 (a1b2c3d).
|
||||
|
||||
SIBLINGS="$HOME/.local/share/siblings"
|
||||
# pacman's log, which says when the system was last upgraded
|
||||
SIBLING_PACMAN_LOG="${SIBLING_PACMAN_LOG:-/var/log/pacman.log}"
|
||||
# Upgrade before adding a sibling if the last upgrade is older than this
|
||||
SIBLING_MAX_UPGRADE_HOURS=24
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
@@ -159,6 +163,40 @@ sibling_name() {
|
||||
echo "${name%.git}"
|
||||
}
|
||||
|
||||
# Hours since pacman last upgraded the whole system (update, install.sh or a
|
||||
# pacman -Syu), from its log; nothing if the log doesn't say
|
||||
hours_since_upgrade() {
|
||||
local line when
|
||||
line="$(grep -F '[PACMAN] starting full system upgrade' "$SIBLING_PACMAN_LOG" 2> /dev/null | tail -n 1)"
|
||||
when="${line#\[}"
|
||||
when="${when%%]*}"
|
||||
[ -n "$when" ] && when="$(date -d "$when" +%s 2> /dev/null)" || return 0
|
||||
echo $(( ($(date +%s) - when) / 3600 ))
|
||||
}
|
||||
|
||||
# A sibling's install.sh installs packages using pacman's package lists. If
|
||||
# the system hasn't been upgraded for a while, those lists name versions the
|
||||
# mirrors have since deleted, and the install fails. Only update may upgrade
|
||||
# the system, so run it first. (Not when update or install.sh is what's
|
||||
# running this: they've just upgraded.)
|
||||
upgrade_if_stale() {
|
||||
local hours
|
||||
[ -z "${COREDESKTOP_ALLOW_PACMAN:-}" ] || return 0
|
||||
hours="$(hours_since_upgrade)"
|
||||
if [ -n "$hours" ] && (( hours < SIBLING_MAX_UPGRADE_HOURS )); then
|
||||
return 0
|
||||
fi
|
||||
if [ -n "$hours" ]; then
|
||||
echo "This system was last upgraded $(( hours / 24 )) day(s) ago. Running update first, so the"
|
||||
else
|
||||
echo "Couldn't tell when this system was last upgraded. Running update first, so the"
|
||||
fi
|
||||
echo "sibling installs current packages..."
|
||||
if ! "$HOME/.local/bin/update"; then
|
||||
echo "update reported errors (above); adding the sibling anyway."
|
||||
fi
|
||||
}
|
||||
|
||||
add_sibling() {
|
||||
local url="$1" name dir
|
||||
|
||||
@@ -177,6 +215,8 @@ add_sibling() {
|
||||
fi
|
||||
dir="$SIBLINGS/$name"
|
||||
|
||||
upgrade_if_stale
|
||||
|
||||
mkdir -p "$SIBLINGS"
|
||||
if [ -d "$dir/.git" ]; then
|
||||
local existing
|
||||
|
||||
+40
-3
@@ -79,9 +79,13 @@ Helpers, from `lib/scenario.sh`:
|
||||
| `cd_install` | Run install.sh as `wget ... \| bash` would, from the fake upstream's main |
|
||||
| `cd_update [VAR=value...]` | Run `update` |
|
||||
| `run_in_vm NAME SCRIPT` | Run SCRIPT in the VM; sets `$OUTPUT` and `$STATUS`, logs to NAME.log |
|
||||
| `upstream_set REF` | Point the fake upstream's main at REF, a commit in this repo |
|
||||
| `upstream_commit MESSAGE SCRIPT` | Run SCRIPT in a clone of the upstream (in the VM), commit, push |
|
||||
| `fingerprint FILE` / `health` | Save the fingerprint / run the health checks |
|
||||
| `upstream_set [PROJECT] REF` | Point the fake upstream's main at REF, a commit in the project's working copy (default: CoreDesktop) |
|
||||
| `upstream_commit [PROJECT] MESSAGE SCRIPT` | Run SCRIPT in a clone of the project's upstream (in the VM), commit, push |
|
||||
| `sibling_add PROJECT` | Run `sibling add` with the sibling project's URL |
|
||||
| `install_chain` | Install CoreDesktop and every sibling in the run, rebooting as the READMEs say |
|
||||
| `fingerprint FILE` | Save the fingerprint |
|
||||
| `health [PROJECT...]` | Run the health checks: by default CoreDesktop's, and those of each sibling in the run that's installed |
|
||||
| `in_run PROJECT` | True if the sibling project is in this run |
|
||||
| `assert_status N`, `assert_output TEXT`, `refute_output TEXT` | Check the last `run_in_vm` |
|
||||
| `assert_vm DESCRIPTION SCRIPT` | SCRIPT must succeed in the VM |
|
||||
| `assert_same_fingerprint EXPECTED ACTUAL` | The two must match; saves the diff |
|
||||
@@ -101,9 +105,42 @@ Helpers, from `lib/scenario.sh`:
|
||||
| `SMOKETEST_RESULTS` | This scenario's folder for logs and fingerprints |
|
||||
| `SMOKETEST_SHARED` | A folder shared by all scenarios in the run |
|
||||
| `IMAGE_REF` | For the installed image, the commit it was installed at |
|
||||
| `SMOKETEST_CHAIN_FILE` | Optional: the projects in the run (below). Without it, the run is CoreDesktop alone, at `SMOKETEST_REF`, in an image at `IMAGE_REF` |
|
||||
|
||||
To build the installed image, the driver calls `smoketest_build_layer CoreDesktop
|
||||
SHA` on the base image instead of `smoketest_prepare`; and for a sibling's
|
||||
image layer, `smoketest_build_layer NAME SHA` on the image below it.
|
||||
|
||||
Anything that boots a VM can drive these scenarios, e.g. a CI runner with KVM.
|
||||
|
||||
## Sibling projects
|
||||
|
||||
A sibling project (HamPack, say) can have scenarios of its own, run on top of
|
||||
CoreDesktop's: `coredesktop-dev smoketest run --with HamPack`. Its working copy,
|
||||
beside CoreDesktop's, has a `smoketest/project.conf`:
|
||||
|
||||
```
|
||||
NAME=HamPack
|
||||
PARENT=CoreDesktop # or a sibling it's built on
|
||||
URLS=(https://gitea.young.computer/david/HamPack.git)
|
||||
```
|
||||
|
||||
and its scenarios in `smoketest/scenarios/`, written like CoreDesktop's with
|
||||
these helpers. Optionally, it has `smoketest/health`, run by `health`, and
|
||||
`smoketest/setup`, run in the VM before every scenario and image build of a
|
||||
run it's in, for what it needs on any machine it's tested on.
|
||||
|
||||
The run includes CoreDesktop's scenarios too, so it also checks the sibling
|
||||
doesn't break CoreDesktop. Each sibling gets a fake upstream in the VM like
|
||||
CoreDesktop's, and the installed image is layered: `installed+HamPack` is
|
||||
installed after `sibling add HamPack`. Scenarios on it start by updating every
|
||||
project to its commit under test.
|
||||
|
||||
The driver describes the run in `SMOKETEST_CHAIN_FILE`, one line per project,
|
||||
CoreDesktop first, tab-separated: name, working copy, commit under test, commit
|
||||
in the image (empty if none), and its URLs, separated by spaces (none for
|
||||
CoreDesktop, whose are `COREDESKTOP_URLS`).
|
||||
|
||||
## Not covered
|
||||
|
||||
NVIDIA drivers, firmware updates (`updates.d/90-firmware.sh`), and anything that
|
||||
|
||||
+257
-48
@@ -3,17 +3,30 @@
|
||||
# Purpose : Helpers and assertions for smoketest scenarios (see ../README.md).
|
||||
# Sourced by the driver after it defines vm_exec, vm_put and
|
||||
# vm_reboot.
|
||||
#
|
||||
# A run tests a chain of projects: CoreDesktop, then any sibling projects
|
||||
# (HamPack, say) the driver was asked for. The driver describes the chain in
|
||||
# the file SMOKETEST_CHAIN_FILE, one line per project, tab-separated:
|
||||
#
|
||||
# name working copy commit under test commit in the image URLs (by spaces)
|
||||
#
|
||||
# CoreDesktop comes first, with no URLs: it has COREDESKTOP_URLS. Without a
|
||||
# chain file, the chain is CoreDesktop alone, at SMOKETEST_REF, in an image at
|
||||
# IMAGE_REF, as drivers before sibling projects described it.
|
||||
|
||||
SMOKETEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
# The CoreDesktop repo whose commits are tested. Overridable for the tests.
|
||||
SMOKETEST_REPO="${SMOKETEST_REPO:-$(cd "$SMOKETEST_DIR/.." && pwd)}"
|
||||
|
||||
# In the VM: the fake upstream, the scratch clone upstream_commit works in, and
|
||||
# where the fingerprint and health scripts are copied to
|
||||
# In the VM: the fake upstreams, the scratch clone upstream_commit works in, and
|
||||
# where the fingerprint, health and setup scripts are copied to
|
||||
SMOKETEST_VM_DIR="${SMOKETEST_VM_DIR:-/srv/smoketest}"
|
||||
UPSTREAM="$SMOKETEST_VM_DIR/coredesktop.git"
|
||||
WORK="$SMOKETEST_VM_DIR/work"
|
||||
|
||||
# The chain's first project
|
||||
ROOT_PROJECT=CoreDesktop
|
||||
|
||||
# Every URL CoreDesktop has been cloned from, so install.sh at any baseline
|
||||
# clones the fake upstream instead
|
||||
COREDESKTOP_URLS=(
|
||||
@@ -46,6 +59,82 @@ skip() {
|
||||
exit "$SKIP_STATUS"
|
||||
}
|
||||
|
||||
# --- The chain ---------------------------------------------------------------
|
||||
|
||||
# The chain file's lines, or CoreDesktop's alone without one
|
||||
chain_lines() {
|
||||
if [ -n "${SMOKETEST_CHAIN_FILE:-}" ]; then
|
||||
cat "$SMOKETEST_CHAIN_FILE"
|
||||
else
|
||||
printf '%s\t%s\t%s\t%s\t\n' "$ROOT_PROJECT" "$SMOKETEST_REPO" "${SMOKETEST_REF:-}" "${IMAGE_REF:-}"
|
||||
fi
|
||||
}
|
||||
|
||||
# The projects in the chain, CoreDesktop first, one per line
|
||||
chain_names() {
|
||||
chain_lines | cut -f1
|
||||
}
|
||||
|
||||
# The sibling projects in the chain, one per line
|
||||
chain_siblings() {
|
||||
chain_names | tail -n +2
|
||||
}
|
||||
|
||||
# chain_field NAME COLUMN: 2 working copy, 3 commit under test, 4 commit in
|
||||
# the image, 5 URLs
|
||||
chain_field() {
|
||||
chain_lines | awk -F'\t' -v n="$1" -v c="$2" '$1 == n { print $c }'
|
||||
}
|
||||
|
||||
project_dir() { chain_field "$1" 2; }
|
||||
project_sha() { chain_field "$1" 3; }
|
||||
image_sha() { chain_field "$1" 4; }
|
||||
|
||||
# project_urls NAME: the URLs project NAME is cloned from, one per line
|
||||
project_urls() {
|
||||
if [ "$1" = "$ROOT_PROJECT" ]; then
|
||||
printf '%s\n' "${COREDESKTOP_URLS[@]}"
|
||||
else
|
||||
chain_field "$1" 5 | tr ' ' '\n' | grep .
|
||||
fi
|
||||
}
|
||||
|
||||
# The URL a sibling project is added from (its first)
|
||||
project_url() {
|
||||
project_urls "$1" | head -n 1
|
||||
}
|
||||
|
||||
# True if project NAME is in this run's chain
|
||||
in_run() {
|
||||
chain_names | grep -qxF "$1"
|
||||
}
|
||||
|
||||
# upstream NAME: the project's fake upstream in the VM
|
||||
upstream() {
|
||||
if [ "$1" = "$ROOT_PROJECT" ]; then
|
||||
echo "$UPSTREAM"
|
||||
else
|
||||
echo "$SMOKETEST_VM_DIR/$1.git"
|
||||
fi
|
||||
}
|
||||
|
||||
# sibling_name NAME: the folder in ~/.local/share/siblings that `sibling add`
|
||||
# clones project NAME into: its URL's last part, without .git
|
||||
sibling_name() {
|
||||
local name
|
||||
name="$(project_url "$1")"
|
||||
name="${name%/}"
|
||||
name="${name##*/}"
|
||||
echo "${name%.git}"
|
||||
}
|
||||
|
||||
# True if sibling project NAME is installed in the VM
|
||||
sibling_installed() {
|
||||
vm_exec "test -d ~/.local/share/siblings/$(q "$(sibling_name "$1")")" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# --- Running things in the VM ------------------------------------------------
|
||||
|
||||
# run_in_vm NAME SCRIPT: run SCRIPT in the VM, keeping its output in $OUTPUT,
|
||||
# its exit status in $STATUS, and both in NN-NAME.log. Doesn't fail on its own:
|
||||
# check with assert_status. The log is written as SCRIPT runs, so a long one
|
||||
@@ -74,63 +163,74 @@ run_in_vm() {
|
||||
progress_ticker() {
|
||||
local start=$SECONDS tick="${SMOKETEST_TICK:-60}" last
|
||||
while sleep "$tick" > /dev/null 2>&1 3>&-; do
|
||||
last="$(tail -c 4096 "$2" | tr '\r' '\n' | grep -v '^[[:space:]]*$' | tail -n 1 | cut -c 1-100)"
|
||||
# -a: a log can hold binary bytes (a progress bar's), and grep would
|
||||
# otherwise print "binary file matches" instead of the line
|
||||
last="$(tail -c 4096 "$2" | tr '\r' '\n' | grep -av '^[[:space:]]*$' | tail -n 1 | tr -cd '[:print:]' | cut -c 1-100)"
|
||||
echo " still running $1 ($(( (SECONDS - start) / 60 )) min)${last:+: $last}"
|
||||
done
|
||||
}
|
||||
|
||||
# Called by the driver once the VM is up, before the scenario
|
||||
smoketest_prepare() {
|
||||
local urls="" url
|
||||
for url in "${COREDESKTOP_URLS[@]}"; do
|
||||
urls+=" $(q "$url")"
|
||||
done
|
||||
vm_exec "set -e
|
||||
[ -d $(q "$UPSTREAM") ] || git init -q --bare --initial-branch=main $(q "$UPSTREAM")
|
||||
# --- Fake upstreams ----------------------------------------------------------
|
||||
|
||||
# Make a bare repo in the VM for each project in the chain, and have git send
|
||||
# the project's real URLs there, so install.sh, sibling add and update run
|
||||
# unchanged
|
||||
setup_upstreams() {
|
||||
local script="set -e
|
||||
git config --global user.name 'CoreDesktop Smoketest'
|
||||
git config --global user.email smoketest@localhost
|
||||
git config --global --unset-all url.$(q "$UPSTREAM").insteadOf || true
|
||||
for url in $urls; do
|
||||
git config --global --add url.$(q "$UPSTREAM").insteadOf \"\$url\"
|
||||
done" || fail "couldn't set up the fake upstream in the VM"
|
||||
|
||||
if [ "${IMAGE:-}" = installed ]; then
|
||||
git -C "$SMOKETEST_REPO" merge-base --is-ancestor "$IMAGE_REF" "$SMOKETEST_REF" \
|
||||
|| fail "the installed image is at $IMAGE_REF, which isn't in the history of" \
|
||||
"the commit under test. Rebuild it: coredesktop-dev smoketest images --installed"
|
||||
upstream_set "$SMOKETEST_REF"
|
||||
cd_update
|
||||
assert_status 0
|
||||
else
|
||||
upstream_set "$SMOKETEST_REF"
|
||||
git config --global user.email smoketest@localhost" name url up
|
||||
while read -r name; do
|
||||
up="$(q "$(upstream "$name")")"
|
||||
script+="
|
||||
[ -d $up ] || git init -q --bare --initial-branch=main $up
|
||||
git config --global --unset-all url.$up.insteadOf || true"
|
||||
while read -r url; do
|
||||
script+="
|
||||
git config --global --add url.$up.insteadOf $(q "$url")"
|
||||
# A sibling may be added by its URL with or without .git; each is matched
|
||||
# as a prefix, and the longer wins
|
||||
if [ "$name" != "$ROOT_PROJECT" ] && [[ "$url" == *.git ]]; then
|
||||
script+="
|
||||
git config --global --add url.$up.insteadOf $(q "${url%.git}")"
|
||||
fi
|
||||
done < <(project_urls "$name")
|
||||
done < <(chain_names)
|
||||
vm_exec "$script" || fail "couldn't set up the fake upstreams in the VM"
|
||||
}
|
||||
|
||||
# Called by the driver to make the installed image from the base image
|
||||
smoketest_install_image() {
|
||||
smoketest_prepare
|
||||
upstream_set "$1"
|
||||
cd_install
|
||||
assert_status 0
|
||||
}
|
||||
|
||||
# upstream_set REF: point the fake upstream's main at REF, a commit in this repo
|
||||
# upstream_set [NAME] REF: point project NAME's (default CoreDesktop's) fake
|
||||
# upstream main at REF, a commit in its working copy
|
||||
upstream_set() {
|
||||
local sha
|
||||
sha="$(git -C "$SMOKETEST_REPO" rev-parse --verify --quiet "$1^{commit}")" \
|
||||
|| fail "no such commit: $1"
|
||||
local name="$ROOT_PROJECT" dir sha
|
||||
if (( $# > 1 )); then
|
||||
name="$1"
|
||||
shift
|
||||
fi
|
||||
dir="$(project_dir "$name")"
|
||||
[ -n "$dir" ] || fail "$name isn't in this run's chain"
|
||||
if ! sha="$(git -C "$dir" rev-parse --verify --quiet "$1^{commit}")"; then
|
||||
[ "$name" = "$ROOT_PROJECT" ] && fail "no such commit: $1"
|
||||
fail "no such commit in $name: $1"
|
||||
fi
|
||||
# --no-verify: a pre-push hook in the working copy (coredesktop-dev's runs
|
||||
# make check) is for pushes to the real upstream, not to the VM
|
||||
GIT_SSH_COMMAND="${VM_GIT_SSH:-ssh}" git -C "$SMOKETEST_REPO" push --quiet --force --no-verify \
|
||||
"${VM_GIT_URL:-}$UPSTREAM" "$sha:refs/heads/main" || fail "couldn't push $1 to the VM"
|
||||
GIT_SSH_COMMAND="${VM_GIT_SSH:-ssh}" git -C "$dir" push --quiet --force --no-verify \
|
||||
"${VM_GIT_URL:-}$(upstream "$name")" "$sha:refs/heads/main" || fail "couldn't push $name $1 to the VM"
|
||||
}
|
||||
|
||||
# upstream_commit MESSAGE SCRIPT: release a new commit, made by running SCRIPT
|
||||
# (in the VM) in a clone of the fake upstream's main
|
||||
# upstream_commit [NAME] MESSAGE SCRIPT: release a new commit of project NAME
|
||||
# (default CoreDesktop), made by running SCRIPT (in the VM) in a clone of its
|
||||
# fake upstream's main
|
||||
upstream_commit() {
|
||||
local name="$ROOT_PROJECT"
|
||||
if (( $# > 2 )); then
|
||||
name="$1"
|
||||
shift
|
||||
fi
|
||||
in_run "$name" || fail "$name isn't in this run's chain"
|
||||
run_in_vm commit "set -e
|
||||
rm -rf $(q "$WORK")
|
||||
git clone -q $(q "$UPSTREAM") $(q "$WORK")
|
||||
git clone -q $(q "$(upstream "$name")") $(q "$WORK")
|
||||
cd $(q "$WORK")
|
||||
$2
|
||||
git add -A
|
||||
@@ -139,6 +239,75 @@ upstream_commit() {
|
||||
assert_status 0
|
||||
}
|
||||
|
||||
# Run each project's smoketest/setup in the VM, if it has one: what a project
|
||||
# needs set up on any machine it's tested on (HamPack's turns off its Windows
|
||||
# installers, which wait for clicks no one makes)
|
||||
run_setup_scripts() {
|
||||
local name script
|
||||
while read -r name; do
|
||||
script="$(project_dir "$name")/smoketest/setup"
|
||||
[ -f "$script" ] || continue
|
||||
vm_put "$script" "$SMOKETEST_VM_DIR/setup-$name" || fail "couldn't copy $name's setup script to the VM"
|
||||
run_in_vm "setup-$name" "bash $(q "$SMOKETEST_VM_DIR/setup-$name")"
|
||||
assert_status 0
|
||||
done < <(chain_names)
|
||||
}
|
||||
|
||||
# --- Called by the driver ----------------------------------------------------
|
||||
|
||||
# Once the VM is up, before the scenario: point each fake upstream at the
|
||||
# commit under test. On the installed image, update to it.
|
||||
smoketest_prepare() {
|
||||
local name image
|
||||
setup_upstreams
|
||||
run_setup_scripts
|
||||
while read -r name; do
|
||||
if [ "${IMAGE:-}" = installed ]; then
|
||||
image="$(image_sha "$name")"
|
||||
git -C "$(project_dir "$name")" merge-base --is-ancestor "$image" "$(project_sha "$name")" \
|
||||
|| fail "the installed image has $name at $image, which isn't in the history of the" \
|
||||
"commit under test. Rebuild it: coredesktop-dev smoketest images installed" \
|
||||
"(with the same --with options)"
|
||||
fi
|
||||
upstream_set "$name" "$(project_sha "$name")"
|
||||
done < <(chain_names)
|
||||
|
||||
if [ "${IMAGE:-}" = installed ]; then
|
||||
cd_update
|
||||
assert_status 0
|
||||
fi
|
||||
}
|
||||
|
||||
# To build an image layer: install project NAME at SHA on a machine that has
|
||||
# the projects before it in the chain, then reboot, as the READMEs say to
|
||||
smoketest_build_layer() {
|
||||
local name="$1" sha="$2" other
|
||||
setup_upstreams
|
||||
run_setup_scripts
|
||||
while read -r other; do
|
||||
upstream_set "$other" "$(image_sha "$other")"
|
||||
done < <(chain_names | grep -vxF "$name")
|
||||
upstream_set "$name" "$sha"
|
||||
if [ "$name" = "$ROOT_PROJECT" ]; then
|
||||
cd_install
|
||||
else
|
||||
sibling_add "$name"
|
||||
fi
|
||||
assert_status 0
|
||||
vm_reboot
|
||||
}
|
||||
|
||||
# For drivers from before smoketest_build_layer: the installed image from the
|
||||
# base image
|
||||
smoketest_install_image() {
|
||||
smoketest_prepare
|
||||
upstream_set "$1"
|
||||
cd_install
|
||||
assert_status 0
|
||||
}
|
||||
|
||||
# --- What a person would run -------------------------------------------------
|
||||
|
||||
# Run install.sh the way the README's wget ... | bash does: main's install.sh,
|
||||
# with no terminal to ask questions on
|
||||
cd_install() {
|
||||
@@ -157,6 +326,28 @@ cd_update() {
|
||||
run_in_vm update "TERM=dumb env$vars ~/.local/bin/update"
|
||||
}
|
||||
|
||||
# sibling_add NAME: add sibling project NAME from its (real) URL, as its README
|
||||
# says to
|
||||
sibling_add() {
|
||||
in_run "$1" || fail "$1 isn't in this run's chain"
|
||||
run_in_vm "sibling-add-$1" "TERM=dumb ~/.local/bin/sibling add $(q "$(project_url "$1")")"
|
||||
}
|
||||
|
||||
# Install CoreDesktop and every sibling in the chain at the commits under test,
|
||||
# as a person would on a fresh machine, rebooting where the READMEs say to
|
||||
install_chain() {
|
||||
local name added=0
|
||||
cd_install
|
||||
assert_status 0
|
||||
vm_reboot
|
||||
while read -r name; do
|
||||
sibling_add "$name"
|
||||
assert_status 0
|
||||
added=1
|
||||
done < <(chain_siblings)
|
||||
(( added == 0 )) || vm_reboot
|
||||
}
|
||||
|
||||
# fingerprint FILE: save the machine's fingerprint to FILE
|
||||
fingerprint() {
|
||||
vm_put "$SMOKETEST_DIR/fingerprint" "$SMOKETEST_VM_DIR/fingerprint" \
|
||||
@@ -170,13 +361,31 @@ reference_fingerprint() {
|
||||
echo "$SMOKETEST_SHARED/fresh-install.fingerprint"
|
||||
}
|
||||
|
||||
# Run the health checks; fail the scenario if any fails
|
||||
# health [NAME...]: run the health checks of the projects named (default:
|
||||
# CoreDesktop, and each sibling in the chain that's installed in the VM and has
|
||||
# a smoketest/health); fail the scenario if any fails
|
||||
health() {
|
||||
vm_put "$SMOKETEST_DIR/health" "$SMOKETEST_VM_DIR/health" \
|
||||
|| fail "couldn't copy the health script to the VM"
|
||||
run_in_vm health "bash $(q "$SMOKETEST_VM_DIR/health")"
|
||||
local names=("$@") name script dest log failed=()
|
||||
if (( ${#names[@]} == 0 )); then
|
||||
names=("$ROOT_PROJECT")
|
||||
while read -r name; do
|
||||
[ -f "$(project_dir "$name")/smoketest/health" ] && sibling_installed "$name" && names+=("$name")
|
||||
done < <(chain_siblings)
|
||||
fi
|
||||
for name in "${names[@]}"; do
|
||||
if [ "$name" = "$ROOT_PROJECT" ]; then
|
||||
script="$SMOKETEST_DIR/health" dest="$SMOKETEST_VM_DIR/health" log=health
|
||||
else
|
||||
script="$(project_dir "$name")/smoketest/health"
|
||||
dest="$SMOKETEST_VM_DIR/health-$name" log="health-$name"
|
||||
[ -f "$script" ] || fail "$name has no smoketest/health"
|
||||
fi
|
||||
vm_put "$script" "$dest" || fail "couldn't copy $name's health script to the VM"
|
||||
run_in_vm "$log" "bash $(q "$dest")"
|
||||
printf '%s\n' "$OUTPUT"
|
||||
[ "$STATUS" -eq 0 ] || fail "the health checks failed"
|
||||
[ "$STATUS" -eq 0 ] || failed+=("$name")
|
||||
done
|
||||
(( ${#failed[@]} == 0 )) || fail "the health checks failed for: ${failed[*]}"
|
||||
}
|
||||
|
||||
assert_status() {
|
||||
|
||||
@@ -15,20 +15,20 @@ CONFIGURE_HINT="configure connects to your Federated Core, sets up backups and s
|
||||
echo
|
||||
echo -e "\e[32mCoreDesktop is installed.\e[0m"
|
||||
|
||||
# If the running kernel's modules are gone, a newer kernel was installed during
|
||||
# this run. configure waits for the reboot: until then, modules it needs, such
|
||||
# as Tailscale's tun and davfs2's fuse, can't be loaded. The reboot waits for
|
||||
# the initramfs to build.
|
||||
# If a newer kernel was installed during this run, configure waits for the
|
||||
# reboot: until then, the modules it needs (Tailscale's tun, davfs2's fuse) are
|
||||
# at best kernel-modules-hook's temporary copy. The reboot waits for the
|
||||
# initramfs to build.
|
||||
if initramfs_build_failed; then
|
||||
# check_initramfs (install.sh) has said why; offering a reboot now could
|
||||
# leave the computer unable to start
|
||||
echo -e "\e[31mDon't reboot yet: the initramfs doesn't build (see above, or $PACMAN_UPDATE_LOG).\e[0m"
|
||||
if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
if newer_kernel_installed; then
|
||||
echo "Once it builds (sudo mkinitcpio -P), reboot, then run: configure"
|
||||
echo "$CONFIGURE_HINT"
|
||||
exit 0
|
||||
fi
|
||||
elif [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
elif newer_kernel_installed; then
|
||||
echo "A newer kernel has been installed. Reboot, then run: configure"
|
||||
echo "$CONFIGURE_HINT"
|
||||
# The same as the system menu's restart: an active desktop session needs no password
|
||||
|
||||
@@ -51,6 +51,16 @@ answer() {
|
||||
not_called configure
|
||||
}
|
||||
|
||||
@test "finish-install asks for a reboot when the running kernel's modules are only kernel-modules-hook's copy" {
|
||||
export COREDESKTOP_MODULES_DIR="$BATS_TEST_TMPDIR/modules"
|
||||
KERNEL=0.0.0-kept-by-hook
|
||||
mkdir -p "$COREDESKTOP_MODULES_DIR/$KERNEL"
|
||||
run bash "$REPO/system/finish-install.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"A newer kernel has been installed. Reboot, then run: configure"* ]]
|
||||
not_called configure
|
||||
}
|
||||
|
||||
@test "finish-install says the install worked before offering configure" {
|
||||
needs_modules
|
||||
ITEMS="to do core Federated Core"
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
# updates.d/99-reboot-check.sh, with a fake /usr/lib/modules and pacman
|
||||
|
||||
setup() {
|
||||
common_setup
|
||||
mkdir -p "$HOME/.local/share"
|
||||
ln -s "$REPO" "$HOME/.local/share/coredesktop"
|
||||
export COREDESKTOP_MODULES_DIR="$BATS_TEST_TMPDIR/modules"
|
||||
RUNNING="$COREDESKTOP_MODULES_DIR/$(uname -r)"
|
||||
NEEDED="$HOME/.local/state/coredesktop/reboot-needed"
|
||||
# pacman -Qo: the running kernel's modules belong to linux, unless OWNED is empty
|
||||
export OWNED=linux
|
||||
stub pacman '[ "$1" = -Qqo ] && [ -n "$OWNED" ] && echo "$OWNED"'
|
||||
}
|
||||
|
||||
@test "reboot check: nothing to do when the running kernel's modules are the installed kernel's" {
|
||||
mkdir -p "$RUNNING"
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$NEEDED" ]
|
||||
}
|
||||
|
||||
@test "reboot check: a reboot is needed when the running kernel's modules are gone" {
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[[ "$output" == *"Please reboot"*"a newer kernel was installed"* ]]
|
||||
[ "$(cat "$NEEDED")" = "a newer kernel was installed" ]
|
||||
}
|
||||
|
||||
@test "reboot check: a reboot is needed when they're only kernel-modules-hook's copy" {
|
||||
mkdir -p "$RUNNING"
|
||||
OWNED=""
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[ "$(cat "$NEEDED")" = "a newer kernel was installed" ]
|
||||
}
|
||||
@@ -12,6 +12,29 @@ setup() {
|
||||
ORIGINS="$BATS_TEST_TMPDIR/origins"
|
||||
SIBLINGS="$HOME/.local/share/siblings"
|
||||
mkdir -p "$ORIGINS" "$SIBLINGS"
|
||||
# pacman's log, with an upgrade an hour ago, and an update that logs its runs
|
||||
export SIBLING_PACMAN_LOG="$BATS_TEST_TMPDIR/pacman.log"
|
||||
upgraded_hours_ago 1
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
printf '%s\n' '#!/bin/bash' 'echo "update ran" >> "$HOME/update.log"' > "$HOME/.local/bin/update"
|
||||
chmod +x "$HOME/.local/bin/update"
|
||||
}
|
||||
|
||||
# upgraded_hours_ago N: pacman's log says the last full upgrade was N hours ago
|
||||
upgraded_hours_ago() {
|
||||
{
|
||||
echo "[$(date -d '30 days ago' +%Y-%m-%dT%H:%M:%S%z)] [PACMAN] starting full system upgrade"
|
||||
echo "[$(date -d "$1 hours ago" +%Y-%m-%dT%H:%M:%S%z)] [PACMAN] starting full system upgrade"
|
||||
echo "[$(date +%Y-%m-%dT%H:%M:%S%z)] [PACMAN] Running 'pacman -S foo'"
|
||||
} > "$SIBLING_PACMAN_LOG"
|
||||
}
|
||||
|
||||
# A sibling's origin whose install.sh records that it ran
|
||||
installable() {
|
||||
git init -q -b main "$ORIGINS/$1"
|
||||
echo 'touch "$HOME/installed-$(basename "$PWD")"' > "$ORIGINS/$1/install.sh"
|
||||
git -C "$ORIGINS/$1" add -A
|
||||
git -C "$ORIGINS/$1" commit -qm first
|
||||
}
|
||||
|
||||
# origin NAME: make a repo with one commit, and clone it as a sibling
|
||||
@@ -112,3 +135,46 @@ commit() {
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"No sibling named 'nope' is installed."* ]]
|
||||
}
|
||||
|
||||
@test "sibling add clones the sibling and runs its install.sh" {
|
||||
installable tools
|
||||
run bash "$REPO/sibling" add "$ORIGINS/tools"
|
||||
[ "$status" -eq 0 ]
|
||||
[ -f "$HOME/installed-tools" ]
|
||||
[[ "$output" == *"Installed tools "* ]]
|
||||
[ ! -e "$HOME/update.log" ]
|
||||
}
|
||||
|
||||
@test "sibling add runs update first when the last upgrade is over a day old" {
|
||||
installable tools
|
||||
upgraded_hours_ago 50
|
||||
run bash "$REPO/sibling" add "$ORIGINS/tools"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"last upgraded 2 day(s) ago. Running update first"* ]]
|
||||
[ "$(cat "$HOME/update.log")" = "update ran" ]
|
||||
[ -f "$HOME/installed-tools" ]
|
||||
}
|
||||
|
||||
@test "sibling add runs update first when it can't tell when the system was upgraded" {
|
||||
installable tools
|
||||
: > "$SIBLING_PACMAN_LOG"
|
||||
run bash "$REPO/sibling" add "$ORIGINS/tools"
|
||||
[[ "$output" == *"Couldn't tell when this system was last upgraded"* ]]
|
||||
[ "$(cat "$HOME/update.log")" = "update ran" ]
|
||||
}
|
||||
|
||||
@test "sibling add goes on if update fails, and doesn't run update inside update" {
|
||||
installable tools
|
||||
upgraded_hours_ago 50
|
||||
printf '%s\n' '#!/bin/bash' 'echo "update ran" >> "$HOME/update.log"; exit 1' > "$HOME/.local/bin/update"
|
||||
run bash "$REPO/sibling" add "$ORIGINS/tools"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"update reported errors (above); adding the sibling anyway."* ]]
|
||||
[ -f "$HOME/installed-tools" ]
|
||||
|
||||
rm "$HOME/update.log"
|
||||
installable more
|
||||
COREDESKTOP_ALLOW_PACMAN=1 run bash "$REPO/sibling" add "$ORIGINS/more"
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$HOME/update.log" ]
|
||||
}
|
||||
|
||||
@@ -238,3 +238,146 @@ upstream_main() {
|
||||
git -C "$REPO" rev-parse --verify --quiet "$ref^{commit}" > /dev/null || { echo "unknown: $ref"; exit 1; }
|
||||
done
|
||||
}
|
||||
|
||||
# --- Sibling projects ---
|
||||
|
||||
# A sibling project, HamPack, with two commits, and a chain file with
|
||||
# CoreDesktop and it: CoreDesktop at V1 in the image and V2 under test,
|
||||
# HamPack likewise at S1 and S2
|
||||
chain_with_sibling() {
|
||||
SIB="$BATS_TEST_TMPDIR/HamPack"
|
||||
git init -q "$SIB"
|
||||
echo s1 > "$SIB/version"
|
||||
git -C "$SIB" add version
|
||||
git -C "$SIB" commit -qm s1
|
||||
S1="$(git -C "$SIB" rev-parse HEAD)"
|
||||
echo s2 > "$SIB/version"
|
||||
git -C "$SIB" commit -qam s2
|
||||
S2="$(git -C "$SIB" rev-parse HEAD)"
|
||||
export SMOKETEST_CHAIN_FILE="$BATS_TEST_TMPDIR/chain"
|
||||
printf 'CoreDesktop\t%s\t%s\t%s\t\n' "$SMOKETEST_REPO" "$V2" "$V1" > "$SMOKETEST_CHAIN_FILE"
|
||||
printf 'HamPack\t%s\t%s\t%s\t%s\n' "$SIB" "$S2" "$S1" \
|
||||
"https://example.com/david/HamPack.git https://example.org/HamPack.git" >> "$SMOKETEST_CHAIN_FILE"
|
||||
SIB_UPSTREAM="$SMOKETEST_VM_DIR/HamPack.git"
|
||||
# A fake `sibling add`, which clones like the real one, and update and reboot
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
printf '%s\n' '#!/bin/bash' 'echo "sibling $*" >> ~/vm.log' \
|
||||
'git clone -q "$2" ~/.local/share/siblings/"$(basename "${2%.git}")"' > "$HOME/.local/bin/sibling"
|
||||
printf '%s\n' '#!/bin/bash' 'echo update >> ~/vm.log' > "$HOME/.local/bin/update"
|
||||
chmod +x "$HOME/.local/bin/sibling" "$HOME/.local/bin/update"
|
||||
vm_reboot() { echo reboot >> "$HOME/vm.log"; }
|
||||
}
|
||||
|
||||
@test "without a chain file, the chain is CoreDesktop at the commit under test" {
|
||||
[ "$(chain_names)" = CoreDesktop ]
|
||||
[ "$(project_sha CoreDesktop)" = "$V2" ]
|
||||
[ -z "$(chain_siblings)" ]
|
||||
}
|
||||
|
||||
@test "prepare makes a fake upstream for each project, and sends its URLs there" {
|
||||
chain_with_sibling
|
||||
smoketest_prepare
|
||||
[ "$(upstream_main)" = "$V2" ]
|
||||
[ "$(git --git-dir="$SIB_UPSTREAM" rev-parse main)" = "$S2" ]
|
||||
for url in https://example.com/david/HamPack.git https://example.com/david/HamPack https://example.org/HamPack.git; do
|
||||
git clone -q "$url" "$BATS_TEST_TMPDIR/clone"
|
||||
[ "$(cat "$BATS_TEST_TMPDIR/clone/version")" = s2 ]
|
||||
rm -rf "$BATS_TEST_TMPDIR/clone"
|
||||
done
|
||||
}
|
||||
|
||||
@test "prepare on the installed image checks every project's image commit, then updates once" {
|
||||
chain_with_sibling
|
||||
export IMAGE=installed
|
||||
run smoketest_prepare
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(cat "$HOME/vm.log")" = update ]
|
||||
|
||||
printf 'HamPack\t%s\t%s\t%s\t%s\n' "$SIB" "$S1" "$S2" https://example.com/HamPack.git \
|
||||
> "$BATS_TEST_TMPDIR/hampack-line"
|
||||
sed -i '2d' "$SMOKETEST_CHAIN_FILE"
|
||||
cat "$BATS_TEST_TMPDIR/hampack-line" >> "$SMOKETEST_CHAIN_FILE"
|
||||
run smoketest_prepare
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"the installed image has HamPack at $S2, which isn't in the history"* ]]
|
||||
}
|
||||
|
||||
@test "upstream_set and upstream_commit take a project's name" {
|
||||
chain_with_sibling
|
||||
smoketest_prepare
|
||||
upstream_set HamPack "$S1"
|
||||
[ "$(git --git-dir="$SIB_UPSTREAM" rev-parse main)" = "$S1" ]
|
||||
[ "$(upstream_main)" = "$V2" ]
|
||||
|
||||
upstream_commit HamPack "Bump" 'echo s3 > version'
|
||||
[ "$(git --git-dir="$SIB_UPSTREAM" show main:version)" = s3 ]
|
||||
[ "$(upstream_main)" = "$V2" ]
|
||||
|
||||
run upstream_set HamPack nosuchcommit
|
||||
[[ "$output" == *"no such commit in HamPack: nosuchcommit"* ]]
|
||||
run upstream_commit Nope "x" true
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"Nope isn't in this run's chain"* ]]
|
||||
}
|
||||
|
||||
@test "building a sibling's layer adds it at its commit, over the others at their image's, and reboots" {
|
||||
chain_with_sibling
|
||||
smoketest_build_layer HamPack "$S2"
|
||||
[ "$(upstream_main)" = "$V1" ]
|
||||
[ "$(cat "$HOME/.local/share/siblings/HamPack/version")" = s2 ]
|
||||
[ "$(cat "$HOME/vm.log")" = "$(printf 'sibling add https://example.com/david/HamPack.git\nreboot')" ]
|
||||
}
|
||||
|
||||
@test "building CoreDesktop's layer runs install.sh at its commit" {
|
||||
vm_reboot() { echo reboot >> "$HOME/vm.log"; }
|
||||
smoketest_build_layer CoreDesktop "$V1"
|
||||
[ "$(cat "$HOME/vm.log")" = reboot ]
|
||||
[ "$(head -n 1 "$HOME/installed")" = v1 ]
|
||||
}
|
||||
|
||||
@test "install_chain installs CoreDesktop, reboots, adds each sibling and reboots again" {
|
||||
chain_with_sibling
|
||||
smoketest_prepare
|
||||
install_chain
|
||||
[ "$(cat "$HOME/vm.log")" = "$(printf 'reboot\nsibling add https://example.com/david/HamPack.git\nreboot')" ]
|
||||
[ "$(head -n 1 "$HOME/installed")" = v2 ]
|
||||
}
|
||||
|
||||
@test "a project's setup script runs in the VM before the scenario" {
|
||||
chain_with_sibling
|
||||
mkdir -p "$SIB/smoketest"
|
||||
echo 'echo set up > ~/setup-ran' > "$SIB/smoketest/setup"
|
||||
smoketest_prepare
|
||||
[ "$(cat "$HOME/setup-ran")" = "set up" ]
|
||||
|
||||
echo 'exit 1' > "$SIB/smoketest/setup"
|
||||
run smoketest_prepare
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"setup-HamPack exited 1"* ]]
|
||||
}
|
||||
|
||||
@test "health checks CoreDesktop, and each sibling that's installed and has health checks" {
|
||||
chain_with_sibling
|
||||
mkdir -p "$SIB/smoketest"
|
||||
echo 'echo hampack healthy' > "$SIB/smoketest/health"
|
||||
SMOKETEST_DIR="$BATS_TEST_TMPDIR/cd-smoketest"
|
||||
mkdir -p "$SMOKETEST_DIR"
|
||||
echo 'echo coredesktop healthy' > "$SMOKETEST_DIR/health"
|
||||
|
||||
run health
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"coredesktop healthy"* ]]
|
||||
[[ "$output" != *"hampack healthy"* ]]
|
||||
|
||||
mkdir -p "$HOME/.local/share/siblings/HamPack"
|
||||
run health
|
||||
[[ "$output" == *"coredesktop healthy"*"hampack healthy"* ]]
|
||||
|
||||
echo 'exit 1' > "$SIB/smoketest/health"
|
||||
run health
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"the health checks failed for: HamPack"* ]]
|
||||
|
||||
run health CoreDesktop
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ common_setup() {
|
||||
# Set when the tests run inside a smoketest (a pre-push hook's checks, say),
|
||||
# where they would point the smoketest tests at the real VM
|
||||
unset VM_GIT_SSH VM_GIT_URL SMOKETEST_REPO SMOKETEST_RESULTS SMOKETEST_SHARED \
|
||||
SMOKETEST_REF SMOKETEST_VM_DIR IMAGE_REF VARIANT
|
||||
SMOKETEST_REF SMOKETEST_VM_DIR SMOKETEST_CHAIN_FILE IMAGE_REF VARIANT
|
||||
}
|
||||
|
||||
# A test file that needs more setup defines its own setup that calls this first
|
||||
|
||||
@@ -17,8 +17,7 @@ fi
|
||||
|
||||
reasons=()
|
||||
|
||||
# If the running kernel's modules are gone, a newer kernel was installed
|
||||
if [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
if newer_kernel_installed; then
|
||||
reasons+=("a newer kernel was installed")
|
||||
fi
|
||||
|
||||
|
||||
@@ -187,6 +187,15 @@ run_migrations() {
|
||||
done
|
||||
}
|
||||
|
||||
# True if a newer kernel was installed since this one booted: the running
|
||||
# kernel's modules are gone, or are only kernel-modules-hook's copy of them,
|
||||
# which no package owns
|
||||
newer_kernel_installed() {
|
||||
local modules
|
||||
modules="${COREDESKTOP_MODULES_DIR:-/usr/lib/modules}/$(uname -r)"
|
||||
[ ! -d "$modules" ] || ! pacman -Qqo "$modules" &> /dev/null
|
||||
}
|
||||
|
||||
# Output of the last update's pacman -Su, written by updates.d/10-pacman.sh
|
||||
PACMAN_UPDATE_LOG="$HOME/.local/state/coredesktop/pacman-update.log"
|
||||
|
||||
|
||||
@@ -121,8 +121,7 @@ case "$kernel" in
|
||||
*) kernel_pkg="${kernel_pkg:-linux}" ;;
|
||||
esac
|
||||
|
||||
# If the running kernel's modules are gone, a newer kernel was installed
|
||||
if [ ! -d "/usr/lib/modules/$kernel" ]; then
|
||||
if newer_kernel_installed; then
|
||||
kernel="$kernel (newer kernel installed, reboot to use it)"
|
||||
fi
|
||||
if latest="$(newer_package "$kernel_pkg")"; then
|
||||
|
||||
Reference in New Issue
Block a user