Update loopback to return error

Avoid calling testing function in creation closure since the
context may no longer be valid.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-08-14 20:52:01 -07:00
parent 4028add553
commit 502734116d
4 changed files with 42 additions and 22 deletions

View File

@@ -29,7 +29,10 @@ func testLookup(t *testing.T, fsType string) {
}
defer os.RemoveAll(mnt)
deviceName, cleanupDevice := testutil.NewLoopback(t, 100<<20) // 100 MB
deviceName, cleanupDevice, err := testutil.NewLoopback(100 << 20) // 100 MB
if err != nil {
t.Fatal(err)
}
if out, err := exec.Command("mkfs", "-t", fsType, deviceName).CombinedOutput(); err != nil {
// not fatal
t.Skipf("could not mkfs (%s) %s: %v (out: %q)", fsType, deviceName, err, string(out))