aboutsummaryrefslogtreecommitdiff
path: root/tests/matrix/concurrency_test.go
AgeCommit message (Collapse)Author
2022-08-28tests/matrix: fix data race in TestConcurrentReadWriteJakob Unterwurzacher
Fixes https://github.com/golang/go/issues/54715 Output was: $ go test ./tests/matrix -run TestConcurrentReadWrite -race test_helpers: warning: testParentDir "/tmp/gocryptfs-test-parent-1026" does not reside on ext4, we will miss failures caused by ino reuse PASS PASS ================== WARNING: DATA RACE Write at 0x00c00038a0e0 by goroutine 63: runtime.racewriterange() <autogenerated>:1 +0x29 internal/poll.(*FD).Pread() /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169 os.(*File).pread() /usr/local/go/src/os/file_posix.go:40 +0x335 os.(*File).ReadAt() /usr/local/go/src/os/file.go:136 +0x2de github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite.func1() /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:40 +0x14b Previous write at 0x00c00038a0e0 by goroutine 61: runtime.racewriterange() <autogenerated>:1 +0x29 internal/poll.(*FD).Pread() /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169 os.(*File).pread() /usr/local/go/src/os/file_posix.go:40 +0x335 os.(*File).ReadAt() /usr/local/go/src/os/file.go:136 +0x2de github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite.func1() /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:40 +0x14b Goroutine 63 (running) created at: github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite() /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:34 +0x31d testing.tRunner() /usr/local/go/src/testing/testing.go:1446 +0x216 testing.(*T).Run.func1() /usr/local/go/src/testing/testing.go:1493 +0x47 Goroutine 61 (running) created at: github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite() /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:34 +0x31d testing.tRunner() /usr/local/go/src/testing/testing.go:1446 +0x216 testing.(*T).Run.func1() /usr/local/go/src/testing/testing.go:1493 +0x47 ================== --- FAIL: TestConcurrentReadWrite (0.03s) testing.go:1319: race detected during execution of test FAIL TestMain: matrix[2] = matrix.testcaseMatrix{plaintextnames:false, openssl:"false", aessiv:false, raw64:false, extraArgs:[]string(nil)} failed FAIL github.com/rfjakob/gocryptfs/v2/tests/matrix 0.170s FAIL
2021-12-08tests: convert Creat() calls to Open()Jakob Unterwurzacher
Creat() is equivalent to Open(..., O_CREAT|O_WRONLY|O_TRUNC, ...) and MacOS does not have syscall.Creat(). https://github.com/rfjakob/gocryptfs/issues/623
2021-09-01tests/matrix: don't leak fds in TestConcurrentReadCreateJakob Unterwurzacher
We leaked a file descriptor for each empty file we encountered.
2021-08-30Unbreak hyperlinks broken by go mod v2 conversionJakob Unterwurzacher
Commit 69d88505fd7f4cb0d9e4f1918de296342fe05858 go mod: declare module version v2 translated all instances of "github.com/rfjakob/gocryptfs/" to "github.com/rfjakob/gocryptfs/v2/". Unfortunately, this included hyperlinks. Unbreak the hyperlinks like this: find . -name \*.go | xargs sed -i s%https://github.com/rfjakob/gocryptfs/v2/%https://github.com/rfjakob/gocryptfs/v2/%
2021-08-23go mod: declare module version v2Jakob Unterwurzacher
Our git version is v2+ for some time now, but go.mod still declared v1. Hopefully making both match makes https://pkg.go.dev/github.com/rfjakob/gocryptfs/v2 work. All the import paths have been fixed like this: find . -name \*.go | xargs sed -i s%github.com/rfjakob/gocryptfs/%github.com/rfjakob/gocryptfs/v2/%
2021-08-19golangci-lint: fix issues found by gosimpleJakob Unterwurzacher
Everything except the if err2.Err == syscall.EOPNOTSUPP case. Gets too confusing when collapsed into a single line. Issues were: $ golangci-lint run --disable-all --enable gosimple mount.go:473:2: S1008: should use 'return strings.HasPrefix(v, "fusermount version")' instead of 'if strings.HasPrefix(v, "fusermount version") { return true }; return false' (gosimple) if strings.HasPrefix(v, "fusermount version") { ^ cli_args.go:258:5: S1002: should omit comparison to bool constant, can be simplified to `args.forcedecode` (gosimple) if args.forcedecode == true { ^ cli_args.go:263:6: S1002: should omit comparison to bool constant, can be simplified to `args.aessiv` (gosimple) if args.aessiv == true { ^ cli_args.go:267:6: S1002: should omit comparison to bool constant, can be simplified to `args.reverse` (gosimple) if args.reverse == true { ^ internal/stupidgcm/stupidgcm.go:227:6: S1002: should omit comparison to bool constant, can be simplified to `g.forceDecode` (gosimple) if g.forceDecode == true { ^ gocryptfs-xray/xray_tests/xray_test.go:23:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple) if bytes.Compare(out, expected) != 0 { ^ gocryptfs-xray/xray_tests/xray_test.go:40:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple) if bytes.Compare(out, expected) != 0 { ^ gocryptfs-xray/paths_ctlsock.go:34:20: S1002: should omit comparison to bool constant, can be simplified to `!eof` (gosimple) for eof := false; eof == false; line++ { ^ tests/reverse/xattr_test.go:19:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple) if err2.Err == syscall.EOPNOTSUPP { ^ internal/fusefrontend/node.go:459:45: S1002: should omit comparison to bool constant, can be simplified to `!nameFileAlreadyThere` (gosimple) if nametransform.IsLongContent(cName2) && nameFileAlreadyThere == false { ^ tests/xattr/xattr_integration_test.go:221:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple) if err2.Err == syscall.EOPNOTSUPP { ^ tests/test_helpers/helpers.go:338:19: S1002: should omit comparison to bool constant, can be simplified to `open` (gosimple) if err != nil && open == true { ^ tests/matrix/concurrency_test.go:121:7: S1004: should use !bytes.Equal(buf, content) instead (gosimple) if bytes.Compare(buf, content) != 0 { ^
2021-06-26tests: matrix: show content detail on mismatchJakob Unterwurzacher
2020-09-09tests: add TestInoReuseJakob Unterwurzacher
2020-05-10Fix spelling mistakes found by misspellJakob Unterwurzacher
https://github.com/client9/misspell
2019-04-08tests: speed up new tests a littleJakob Unterwurzacher
Before: ok github.com/rfjakob/gocryptfs/tests/matrix 18.560s After: ok github.com/rfjakob/gocryptfs/tests/matrix 13.425s
2019-04-08tests: add TestConcurrentReadCreate, move to new fileJakob Unterwurzacher
https://github.com/rfjakob/gocryptfs/issues/363