From 52dfe15846a0b8ade68f4a41418a49d1ba0db00e Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 24 Mar 2025 13:34:25 +0900 Subject: [PATCH] test/sandbox: fail on mismatched mount entry Signed-off-by: Ophestra --- test/sandbox/assert.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/sandbox/assert.go b/test/sandbox/assert.go index c7d3ca4..ab1ff41 100644 --- a/test/sandbox/assert.go +++ b/test/sandbox/assert.go @@ -50,13 +50,14 @@ func (t *T) MustCheck(want *TestCase) { } if want.Mount != nil { + var fail bool m := mustParseMountinfo(t.MountsPath) i := 0 for ent := range m.Entries() { if i == len(want.Mount) { fatalf("got more than %d entries", i) } - if !ent.EqualWithIgnore(want.Mount[i], "//ignore") { + if fail = !ent.EqualWithIgnore(want.Mount[i], "//ignore"); fail { printf("[FAIL] %s", ent) } else { printf("[ OK ] %s", ent) @@ -67,6 +68,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") }