Artifact cfa9afd3e474a01ccde498b4cf88b649d6b4ac2818e97291be25f4c35e328558:
- File
test/store.sh
— part of check-in
[2f274ce15b]
at
2026-11-12 22:28:09
on branch trunk
— Phase 2: the store, a working copy that is never half written
The store is a working copy of a wardrobe, kept through libfossil's C API with suit's own file writer: every file is written beside itself and renamed, so a reader sees the old file or the new one.
suit store open, status and update, suit commit and suit back. An update refuses when there are local changes, runs as a dry run first, and changes nothing if any file would conflict.
Proven here: the store is byte-identical to fossil's own checkout of a 600-file wardrobe at each version; a reader hashing files during a slowed update saw only old or new contents; an update that fails at any call leaves the old bytes and no temporary file. 100% of functions, lines, regions and branches in all ten source files.
Vendored, unedited: libfossil trunk f2983dcd78, SQLite 3.55.0, zlib 1.3.1. The release binary links only the system library.
Speed: with everything linked, suit costs 0.82 ms over an empty program quiet and up to 1.38 ms under load, which is over budget. The timer's entry point is now suit-run, a 35 KB program built from the no-change path alone, at 0.40 ms quiet and about 0.5 ms loaded. It runs suit only when something changed. The budget test is on suit-run.
Known limits, recorded in docs/decisions.md: libfossil's checkout writes symlinks as regular files, so wardrobes may not hold them; suit back undoes an update and not a check-in; and a store left half updated by a double failure has no repair command yet.
Not yet run: Fil-C and the Linux build of this phase. (user: dmestas, size: 20698) [annotate] [blame] [check-ins using]
#!/bin/sh # Shell tests for the store: open, status, commit, update, back. They run on # test/fixtures/wardrobe.fossil, so they need no stock fossil; the cases that # compare against stock fossil say so and skip when it is not installed. # SUIT names the binary under test (default build/dev/suit). SUIT=${SUIT:-build/dev/suit} case $SUIT in /*) ;; *) SUIT=$PWD/$SUIT ;; esac ROOT=$PWD FIXTURE=$ROOT/test/fixtures/wardrobe.fossil mkdir -p build/tmp T=$(mktemp -d "$ROOT/build/tmp/store.XXXXXX") || exit 1 trap 'rm -rf "$T"' EXIT INT TERM total=0 failed=0 pass() { total=$((total + 1)); echo "ok $1"; } bad() { total=$((total + 1)); failed=$((failed + 1)) echo "FAIL $1${2:+: $2}" } skip() { echo "skip $1: $2"; } have_fossil() { command -v fossil >/dev/null 2>&1; } export USER=tester unset LOGNAME # check NAME WANT_RC [STDERR_SUBSTRING] -- COMMAND... (output in $T/out, $T/err) check() { cname=$1; cwant=$2; cmsg=$3; shift 4 "$@" >"$T/out" 2>"$T/err"; crc=$? if [ "$crc" != "$cwant" ]; then bad "$cname" "exit $crc, want $cwant: $(cat "$T/err")" elif [ -n "$cmsg" ] && ! grep -qF -- "$cmsg" "$T/err"; then bad "$cname" "want '$cmsg' in: $(cat "$T/err")" else pass "$cname"; fi } # fresh NAME: a new SUIT_HOME with the fixture wardrobe as NAME fresh() { rm -rf "$T/home" mkdir -p "$T/home/wardrobes" cp "$FIXTURE" "$T/home/wardrobes/$1.fossil" export SUIT_HOME="$T/home" } # tree DIR: every file with its content sum and mode bits, to compare two trees tree() { (cd "$1" && find . \( -name .fslckout -o -name '.suit-tmp.*' \) -prune -o -type f -print | sort | while read -r f; do if [ -x "$f" ]; then m=x; else m=-; fi printf '%s %s %s\n' "$f" "$(cksum < "$f")" "$m" done) } store=$T/home/store # ---- open ------------------------------------------------------------------- fresh wd check open-new-store 0 "" -- "$SUIT" store open wd tree "$store/wd" > "$T/tree1" if [ "$(wc -l < "$T/tree1" | tr -d ' ')" = 4 ] && grep -q "^./run.sh .* x$" "$T/tree1" && grep -q "^./skills/gamma.md .* -$" "$T/tree1" && [ ! -e "$store/wd/skills/beta" ]; then pass open-extracts-tip-files-and-modes; else bad open-extracts-tip-files-and-modes "$(cat "$T/tree1")"; fi [ "$(cat "$store/wd/skills/alpha/SKILL.md")" = "alpha v2" ] && pass open-file-contents || bad open-file-contents check open-twice-is-idempotent 0 "" -- "$SUIT" store open wd tree "$store/wd" > "$T/tree2" cmp -s "$T/tree1" "$T/tree2" && pass open-twice-changes-nothing || bad open-twice-changes-nothing check status-clean-after-open 0 "" -- "$SUIT" store status wd [ ! -s "$T/out" ] && pass status-clean-prints-nothing || bad status-clean-prints-nothing "$(cat "$T/out")" check open-bad-name 2 "is not a wardrobe name" -- "$SUIT" store open 'bad/name' check open-empty-name 2 "is not a wardrobe name" -- "$SUIT" store open '' check open-no-such-wardrobe 1 "no wardrobe at $T/home/wardrobes/nosuch.fossil" -- "$SUIT" store open nosuch check open-no-user 1 "cannot tell who you are" -- env -u USER -u LOGNAME "$SUIT" store open wd check open-empty-user 1 "cannot tell who you are" -- env USER= "$SUIT" store open wd check open-empty-user-and-logname 1 "cannot tell who you are" -- env USER= LOGNAME= "$SUIT" store open wd check open-user-from-logname 0 "" -- env -u USER LOGNAME=other "$SUIT" store open wd check open-no-home-at-all 1 "neither SUIT_HOME nor HOME is set" -- env -u SUIT_HOME -u HOME "$SUIT" store open wd # -- the folders open makes for n in 1 2 3; do fresh wd check "open-mkdir-$n-fails" 1 "cannot create" -- env SUIT_FAULT=mkdir:$n:EACCES "$SUIT" store open wd done # -- a wardrobe that is not one fresh wd printf 'this is not a database' > "$T/home/wardrobes/wd.fossil" check open-corrupt-wardrobe 1 "store wd: open the wardrobe failed" -- "$SUIT" store open wd fresh wd : > "$T/home/wardrobes/wd.fossil" check open-empty-wardrobe-file 1 "failed" -- "$SUIT" store open wd # -- an open that stops part way is finished by the next one fresh wd check open-stops-at-first-file-write 1 "extract the files failed" -- env SUIT_FAULT=rename:2 "$SUIT" store open wd check open-resumes-after-a-stop 0 "" -- "$SUIT" store open wd tree "$store/wd" > "$T/tree3" cmp -s "$T/tree1" "$T/tree3" && pass open-resume-matches-fresh-open || bad open-resume-matches-fresh-open "$(diff "$T/tree1" "$T/tree3")" check status-clean-after-resume 0 "" -- "$SUIT" store status wd [ ! -s "$T/out" ] && pass status-clean-after-resume-prints-nothing || bad status-clean-after-resume-prints-nothing "$(cat "$T/out")" if ls "$store/wd"/.suit-tmp.* "$store/wd"/*/.suit-tmp.* >/dev/null 2>&1; then bad failed-open-leaves-no-temp-file; else pass failed-open-leaves-no-temp-file; fi # ---- status ------------------------------------------------------------------ fresh wd "$SUIT" store open wd >/dev/null 2>&1 cp "$FIXTURE" "$T/home/wardrobes/other.fossil" check status-before-open 1 "open the working copy failed" -- "$SUIT" store status other printf 'edited\n' > "$store/wd/skills/alpha/SKILL.md" printf 'new\n' > "$store/wd/skills/delta.md" mkdir -p "$store/wd/newdir/deeper" printf 'deep\n' > "$store/wd/newdir/deeper/file.md" rm "$store/wd/agents/reviewer.md" chmod -x "$store/wd/run.sh" "$SUIT" store status wd > "$T/status" 2>"$T/err"; rc=$? sort "$T/status" > "$T/status.sorted" want='added newdir/deeper/file.md added skills/delta.md deleted agents/reviewer.md edited run.sh edited skills/alpha/SKILL.md' if [ $rc -eq 0 ] && [ "$(cat "$T/status.sorted")" = "$want" ]; then pass status-lists-edits-additions-deletions; else bad status-lists-edits-additions-deletions "rc $rc: $(cat "$T/status")"; fi "$SUIT" store status wd > "$T/status2" 2>/dev/null sort "$T/status2" | cmp -s - "$T/status.sorted" && pass status-twice-is-the-same || bad status-twice-is-the-same # status looks and changes nothing: an untracked file stays untracked printf 'x\n' > "$T/probe" printf 'tmp\n' > "$store/wd/.suit-tmp.123.4" "$SUIT" store status wd 2>/dev/null | grep -q suit-tmp && bad status-hides-our-temp-names || pass status-hides-our-temp-names rm -f "$store/wd/.suit-tmp.123.4" # ---- commit ------------------------------------------------------------------ check commit-everything 0 "" -- "$SUIT" commit wd -m "local work" grep -q "^checked in [0-9a-f]\{12\}$" "$T/out" && pass commit-says-what-it-did || bad commit-says-what-it-did "$(cat "$T/out")" check status-clean-after-commit 0 "" -- "$SUIT" store status wd [ ! -s "$T/out" ] && pass status-after-commit-prints-nothing || bad status-after-commit-prints-nothing "$(cat "$T/out")" check commit-clean-does-nothing 0 "" -- "$SUIT" commit wd -m "nothing" [ ! -s "$T/out" ] && pass commit-clean-prints-nothing || bad commit-clean-prints-nothing printf 'more\n' >> "$store/wd/run.sh" check commit-empty-message-fails-on-real-changes 1 "check in failed" -- "$SUIT" commit wd -m "" check commit-usage-no-message 2 "usage" -- "$SUIT" commit wd check commit-usage-wrong-flag 2 "usage" -- "$SUIT" commit wd -x text check store-usage-missing-name 2 "usage" -- "$SUIT" store open check store-usage-unknown-verb 2 "usage" -- "$SUIT" store frobnicate wd check back-usage 2 "usage" -- "$SUIT" back cp "$FIXTURE" "$T/home/wardrobes/nowhere.fossil" check store-commit-before-open 1 "open the working copy failed" -- "$SUIT" commit nowhere -m x # ---- update ------------------------------------------------------------------ # Two stores on one repository file: y is behind, x makes the next version. fresh x ln -s x.fossil "$T/home/wardrobes/y.fossil" "$SUIT" store open x >/dev/null 2>&1 "$SUIT" store open y >/dev/null 2>&1 printf 'alpha v3\n' > "$store/x/skills/alpha/SKILL.md" printf 'epsilon v3\n' > "$store/x/skills/epsilon.md" rm "$store/x/skills/gamma.md" chmod +x "$store/x/skills/epsilon.md" "$SUIT" commit x -m "third" >/dev/null 2>&1 tree "$store/y" > "$T/y-before" check update-conflict-with-an-untracked-file 13 "" -- sh -c 'printf "mine\n" > "$1/skills/epsilon.md"; "$2" store update y' sh "$store/y" "$SUIT" if [ "$(cat "$T/out")" = "conflict skills/epsilon.md" ]; then pass update-conflict-names-the-file; else bad update-conflict-names-the-file "$(cat "$T/out")"; fi rm "$store/y/skills/epsilon.md" tree "$store/y" > "$T/y-after-conflict" cmp -s "$T/y-before" "$T/y-after-conflict" && pass update-conflict-changes-nothing || bad update-conflict-changes-nothing printf 'local edit\n' > "$store/y/agents/reviewer.md" check update-refuses-with-local-changes 12 "" -- "$SUIT" store update y [ "$(cat "$T/out")" = "edited agents/reviewer.md" ] && pass update-refusal-lists-the-files || bad update-refusal-lists-the-files "$(cat "$T/out")" check update-refuses-with-a-deleted-file 12 "" -- sh -c 'cp "$1/agents/reviewer.md" "$1/keep"; rm "$1/agents/reviewer.md"; "$2" store update y' sh "$store/y" "$SUIT" grep -q "^deleted agents/reviewer.md$" "$T/out" && pass update-refusal-lists-deletions || bad update-refusal-lists-deletions "$(cat "$T/out")" # Start clean for the cases that update. fresh x ln -s x.fossil "$T/home/wardrobes/y.fossil" "$SUIT" store open x >/dev/null 2>&1 "$SUIT" store open y >/dev/null 2>&1 printf 'alpha v3\n' > "$store/x/skills/alpha/SKILL.md" printf 'epsilon v3\n' > "$store/x/skills/epsilon.md" rm "$store/x/skills/gamma.md" chmod +x "$store/x/skills/epsilon.md" printf '#!/bin/sh\necho v3\n' > "$store/x/run.sh" "$SUIT" commit x -m "third" >/dev/null 2>&1 tree "$store/y" > "$T/y-v2" check update-to-new-tip 0 "" -- "$SUIT" store update y grep -q "^updated to [0-9a-f]\{12\}$" "$T/out" && pass update-says-the-version || bad update-says-the-version "$(cat "$T/out")" tree "$store/y" > "$T/y-v3" tree "$store/x" > "$T/x-v3" cmp -s "$T/y-v3" "$T/x-v3" && pass update-makes-y-identical-to-x || bad update-makes-y-identical-to-x "$(diff "$T/y-v3" "$T/x-v3")" grep -q "^./skills/epsilon.md .* x$" "$T/y-v3" && grep -q "^./run.sh .* x$" "$T/y-v3" && [ ! -e "$store/y/skills/gamma.md" ] && pass update-adds-removes-and-keeps-modes || bad update-adds-removes-and-keeps-modes check status-clean-after-update 0 "" -- "$SUIT" store status y [ ! -s "$T/out" ] && pass status-after-update-prints-nothing || bad status-after-update-prints-nothing "$(cat "$T/out")" check update-at-the-tip 0 "" -- "$SUIT" store update y tree "$store/y" > "$T/y-v3b" cmp -s "$T/y-v3" "$T/y-v3b" && pass update-at-the-tip-changes-nothing || bad update-at-the-tip-changes-nothing # -- back check back-after-update 0 "" -- "$SUIT" back y grep -q "^back at [0-9a-f]\{12\}$" "$T/out" && pass back-says-the-version || bad back-says-the-version "$(cat "$T/out")" tree "$store/y" > "$T/y-back" cmp -s "$T/y-v2" "$T/y-back" && pass back-restores-the-previous-bytes-and-modes || bad back-restores-the-previous-bytes-and-modes "$(diff "$T/y-v2" "$T/y-back")" check status-clean-after-back 0 "" -- "$SUIT" store status y [ ! -s "$T/out" ] && pass status-after-back-prints-nothing || bad status-after-back-prints-nothing "$(cat "$T/out")" check back-twice-has-nothing 14 "nothing to go back to" -- "$SUIT" back y check update-again-after-back 0 "" -- "$SUIT" store update y tree "$store/y" > "$T/y-v3c" cmp -s "$T/y-v3" "$T/y-v3c" && pass update-after-back-reaches-the-tip-again || bad update-after-back-reaches-the-tip-again printf 'after\n' >> "$store/y/run.sh" "$SUIT" commit y -m "y moves on" >/dev/null 2>&1 check back-after-a-commit 14 "cannot go back: the store has changed since the update" -- "$SUIT" back y # -- an update that fails part way puts every file back fresh x ln -s x.fossil "$T/home/wardrobes/y.fossil" "$SUIT" store open x >/dev/null 2>&1 "$SUIT" store open y >/dev/null 2>&1 for f in skills/alpha/SKILL.md skills/gamma.md agents/reviewer.md; do printf 'v3 of %s\n' "$f" > "$store/x/$f"; done "$SUIT" commit x -m third >/dev/null 2>&1 tree "$store/y" > "$T/y-v2" check update-stops-when-a-write-fails 1 "update failed" -- env SUIT_FAULT=rename:2 "$SUIT" store update y grep -q "the files are back at the version they were at" "$T/err" && pass update-failure-puts-files-back || bad update-failure-puts-files-back "$(cat "$T/err")" tree "$store/y" > "$T/y-failed" cmp -s "$T/y-v2" "$T/y-failed" && pass update-failure-leaves-old-bytes || bad update-failure-leaves-old-bytes "$(diff "$T/y-v2" "$T/y-failed")" if ls "$store/y"/.suit-tmp.* "$store/y"/*/.suit-tmp.* >/dev/null 2>&1; then bad update-failure-leaves-no-temp-file; else pass update-failure-leaves-no-temp-file; fi check status-clean-after-failed-update 0 "" -- "$SUIT" store status y [ ! -s "$T/out" ] && pass status-after-failed-update-prints-nothing || bad status-after-failed-update-prints-nothing "$(cat "$T/out")" check update-and-put-back-both-fail 1 "could not put the files back" -- env SUIT_FAULT=rename:2,rename:3 "$SUIT" store update y for spec in open:1 write:1 fsync:1 close:1; do fresh x ln -s x.fossil "$T/home/wardrobes/y.fossil" "$SUIT" store open x >/dev/null 2>&1 "$SUIT" store open y >/dev/null 2>&1 printf 'v3\n' > "$store/x/skills/alpha/SKILL.md" "$SUIT" commit x -m third >/dev/null 2>&1 tree "$store/y" > "$T/y-pre" SUIT_FAULT=$spec "$SUIT" store update y >/dev/null 2>&1; rc=$? tree "$store/y" > "$T/y-post" if [ $rc -ne 1 ] || ! cmp -s "$T/y-pre" "$T/y-post"; then bad "update-fault-${spec%%:*}-keeps-old-bytes" "rc $rc"; else pass "update-fault-${spec%%:*}-keeps-old-bytes"; fi done # -- no reader ever sees half a file files=150 fresh x ln -s x.fossil "$T/home/wardrobes/y.fossil" "$SUIT" store open x >/dev/null 2>&1 "$SUIT" store open y >/dev/null 2>&1 mkdir -p "$store/x/many" i=0 while [ $i -lt $files ]; do awk -v n=$i 'BEGIN { for (k = 0; k < 400; k++) printf "old content of file %d line %d\n", n, k }' > "$store/x/many/f$i" i=$((i + 1)) done "$SUIT" commit x -m many >/dev/null 2>&1 "$SUIT" store update y >/dev/null 2>&1 i=0; : > "$T/old"; : > "$T/new" while [ $i -lt $files ]; do cksum < "$store/y/many/f$i" | sed "s/^/f$i /" >> "$T/old" awk -v n=$i 'BEGIN { for (k = 0; k < 400; k++) printf "new content of file %d line %d\n", n, k }' > "$store/x/many/f$i" i=$((i + 1)) done "$SUIT" commit x -m many2 >/dev/null 2>&1 i=0 while [ $i -lt $files ]; do cksum < "$store/x/many/f$i" | sed "s/^/f$i /" >> "$T/new" i=$((i + 1)) done # One rename in 20 ms, so the update takes seconds and a reader has time to look. SUIT_FAULT=rename:1:delay "$SUIT" store update y >/dev/null 2>&1 & updater=$! seen_old=0; seen_new=0; wrong=0; rounds=0 while kill -0 "$updater" 2>/dev/null && [ $rounds -lt 400 ]; do i=0 while [ $i -lt $files ]; do line="f$i $(cksum < "$store/y/many/f$i" 2>/dev/null)" if grep -qxF -- "$line" "$T/old"; then seen_old=$((seen_old + 1)) elif grep -qxF -- "$line" "$T/new"; then seen_new=$((seen_new + 1)) else wrong=$((wrong + 1)); fi i=$((i + 1)) done rounds=$((rounds + 1)) done wait "$updater"; urc=$? if [ "$urc" -eq 0 ] && [ "$wrong" -eq 0 ] && [ "$seen_old" -gt 0 ] && [ "$seen_new" -gt 0 ]; then pass reader-never-sees-a-half-written-file; else bad reader-never-sees-a-half-written-file "update $urc, $wrong half-written reads, $seen_old old, $seen_new new"; fi echo " (a reader looked $((seen_old + seen_new + wrong)) times: $seen_old old, $seen_new new, $wrong neither)" tree "$store/y" > "$T/y-many" tree "$store/x" > "$T/x-many" cmp -s "$T/y-many" "$T/x-many" && pass concurrent-update-ends-identical-to-source || bad concurrent-update-ends-identical-to-source # ---- stock fossil ------------------------------------------------------------ if have_fossil; then # A check-in made by suit is readable by stock fossil. fresh wd "$SUIT" store open wd >/dev/null 2>&1 printf 'fossil reads this\n' > "$store/wd/skills/alpha/SKILL.md" printf 'new file\n' > "$store/wd/skills/zeta.md" "$SUIT" commit wd -m "made by suit" >/dev/null 2>&1 R=$T/home/wardrobes/wd.fossil if fossil timeline -R "$R" -n 3 2>/dev/null | grep -q "made by suit (user: tester"; then pass fossil-timeline-shows-the-checkin; else bad fossil-timeline-shows-the-checkin; fi [ "$(fossil cat skills/alpha/SKILL.md -R "$R" -r tip 2>/dev/null)" = "fossil reads this" ] && pass fossil-cat-reads-edited-file || bad fossil-cat-reads-edited-file [ "$(fossil cat skills/zeta.md -R "$R" -r tip 2>/dev/null)" = "new file" ] && pass fossil-cat-reads-added-file || bad fossil-cat-reads-added-file fossil test-integrity -R "$R" >/dev/null 2>&1 && pass fossil-integrity-after-suit-checkin || bad fossil-integrity-after-suit-checkin rm "$store/wd/agents/reviewer.md" "$SUIT" commit wd -m "deleted by suit" >/dev/null 2>&1 fossil cat agents/reviewer.md -R "$R" -r tip >/dev/null 2>&1 && bad fossil-sees-the-deletion || pass fossil-sees-the-deletion # Trunk's only newer check-in moved to another branch: nowhere to update to. fresh wd "$SUIT" store open wd >/dev/null 2>&1 R=$T/home/wardrobes/wd.fossil mkdir "$T/co" (cd "$T/co" && fossil open "$R" >/dev/null 2>&1 && printf 'elsewhere\n' > elsewhere.md && fossil add elsewhere.md >/dev/null 2>&1 && fossil commit --branch other --user fixture -m "other branch" >/dev/null 2>&1) before=$(tree "$store/wd" | cksum) check update-with-no-leaf-on-the-branch-stays-put 0 "" -- "$SUIT" store update wd grep -q "^updated to [0-9a-f]\{12\}$" "$T/out" && pass update-with-no-leaf-says-the-version || bad update-with-no-leaf-says-the-version "$(cat "$T/out")" [ "$(tree "$store/wd" | cksum)" = "$before" ] && pass update-with-no-leaf-changes-nothing || bad update-with-no-leaf-changes-nothing rm -rf "$T/co" # Differential: about 600 files, an executable script, and a deletion across # two check-ins. The store matches stock fossil's checkout at each version. D=$T/diff rm -rf "$D"; mkdir -p "$D/co" "$D/home/wardrobes" ( cd "$D/co" || exit 1 fossil new --admin-user fixture "$D/big.fossil" >/dev/null 2>&1 fossil open "$D/big.fossil" >/dev/null 2>&1 d=0 while [ $d -lt 30 ]; do mkdir -p "skills/s$d/ref" f=0 while [ $f -lt 20 ]; do awk -v d=$d -v f=$f 'BEGIN { for (k = 0; k < 30; k++) printf "skill %d file %d line %d\n", d, f, k }' > "skills/s$d/ref/f$f.md" f=$((f + 1)) done d=$((d + 1)) done printf '#!/bin/sh\necho big\n' > run.sh; chmod +x run.sh fossil add . >/dev/null 2>&1 fossil commit --user fixture -m one >/dev/null 2>&1 cp "$D/big.fossil" "$D/v1.fossil" sleep 1 printf 'changed\n' >> skills/s3/ref/f4.md printf '#!/bin/sh\necho big two\n' > run.sh fossil rm skills/s7/ref/f9.md >/dev/null 2>&1 printf 'added later\n' > skills/s7/ref/extra.md fossil add skills/s7/ref/extra.md >/dev/null 2>&1 fossil commit --user fixture -m two >/dev/null 2>&1 cp "$D/big.fossil" "$D/v2.fossil" ) count=$(cd "$D/co" && find skills -type f | wc -l | tr -d ' ') [ "$count" -ge 600 ] && pass differential-wardrobe-has-about-600-files || bad differential-wardrobe-has-about-600-files "$count files" export SUIT_HOME="$D/home" cp "$D/v1.fossil" "$D/home/wardrobes/big.fossil" "$SUIT" store open big >/dev/null 2>&1 rm -rf "$D/fco1"; mkdir "$D/fco1" (cd "$D/fco1" && fossil open "$D/v1.fossil" >/dev/null 2>&1) tree "$D/fco1" > "$T/f-v1" tree "$D/home/store/big" > "$T/s-v1" cmp -s "$T/f-v1" "$T/s-v1" && pass differential-v1-store-equals-fossil-checkout || bad differential-v1-store-equals-fossil-checkout "$(diff "$T/f-v1" "$T/s-v1" | head -5)" cp "$D/v2.fossil" "$D/home/wardrobes/big.fossil" check differential-update-to-v2 0 "" -- "$SUIT" store update big rm -rf "$D/fco2"; mkdir "$D/fco2" (cd "$D/fco2" && fossil open "$D/v2.fossil" >/dev/null 2>&1) tree "$D/fco2" > "$T/f-v2" tree "$D/home/store/big" > "$T/s-v2" cmp -s "$T/f-v2" "$T/s-v2" && pass differential-v2-store-equals-fossil-checkout || bad differential-v2-store-equals-fossil-checkout "$(diff "$T/f-v2" "$T/s-v2" | head -5)" grep -q "^./run.sh .* x$" "$T/s-v2" && pass differential-executable-bit-kept || bad differential-executable-bit-kept [ ! -e "$D/home/store/big/skills/s7/ref/f9.md" ] && pass differential-deleted-file-is-gone || bad differential-deleted-file-is-gone check back-in-the-differential-store 0 "" -- "$SUIT" back big tree "$D/home/store/big" > "$T/s-back" cmp -s "$T/f-v1" "$T/s-back" && pass differential-back-equals-v1 || bad differential-back-equals-v1 else skip differential "stock fossil is not installed" skip fossil-reads-suit-checkins "stock fossil is not installed" fi echo "store.sh: $total cases, $failed failed" [ "$failed" -eq 0 ]