diff options
author | Jakob Unterwurzacher | 2016-11-26 15:17:15 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-11-26 15:20:54 +0100 |
commit | 3f5c48e0585f6fe0782aded541e42879eb570e69 (patch) | |
tree | bbec927ead78447195a719134e060842c1c46ec2 /tests/test_helpers | |
parent | a6006c0d2bcef66cc3c6a6bb22de747b9be874c1 (diff) |
tests: don't call t.Fatal in checkExampleFS
Calling t.Fatal means that the parent test has no chance
to clean up.
Diffstat (limited to 'tests/test_helpers')
-rw-r--r-- | tests/test_helpers/helpers.go | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index 90b00b6..01ef319 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -227,20 +227,23 @@ func TestMkdirRmdir(t *testing.T, plainDir string) { dir := plainDir + "/dir1" err := os.Mkdir(dir, 0777) if err != nil { - t.Fatal(err) + t.Error(err) + return } err = syscall.Rmdir(dir) if err != nil { - t.Fatal(err) + t.Error(err) + return } - // Removing a non-empty dir should fail with ENOTEMPTY if os.Mkdir(dir, 0777) != nil { - t.Fatal(err) + t.Error(err) + return } f, err := os.Create(dir + "/file") if err != nil { - t.Fatal(err) + t.Error(err) + return } f.Close() err = syscall.Rmdir(dir) @@ -249,23 +252,26 @@ func TestMkdirRmdir(t *testing.T, plainDir string) { t.Errorf("Should have gotten ENOTEMPTY, go %v", errno) } if syscall.Unlink(dir+"/file") != nil { - t.Fatal(err) + t.Error(err) + return } if syscall.Rmdir(dir) != nil { - t.Fatal(err) + t.Error(err) + return } - // We should also be able to remove a directory we do not have permissions to // read or write err = os.Mkdir(dir, 0000) if err != nil { - t.Fatal(err) + t.Error(err) + return } err = syscall.Rmdir(dir) if err != nil { // Make sure the directory can cleaned up by the next test run os.Chmod(dir, 0700) - t.Fatal(err) + t.Error(err) + return } } @@ -275,11 +281,13 @@ func TestRename(t *testing.T, plainDir string) { file2 := plainDir + "/rename2" err := ioutil.WriteFile(file1, []byte("content"), 0777) if err != nil { - t.Fatal(err) + t.Error(err) + return } err = syscall.Rename(file1, file2) if err != nil { - t.Fatal(err) + t.Error(err) + return } syscall.Unlink(file2) } |