summaryrefslogtreecommitdiff
path: root/tests/matrix/matrix_test.go
AgeCommit message (Collapse)Author
2021-08-23tests/matrix: add -xchacha testJakob Unterwurzacher
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-20Implement -deterministic-names: extended -zerodirivJakob Unterwurzacher
-deterministc-names uses all-zero dirivs but does not write them to disk anymore.
2021-08-19golangci-lint: fix issues found by "unused" and "deadcode"Jakob Unterwurzacher
Except xattrSupported, this is a false positive. $ golangci-lint run --disable-all --enable unused --enable deadcode gocryptfs-xray/xray_main.go:24:5: `GitVersionFuse` is unused (deadcode) var GitVersionFuse = "[GitVersionFuse not set - please compile using ./build.bash]" ^ tests/symlink_race/main.go:47:6: `chmodLoop` is unused (deadcode) func chmodLoop() { ^ internal/readpassword/extpass_test.go:11:5: `testPw` is unused (deadcode) var testPw = []byte("test") ^ tests/reverse/xattr_test.go:13:6: func `xattrSupported` is unused (unused) func xattrSupported(path string) bool { ^ internal/fusefrontend_reverse/rpath.go:20:22: func `(*RootNode).abs` is unused (unused) func (rfs *RootNode) abs(relPath string, err error) (string, error) { ^ tests/matrix/matrix_test.go:310:6: `sContains` is unused (deadcode) func sContains(haystack []string, needle string) bool {
2021-07-31tests: matrix: add TestPwdJakob Unterwurzacher
https://github.com/rfjakob/gocryptfs/issues/584
2021-06-06fusefronted: report plaintext size on symlink creationJakob Unterwurzacher
gocryptfs 2.0 introduced the regression that the size reported at symlink creation was the ciphertext size, which is wrong. Report the plaintext size. Fixes https://github.com/rfjakob/gocryptfs/issues/574
2021-03-20tests: matrix: add -sharestorage to test matrixJakob Unterwurzacher
Currently fails like this: === RUN TestRmwRace doRead 0: corrupt block #0: cipher: message authentication failed -wpanic turns this warning into a panic: doRead 0: corrupt block #0: cipher: message authentication failed panic: -wpanic turns this warning into a panic: doRead 0: corrupt block #0: cipher: message authentication failed goroutine 1293 [running]: log.(*Logger).Panic(0xc00011c230, 0xc0003b17c8, 0x1, 0x1) log/log.go:224 +0xac github.com/rfjakob/gocryptfs/internal/tlog.(*toggledLogger).Printf(0xc00007a780, 0x55a821a766a1, 0x20, 0xc0003b19f0, 0x3, 0x3) github.com/rfjakob/gocryptfs/internal/tlog/log.go:78 +0x1ef github.com/rfjakob/gocryptfs/internal/fusefrontend.(*File).doRead(0xc0001ff420, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x0, 0x1, 0xc000880000, 0x1020) github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:201 +0x8c9 github.com/rfjakob/gocryptfs/internal/fusefrontend.(*File).doWrite(0xc0001ff420, 0xc000248428, 0x10, 0x30, 0xff0, 0x3, 0x18) github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:291 +0xc9e github.com/rfjakob/gocryptfs/internal/fusefrontend.(*File).Write(0xc0001ff420, 0x55a821b306a0, 0xc000fbde90, 0xc000248428, 0x10, 0x30, 0xff0, 0x7f4a00000000, 0x0) github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:378 +0x25e github.com/hanwen/go-fuse/v2/fs.(*rawBridge).Write(0xc000168140, 0xc000096000, 0xc0002483d8, 0xc000248428, 0x10, 0x30, 0x55a821ad40e0) github.com/hanwen/go-fuse/v2@v2.0.4-0.20210125162859-8e0bbdb16cb7/fs/bridge.go:819 +0x26d github.com/hanwen/go-fuse/v2/fuse.doWrite(0xc000170160, 0xc000248240) github.com/hanwen/go-fuse/v2@v2.0.4-0.20210125162859-8e0bbdb16cb7/fuse/opcode.go:191 +0x6f github.com/hanwen/go-fuse/v2/fuse.(*Server).handleRequest(0xc000170160, 0xc000248240, 0xc000000000) github.com/hanwen/go-fuse/v2@v2.0.4-0.20210125162859-8e0bbdb16cb7/fuse/server.go:472 +0x2be github.com/hanwen/go-fuse/v2/fuse.(*Server).loop(0xc000170160, 0xc000cd4101) github.com/hanwen/go-fuse/v2@v2.0.4-0.20210125162859-8e0bbdb16cb7/fuse/server.go:445 +0x198 created by github.com/hanwen/go-fuse/v2/fuse.(*Server).readRequest github.com/hanwen/go-fuse/v2@v2.0.4-0.20210125162859-8e0bbdb16cb7/fuse/server.go:312 +0x41d matrix_test.go:354: Write failed
2020-08-16v2api/reverse: implement StatfsJakob Unterwurzacher
2020-08-15test_helper: VerifyExistence: don't panicJakob Unterwurzacher
Instead bubble up the error to the testing object.
2020-07-12tests: TestMagicNames: add warmup roundsJakob Unterwurzacher
Chasing a bug that seems to have nothing to do with magic names, as it already triggers during warmup: --- FAIL: TestMagicNames (0.00s) matrix_test.go:773: Testing n="warmup1" matrix_test.go:773: Testing n="warmup2" matrix_test.go:820: no such file or directory
2020-07-12v2api: Getattr: use file handle if passedJakob Unterwurzacher
2020-05-09tests: use t.Name()Jakob Unterwurzacher
We did not use t.Name() as it was not available before Go 1.8. Now the oldest Go version we support is Go 1.11, so we can use it.
2020-02-15tests: randomize data in testWriteNJakob Unterwurzacher
Just writing zeros carries the risk of not detecting wrongly created file holes. Write random data instead.
2019-10-06tests: filter leaked fds by prefixJakob Unterwurzacher
When running $ go test ./tests/matrix/ in isolation, it failed like this: fd leak? before, after: [0r=/dev/null 3w=/dev/null 5r=/proc/8078/fd (hidden:4)] [0r=/dev/null 3w=/dev/null 5w=/tmp/go-build366655199/b001/testlog.txt 7r=/proc/8078/fd (hidden:4)] Filter by prefix to get rid of this spurious test failure.
2019-10-06tests: clarify which process seems to be leaking fdsJakob Unterwurzacher
The tests check if they leak fds themselves, but we also check if gocryptfs leaks fds. Clarify what is what in the error message.
2019-09-01tests: matrix: test -serialize_readsJakob Unterwurzacher
Test if https://github.com/rfjakob/gocryptfs/pull/413 works as intended.
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
2019-04-08tests: add TestConcurrentReadWriteJakob Unterwurzacher
Another attempt to find out what is going on behind https://github.com/rfjakob/gocryptfs/issues/363
2019-04-08tests: add additional TestWrite10Tight testJakob Unterwurzacher
Try to find out what goes wrong in https://github.com/rfjakob/gocryptfs/issues/363
2019-02-17tests: fix compile error in matrix_test.goJakob Unterwurzacher
Error was: tests/matrix/matrix_test.go:101:9: no new variables on left side of :=
2019-02-17ParseHeader: print hexdump on errorJakob Unterwurzacher
Should help debugging https://github.com/rfjakob/gocryptfs/issues/363
2019-02-17nametransform: reject names longer than 255 charsJakob Unterwurzacher
Looks like we allowed creating longer names by accident. Fix that, and add a test that verifies it.
2019-01-20tests: matrix: split out directory tests into their own fileJakob Unterwurzacher
matrix_test.go is already too big.
2019-01-14tests: reduce noise on MacOSJakob Unterwurzacher
This should get rid of Openat: O_NOFOLLOW missing: flags = 0x0 Fchmodat: adding missing AT_SYMLINK_NOFOLLOW flag sys_common_test.go:203: chmod on symlink should have failed, but did not. New mode=0333 UnmountErr: "[...]/057376762.mnt" was not found in MountInfo, cannot check for FD leak and add some context to --- FAIL: TestUtimesNano (0.00s) matrix_test.go:628: no such file or directory See https://github.com/rfjakob/gocryptfs/pull/343#issuecomment-453888006 for full test output
2019-01-06tests: move fallocate tests to its own fileJakob Unterwurzacher
matrix_test.go is already too big.
2019-01-06tests: TestFallocate: comment what "d" and "h" meansJakob Unterwurzacher
Document what "d" and "h" means in the fancy ASCII diagrams. https://github.com/rfjakob/gocryptfs/pull/326
2019-01-01tests: teach ListFds() to check other processesJakob Unterwurzacher
2019-01-01tests: save gocryptfs process id in test_helpers.MountPIDJakob Unterwurzacher
This will allow to tests to monitor fd usage and maybe other things.
2019-01-01fusefrontend: make Access() symlink-safe.Jakob Unterwurzacher
Make Access() symlink-safe through use of faccessat.
2018-09-22tests: detect and report chmod failures earlierJakob Unterwurzacher
Instead of reporting the consequence: matrix_test.go:906: modeHave 0664 != modeWant 0777 Report it if chmod itself fails, and also report the old file mode: matrix_test.go:901: chmod 000 -> 777 failed: bad file descriptor
2018-09-08tests: restore Go 1.7 compatibilityJakob Unterwurzacher
Go 1.7 does not have t.Name() yet.
2018-09-08tests: add chmod testJakob Unterwurzacher
Makes sure we don't add regressions when fixing https://github.com/rfjakob/gocryptfs/issues/259
2018-09-08tests: restore TestUtimesNanoSymlinkJakob Unterwurzacher
The function seems to have been renamed by 426b9536 by mistake. Rename it back so the test is run again.
2018-04-07tests: cli_test: fix fd leakJakob Unterwurzacher
One fd leak found in TestMountBackground.
2018-04-07tests: matrix: check for fd leaksJakob Unterwurzacher
And fix two in test_helpers.Mount(). Leftover fds can cause an unmount failure like this later: fusermount: failed to unmount /tmp/gocryptfs-test-parent/873632270/default-plain: Device or resource busy so try to catch them early.
2018-04-01tests: add a few explicit file Close() in matrix_testJakob Unterwurzacher
These can cause EBUSY errors when unmounting.
2018-03-06tests: drop "-z" from fusermount to catch forgotten fdsJakob Unterwurzacher
macos does not have lazy unmount, so let's not use it on linux either. If the unmount fails, run "lsof" to find the open file. Also fix the first bug we found this way.
2018-03-05tests: matrix_test: skip cases when without_openssl is setJakob Unterwurzacher
Fixes test-without-openssl.bash.
2018-03-05macos: doTestUtimesNano: skip UTIME_OMIT and nanoseconds testcasesJakob Unterwurzacher
Not supported on macos. Beef up the first test case a little by using different second values.
2018-03-05tests: TestUtimesNano: replace ugly compareUtimes wrapperJakob Unterwurzacher
2018-03-05tests: fix a few fd leaksJakob Unterwurzacher
We relied on the finalizer to close a few fds. For some reason, this did not cause problems on Linux, but on MacOS, it causes unmount failures: umount(/private/tmp/gocryptfs-test-parent/194654785/default-plain): Resource busy -- try 'diskutil unmount'
2018-03-05macos: skip TestUtimesNanoSymlink earlyJakob Unterwurzacher
Gets rid of the touch error message upon running the tests.
2018-02-28MacOS: skip TestUtimesNanoSymlink and TestUtimesNanoFdJakob Unterwurzacher
These cannot work on MacOS.
2018-01-17fusefronted: add PlaintextNames special-cases for Create & RenameJakob Unterwurzacher
gocryptfs.longname.XXX files were considered magic in PlaintextNames mode, which was wrong. Fix that and add tests. Fixes https://github.com/rfjakob/gocryptfs/issues/174
2017-12-25fusefrontend: Handle PlaintextNames mode in LinkSebastian Lackner
In PlaintextNames mode the "gocryptfs.longname." prefix does not have any special meaning. https://github.com/rfjakob/gocryptfs/issues/174
2017-11-28fusefrontend: Handle PlaintextNames mode in UnlinkSebastian Lackner
In PlaintextNames mode the "gocryptfs.longname." prefix does not have any special meaning. We should not attempt to delete any .name files. Partially fixes https://github.com/rfjakob/gocryptfs/issues/174
2017-11-28fusefrontend: Handle PlaintextNames mode in MknodSebastian Lackner
In PlaintextNames mode the "gocryptfs.longname." prefix does not have any special meaning. We should not attempt to read the directory IV or to create special .name files. Partially fixes https://github.com/rfjakob/gocryptfs/issues/174
2017-11-27fusefronted: allow_other: close race between mknod and chownJakob Unterwurzacher
If the user manages to replace the directory with a symlink at just the right time, we could be tricked into chown'ing the wrong file. This change fixes the race by using fchownat, which unfortunately is not available on darwin, hence a compat wrapper is added. Scenario, as described by @slackner at https://github.com/rfjakob/gocryptfs/issues/177 : 1. Create a forward mount point with `plaintextnames` enabled 2. Mount as root user with `allow_other` 3. For testing purposes create a file `/tmp/file_owned_by_root` which is owned by the root user 4. As a regular user run inside of the GoCryptFS mount: ``` mkdir tempdir mknod tempdir/file_owned_by_root p & mv tempdir tempdir2 ln -s /tmp tempdir ``` When the steps are done fast enough and in the right order (run in a loop!), the device file will be created in `tempdir`, but the `lchown` will be executed by following the symlink. As a result, the ownership of the file located at `/tmp/file_owned_by_root` will be changed.
2017-11-25fusefrontend: Fix longname handling for renames with existing targetSebastian Lackner
Fixes https://github.com/rfjakob/gocryptfs/issues/170 Steps to reproduce the problem: * Create a regular forward mount point * Create a file with a shortname and one with a long filename * Try to run 'mv <shortname> <longname>' This should actually work and replace the existing file, but instead it fails with: mv: cannot move '<shortname>' to '<longname>': File exists The problem is the creation of the .name file. If the target already exists we can safely ignore the EEXIST error and just keep the existing .name file.