test/sandbox: fail on mismatched mount entry
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Fpkg (push) Successful in 34s
Test / Fortify (push) Successful in 2m26s
Test / Data race detector (push) Successful in 2m47s
Test / Flake checks (push) Successful in 57s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-24 13:34:25 +09:00
parent a11237b158
commit b989a4601a
3 changed files with 14 additions and 8 deletions

View File

@@ -50,6 +50,7 @@ func (t *T) MustCheck(want *TestCase) {
}
if want.Mount != nil {
var fail bool
m := mustParseMountinfo(t.MountsPath)
i := 0
for ent := range m.Entries() {
@@ -57,6 +58,7 @@ func (t *T) MustCheck(want *TestCase) {
fatalf("got more than %d entries", i)
}
if !ent.EqualWithIgnore(want.Mount[i], "//ignore") {
fail = true
printf("[FAIL] %s", ent)
} else {
printf("[ OK ] %s", ent)
@@ -67,6 +69,10 @@ func (t *T) MustCheck(want *TestCase) {
if err := m.Err(); err != nil {
fatalf("%v", err)
}
if fail {
fatalf("[FAIL] some mount points did not match")
}
} else {
printf("[SKIP] skipping mounts check")
}