aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-16 13:39:25 +0200
committerJakob Unterwurzacher2016-10-16 15:04:53 +0200
commit57e8df990c7c251b3cc73c2df6af6bf73367d234 (patch)
treecf58086c0707a66ee11b15b880bf14e6060bae88 /tests
parentdc78e634aa76878026727a141c0e474d8466999a (diff)
tests: split "normal" tests into "cli" and "defaults"
Also fixes the failure to run the benchmarks do to the missing gocryptfs.diriv.
Diffstat (limited to 'tests')
-rw-r--r--tests/cli/cli_test.go (renamed from tests/normal/cli_test.go)4
-rw-r--r--tests/defaults/main_test.go17
-rw-r--r--tests/defaults/performance_test.go (renamed from tests/normal/performance_test.go)14
-rw-r--r--tests/matrix/matrix_test.go1
4 files changed, 26 insertions, 10 deletions
diff --git a/tests/normal/cli_test.go b/tests/cli/cli_test.go
index 18c0bd9..bc500db 100644
--- a/tests/normal/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -1,4 +1,4 @@
-package normal
+package cli
// Test CLI operations like "-init", "-password" etc
@@ -15,9 +15,7 @@ import (
func TestMain(m *testing.M) {
test_helpers.ResetTmpDir(false)
- test_helpers.MountOrExit(test_helpers.DefaultCipherDir, test_helpers.DefaultPlainDir, "--zerokey")
r := m.Run()
- test_helpers.UnmountPanic(test_helpers.DefaultPlainDir)
os.Exit(r)
}
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
new file mode 100644
index 0000000..a623c48
--- /dev/null
+++ b/tests/defaults/main_test.go
@@ -0,0 +1,17 @@
+// Tests and benchmarks performed with default settings only.
+package defaults
+
+import (
+ "os"
+ "testing"
+
+ "github.com/rfjakob/gocryptfs/tests/test_helpers"
+)
+
+func TestMain(m *testing.M) {
+ test_helpers.ResetTmpDir(true)
+ test_helpers.MountOrExit(test_helpers.DefaultCipherDir, test_helpers.DefaultPlainDir, "-zerokey")
+ r := m.Run()
+ test_helpers.UnmountPanic(test_helpers.DefaultPlainDir)
+ os.Exit(r)
+}
diff --git a/tests/normal/performance_test.go b/tests/defaults/performance_test.go
index 78ecf41..a2ecf8c 100644
--- a/tests/normal/performance_test.go
+++ b/tests/defaults/performance_test.go
@@ -1,6 +1,5 @@
-package normal
-
-// Benchmarks
+// Tests and benchmarks performed with default settings only.
+package defaults
import (
"fmt"
@@ -12,13 +11,14 @@ import (
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
+// Benchmarks
func BenchmarkStreamWrite(t *testing.B) {
buf := make([]byte, 1024*1024)
t.SetBytes(int64(len(buf)))
- file, err := os.Create(test_helpers.DefaultPlainDir + "BenchmarkWrite")
+ file, err := os.Create(test_helpers.DefaultPlainDir + "/BenchmarkWrite")
if err != nil {
- t.FailNow()
+ t.Fatal(err)
}
t.ResetTimer()
@@ -27,7 +27,7 @@ func BenchmarkStreamWrite(t *testing.B) {
written, err := file.Write(buf)
if err != nil {
fmt.Printf("err=\"%s\", written=%d\n", err.Error(), written)
- t.FailNow()
+ t.Fatal(err)
}
}
file.Close()
@@ -37,7 +37,7 @@ func BenchmarkStreamRead(t *testing.B) {
buf := make([]byte, 1024*1024)
t.SetBytes(int64(len(buf)))
- fn := test_helpers.DefaultPlainDir + "BenchmarkWrite"
+ fn := test_helpers.DefaultPlainDir + "/BenchmarkWrite"
fi, err := os.Stat(fn)
if err != nil {
t.Fatal(err)
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 7b636ad..1c94cb6 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -1,3 +1,4 @@
+// Tests run for (almost all) combinations of openssl, aessiv, plaintextnames.
package matrix
// File reading, writing, modification, truncate