summaryrefslogtreecommitdiff
path: root/tests/matrix
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-03-05 20:27:54 +0100
committerJakob Unterwurzacher2019-04-08 20:27:13 +0200
commit311c34af4b4ba33397a4d550cb3bfc45fb6ca479 (patch)
treeaea7c4aa171920843c448e337374c6331f8e04d2 /tests/matrix
parentfe06e9f45646893dc88ebe9e657e2e991f6f5fbb (diff)
tests: add additional TestWrite10Tight test
Try to find out what goes wrong in https://github.com/rfjakob/gocryptfs/issues/363
Diffstat (limited to 'tests/matrix')
-rw-r--r--tests/matrix/matrix_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 317158a..226dfd8 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -147,6 +147,45 @@ func TestWrite100x100(t *testing.T) {
}
}
+func TestWrite10Tight(t *testing.T) {
+ path := test_helpers.DefaultPlainDir + "/TestWrite10Tight"
+ content := make([]byte, 10)
+ buf := make([]byte, 100)
+ for i := 0; i < 1000; i++ {
+ file, err := os.Create(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, err = file.Write(content)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = file.Close()
+ if err != nil {
+ t.Fatal(err)
+ }
+ file, err = os.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ n, err := file.Read(buf)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if n != 10 {
+ t.Fatalf("want 10 bytes, got %d", n)
+ }
+ err = file.Close()
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = os.Remove(path)
+ if err != nil {
+ t.Fatal()
+ }
+ }
+}
+
// Hint for calculating reference md5sums:
// dd if=/dev/zero count=1 bs=XYZ | md5sum
func TestTruncate(t *testing.T) {