summaryrefslogtreecommitdiff
path: root/integration_tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration_tests')
-rw-r--r--integration_tests/helpers.go1
-rw-r--r--integration_tests/main_test.go33
2 files changed, 33 insertions, 1 deletions
diff --git a/integration_tests/helpers.go b/integration_tests/helpers.go
index 750283d..7c4aeef 100644
--- a/integration_tests/helpers.go
+++ b/integration_tests/helpers.go
@@ -20,6 +20,7 @@ const defaultCipherDir = tmpDir + "cipher/"
const gocryptfsBinary = "../gocryptfs"
+// resetTmpDir - delete old tmp dir, create new one, write gocryptfs.diriv
func resetTmpDir() {
fu := exec.Command("fusermount", "-z", "-u", defaultPlainDir)
fu.Run()
diff --git a/integration_tests/main_test.go b/integration_tests/main_test.go
index 398a9d4..cfa481d 100644
--- a/integration_tests/main_test.go
+++ b/integration_tests/main_test.go
@@ -26,11 +26,15 @@ func TestMain(m *testing.M) {
if testing.Verbose() {
fmt.Printf("***** Testing with OpenSSL\n")
}
- resetTmpDir()
+ resetTmpDir() // <- this also create gocryptfs.diriv
mount(defaultCipherDir, defaultPlainDir, "--zerokey")
r := m.Run()
unmount(defaultPlainDir)
+ if r != 0 {
+ os.Exit(r)
+ }
+
if defaultonly {
os.Exit(r)
}
@@ -43,6 +47,10 @@ func TestMain(m *testing.M) {
r = m.Run()
unmount(defaultPlainDir)
+ if r != 0 {
+ os.Exit(r)
+ }
+
if testing.Verbose() {
fmt.Printf("***** Testing \"--plaintextnames\"\n")
}
@@ -52,6 +60,10 @@ func TestMain(m *testing.M) {
r = m.Run()
unmount(defaultPlainDir)
+ if r != 0 {
+ os.Exit(r)
+ }
+
os.Exit(r)
}
@@ -320,3 +332,22 @@ func TestMkdirRmdir(t *testing.T) {
func TestRename(t *testing.T) {
testRename(t, defaultPlainDir)
}
+
+
+// Overwrite an empty directory with another directory
+func TestDirOverwrite(t *testing.T) {
+ dir1 := defaultPlainDir + "DirOverwrite1"
+ dir2 := defaultPlainDir + "DirOverwrite2"
+ err := os.Mkdir(dir1, 0777)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = os.Mkdir(dir2, 0777)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = os.Rename(dir1, dir2)
+ if err != nil {
+ t.Fatal(err)
+ }
+}