test/sandbox: fail on mismatched mount entry
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
a11237b158
commit
52dfe15846
@ -50,13 +50,14 @@ func (t *T) MustCheck(want *TestCase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if want.Mount != nil {
|
if want.Mount != nil {
|
||||||
|
var fail bool
|
||||||
m := mustParseMountinfo(t.MountsPath)
|
m := mustParseMountinfo(t.MountsPath)
|
||||||
i := 0
|
i := 0
|
||||||
for ent := range m.Entries() {
|
for ent := range m.Entries() {
|
||||||
if i == len(want.Mount) {
|
if i == len(want.Mount) {
|
||||||
fatalf("got more than %d entries", i)
|
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)
|
printf("[FAIL] %s", ent)
|
||||||
} else {
|
} else {
|
||||||
printf("[ OK ] %s", ent)
|
printf("[ OK ] %s", ent)
|
||||||
@ -67,6 +68,10 @@ func (t *T) MustCheck(want *TestCase) {
|
|||||||
if err := m.Err(); err != nil {
|
if err := m.Err(); err != nil {
|
||||||
fatalf("%v", err)
|
fatalf("%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fail {
|
||||||
|
fatalf("[FAIL] some mount points did not match")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("[SKIP] skipping mounts check")
|
printf("[SKIP] skipping mounts check")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user