aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/example_filesystems/example_test_helpers.go10
-rw-r--r--tests/test_helpers/helpers.go32
2 files changed, 26 insertions, 16 deletions
diff --git a/tests/example_filesystems/example_test_helpers.go b/tests/example_filesystems/example_test_helpers.go
index 615e4c1..d89b35f 100644
--- a/tests/example_filesystems/example_test_helpers.go
+++ b/tests/example_filesystems/example_test_helpers.go
@@ -15,7 +15,8 @@ func checkExampleFS(t *testing.T, dir string, rw bool) {
statusFile := filepath.Join(dir, "status.txt")
contentBytes, err := ioutil.ReadFile(statusFile)
if err != nil {
- t.Fatal(err)
+ t.Error(err)
+ return
}
content := string(contentBytes)
if content != statusTxtContent {
@@ -25,7 +26,8 @@ func checkExampleFS(t *testing.T, dir string, rw bool) {
symlink := filepath.Join(dir, "rel")
target, err := os.Readlink(symlink)
if err != nil {
- t.Fatal(err)
+ t.Error(err)
+ return
}
if target != "status.txt" {
t.Errorf("Unexpected link target: %s\n", target)
@@ -34,12 +36,12 @@ func checkExampleFS(t *testing.T, dir string, rw bool) {
symlink = filepath.Join(dir, "abs")
target, err = os.Readlink(symlink)
if err != nil {
- t.Fatal(err)
+ t.Error(err)
+ return
}
if target != "/a/b/c/d" {
t.Errorf("Unexpected link target: %s\n", target)
}
-
if rw {
// Test directory operations
test_helpers.TestRename(t, dir)
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)
}