Files
komorebi/scripts/linux/sync-e2e-core
T
LGUG2Z 70010996da refactor(repo): move the KDE scripts and spikes to the top level (pure move)
komorebi-for-kde/scripts/ -> scripts/linux/
komorebi-for-kde/spikes/  -> spikes/

Renames only. The scripts' own references to the old directories (and to komorebi/src of
the old trees) are fixed in the path-fixing revision of this stack.
2026-11-05 15:03:27 -08:00

59 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Checks that the copy of the platform-neutral part of the VM library in this tree is in step with
# the root e2e/lib of the komorebi repository (the plan in docs/dev/vm-tests.md, "Writing a
# scenario"): the package komorebi_vm.core, and the unit tests that belong to it. The SOURCE OF TRUTH
# IS THE ROOT e2e/lib, where the core is on its way to the Windows tree, and this tree's copy follows
# it. The script goes away once the root flake builds the KDE VM tests from e2e/lib; until then the
# KDE flake cannot reach ../, so the copy stays.
#
# scripts/sync-e2e-core --check ../e2e/lib say what differs, and exit 1 if anything does
# scripts/sync-e2e-core DEST copy THIS tree's core into DEST/komorebi_vm/core,
# DEST/tests and DEST/tests/fixtures. That is the direction
# from before the move: the root is the source now, so
# do not point it at ../e2e/lib; copy the other way by hand.
#
# Nothing else of DEST is touched, and a file of DEST that is not here is reported and left alone.
set -euo pipefail
check=0
if [ "${1:-}" = --check ]; then
check=1
shift
fi
dest=${1:?usage: sync-e2e-core [--check] DEST}
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
lib=$repo/nix/tests/vm/lib
tests=(fake_platform.py fake_strip.py fake_wallpaper.py test_checks.py test_suite.py test_pixels.py test_snapshot.py test_recorded.py test_tiling.py
test_focus_moving.py)
status=0
sync() {
local from=$1 to=$2
if [ "$check" = 1 ]; then
diff -r -x __pycache__ "$from" "$to" >/dev/null 2>&1 || { echo "differs: $to"; status=1; }
else
mkdir -p "$to"
rsync -a --delete --exclude __pycache__ "$from"/ "$to"/
fi
}
sync "$lib/komorebi_vm/core" "$dest/komorebi_vm/core"
sync "$lib/tests/fixtures" "$dest/tests/fixtures"
for t in "${tests[@]}"; do
if [ "$check" = 1 ]; then
cmp -s "$lib/tests/$t" "$dest/tests/$t" || { echo "differs: $dest/tests/$t"; status=1; }
else
mkdir -p "$dest/tests"
cp "$lib/tests/$t" "$dest/tests/$t"
fi
done
if [ "$check" = 0 ]; then
echo "synced komorebi_vm/core and ${#tests[@]} tests into $dest"
else
[ "$status" = 0 ] && echo "in step"
fi
exit "$status"