summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-07-31 13:23:05 +0200
committerJakob Unterwurzacher2021-07-31 13:23:05 +0200
commiteecbcbb0905320fc8a030fb716bee259bf6dd00f (patch)
treeaf74ea2fadfbb6f9886eb3cd6fedd62c66fe3c14
parent1dfd6b7b765c82c4c9cf6d41ec6d6ed5f6cb2a79 (diff)
tests: matrix: add TestPwd
https://github.com/rfjakob/gocryptfs/issues/584
-rw-r--r--tests/matrix/matrix_test.go31
1 files changed, 23 insertions, 8 deletions
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 6622213..5906b3c 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -1,15 +1,10 @@
// Tests run for (almost all) combinations of openssl, aessiv, plaintextnames.
package matrix
-// File reading, writing, modification, truncate
+// File reading, writing, modification, truncate, ...
//
-// Runs everything four times, for all combinations of
-// "-plaintextnames" and "-openssl".
-//
-// Test Matrix:
-// openssl=true openssl=false
-// plaintextnames=false X X
-// plaintextnames=true X X
+// Runs all tests N times, for the combinations of different flags specified
+// in the `matrix` variable.
import (
"bytes"
@@ -21,6 +16,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
+ "strings"
"sync"
"syscall"
"testing"
@@ -901,3 +897,22 @@ func TestSymlinkSize(t *testing.T) {
t.Errorf("wrong size: have %d, want %d", st.Size, 3)
}
}
+
+// TestPwd check that /usr/bin/pwd works inside gocryptfs.
+//
+// This was broken in gocryptfs v2.0 with -sharedstorage:
+// https://github.com/rfjakob/gocryptfs/issues/584
+func TestPwd(t *testing.T) {
+ dir := test_helpers.DefaultPlainDir
+ for i := 0; i < 3; i++ {
+ cmd := exec.Command("pwd")
+ cmd.Dir = dir
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Log(strings.TrimSpace(string(out)))
+ t.Fatalf("dir %q: %v", dir, err)
+ }
+ dir = dir + "/" + t.Name()
+ os.Mkdir(dir, 0700)
+ }
+}