aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
20 hourssharedstorage: fix darwin & freebsd build failureLockSharedStorage_rebase2Jakob Unterwurzacher
20 hourstests/cluster: fix possible fd exhaustionJakob Unterwurzacher
...and one typo.
21 hourstests/cluster: enable TestClusterConcurrentRW per defaultJakob Unterwurzacher
Add the -sharedstorage flag to the mounts and make it more severe by adjusting the I/O and file sizes to arbitrary unaligned values. It passes *most of the time*. If it fails, it's like this, and the reason is that there is no fcntl locks in the READ path yet. gocryptfs/tests/cluster$ go test -run TestClusterConcurrentRW -v === RUN TestClusterConcurrentRW doRead 2895433: corrupt block #0: cipher: message authentication failed doRead 2895433: corrupt block #0: cipher: message authentication failed doRead 2895433: corrupt block #0: cipher: message authentication failed cluster_test.go:98: readThread iteration 9165: ReadAt failed: read /var/tmp/gocryptfs-test-parent-1026/3021427391/TestClusterConcurrentRW.366469887.mnt1/foo: input/output error --- FAIL: TestClusterConcurrentRW (0.40s) FAIL exit status 1 FAIL github.com/rfjakob/gocryptfs/v2/tests/cluster 0.406s
21 hourstests/cluster: add TestPoCTornWriteLockedJakob Unterwurzacher
21 hourstests/cluster: note that ext4 provides no atomicityJakob Unterwurzacher
21 hourstests/cluster: add TestPoCTornWriteJakob Unterwurzacher
Scary. But explains why TestConcurrentCreate fails. gocryptfs/tests/cluster$ go test -run TestPoCTornWrite --- FAIL: TestPoCTornWrite (0.00s) poc_test.go:210: iteration 214: inconsistent block: d6d6d6d6d6d6d6d6d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1d1 FAIL
21 hourstests/cluster: add TestOpenTruncateJakob Unterwurzacher
This fails right now: 1 jakob@brikett:~/go/src/github.com/rfjakob/gocryptfs/tests/cluster$ go test -run TestOpenTruncate -v === RUN TestOpenTruncate cluster_test.go:235: POSIX compliance issue: non-exlusive create failed with err=file exists doWrite 2898550: corrupt header: ParseHeader: header is all-zero. Header hexdump: 000000000000000000000000000000000000 cluster_test.go:240: iteration 1: WriteAt: write /var/tmp/gocryptfs-test-parent-1026/1896094179/TestOpenTruncate.4202105280.mnt2/foo: input/output error --- FAIL: TestOpenTruncate (0.10s) FAIL exit status 1 FAIL github.com/rfjakob/gocryptfs/v2/tests/cluster 0.099s 1 jakob@brikett:~/go/src/github.com/rfjakob/gocryptfs/tests/cluster$ go test -run TestOpenTruncate -v === RUN TestOpenTruncate cluster_test.go:235: POSIX compliance issue: non-exlusive create failed with err=file exists doRead 2898565: corrupt block #0: cipher: message authentication failed ino2898565 fh9: RMW read failed: errno=5 cluster_test.go:240: iteration 8: WriteAt: write /var/tmp/gocryptfs-test-parent-1026/652691834/TestOpenTruncate.281532388.mnt1/foo: input/output error --- FAIL: TestOpenTruncate (0.09s) FAIL exit status 1 FAIL github.com/rfjakob/gocryptfs/v2/tests/cluster 0.095s
21 hourstests/cluster: add TestPoCHeaderCreationJakob Unterwurzacher
21 hourstests/cluster: add TestConcurrentCreateJakob Unterwurzacher
This exercises the byte-range locks we just added.
21 hoursfusefrontend: sharedstorage: use byte-range lock on file header creationJakob Unterwurzacher
Multiple host writing to the same empty file at the same time could have overwritten each other's newly created file header, leading to data corruption. Fix the race by placing a byte-range lock on the file when creating the file header.
5 daysreverse: hide custom -config file located inside CIPHERDIRmaximilize
In reverse mode, a custom config file passed via -config that lives inside CIPHERDIR was presented as an ordinary encrypted file in the encrypted view, which is useless and confusing. By default the config is mapped to a virtual gocryptfs.conf, but ConfigCustom skips that mapping, so an in-CIPHERDIR custom config was neither mapped nor hidden. Plumb the config path into the reverse RootNode and treat a custom config file located inside CIPHERDIR as excluded in isExcludedPlain, hiding it from both readdir and lookup. Also document the -config reverse-mode behaviour in MANPAGE.md and add a regression test. Fixes #1009
2026-03-08make formatfreebsd-supportJakob Unterwurzacher
2026-03-08Added basic support for FreeBSD.Ankush Patel
Freebsd-support: Change bash shebang to use /usr/bin/env Freebsd-support: Fix go vet "undefined" fixes when running make ci freebsd: stub xattr functions /proc/PID/fd does not exist on freebsd. freebsd-support: modify FchmodatNofollow for FreeBSD FreeBSD supports the Fchmodat system call, with the AT_SYMLINK_NOFOLLOW flag. FchmodatNofollow has been modified to use this system call and flag. freebsd-support: PR changes and fixes * Functions in fusefrontend_reverse/node_xattr_freebsd.go have been stubbed for now. * asuser_freebsd.go updated to only run f() when context is nil; otherwise log a warning and return an error. * emulate.go build flags updated, and FreeBSD specific version added. * sys_freebsd.go bug in Renameat2 with RENAME_EXCHANGE flag fixed. FreeBSD does not support atomic file swapping, so this flag now returns an error. * unix2syscall and atime is identical between FreeBSD and Darwin, updated filenames so Go will build the file for FreeBSD and Mac OS. freebsd-support: Addressed more PR comments and fixed build tags
2026-03-08tests: example_filesystems: more detailed errorsJakob Unterwurzacher
2026-03-08tests: only add -wpanic on linuxJakob Unterwurzacher
2026-02-10enable falloc on btrfs if CoW is disabledJared Van Bortel
2026-02-09darwin: syscallcompat: Openat: use O_SYMLINKJakob Unterwurzacher
Also add tests that opening a symlink (using unix.O_PATH | unix.O_NOFOLLOW) works. https://github.com/rfjakob/gocryptfs/issues/993
2026-02-08tests/reverse: add TestXattrGetMountpointJakob Unterwurzacher
Fails right now: gocryptfs/tests/reverse$ go test -run TestXattrGetMountpoint --- FAIL: TestXattrGetMountpoint (0.00s) xattr_test.go:78: LGet: xattr.get /var/tmp/gocryptfs-test-parent-1026/3269496664/x.3903415542.mnt user.foo453465324: invalid argument xattr_test.go:82: LList: err=<nil> FAIL testcases[0] = struct { plaintextnames bool; deterministic_names bool }{plaintextnames:false, deterministic_names:false} failed exit status 1 FAIL github.com/rfjakob/gocryptfs/v2/tests/reverse 0.091s
2026-02-01syscallcompat: DetectQuirks: suppress Btrfs message when -noprealloc has ↵Jakob Unterwurzacher
been passed Reported by @Tunoac, https://github.com/rfjakob/gocryptfs/issues/395#issuecomment-3828507487
2025-12-14Drop deprecated rand.Seed callsJakob Unterwurzacher
$ staticcheck --version staticcheck 2025.1.1 (0.6.1) $ staticcheck ./... contrib/findholes/holes/holes.go:179:2: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (SA1019) tests/defaults/acl_test.go:24:2: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (SA1019) tests/plaintextnames/file_holes_test.go:143:2: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (SA1019)
2025-11-29quirks: drop tmpfs xattr quirkJakob Unterwurzacher
tmpfs supports user xattrs since Linux 6.6 (anno 2023): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2daf18a7884dc03d5164ab9c7dc3f2ea70638469
2025-11-22reverse: fix TestXattrList failureJakob Unterwurzacher
On my Fedora I used to get this failure: --- FAIL: TestXattrList (0.00s) xattr_test.go:52: wrong number of names, want=20 have=21 xattr_test.go:58: mismatch on attr "security.selinux": valA = "", valC = "xxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzzzz" First step is to print the actual value using xattr.LGet. This improves the error message to this: --- FAIL: TestXattrList (0.00s) xattr_test.go:53: wrong number of names, want=20 have=21 xattr_test.go:59: mismatch on attr "security.selinux": valA = "", valC = "system_u:object_r:fusefs_t:s0\x00" 2nd step is to ignore "security." attribs as we have no control over them.
2025-11-22Xattrs support in reverse modeAleksey Vasenev
Fixes https://github.com/rfjakob/gocryptfs/issues/827
2025-10-02tests: matrix: add Test555DirJakob Unterwurzacher
--- FAIL: Test555Dir (0.00s) dir_test.go:90: wrong mode. want 0555 have 0755 FAIL TestMain: matrix[0] = matrix.testcaseMatrix{plaintextnames:false, openssl:"auto", aessiv:false, raw64:false, extraArgs:[]string(nil)} failed FAIL github.com/rfjakob/gocryptfs/v2/tests/matrix 2.109s https://github.com/rfjakob/gocryptfs/issues/964
2025-08-07tests: matrix: use unique ctlsock pathJakob Unterwurzacher
Because the deletion happens asynchronously, a previous iteration can delete the socket of the next one.
2025-08-07tests: matrix: add TestRenameExchangeOnGocryptfsrafjaf
Added testing for RENAME_EXCHANGE https://github.com/rfjakob/gocryptfs/issues/914
2025-08-03tests: matrix: add TestDirSizeJakob Unterwurzacher
Fails at the moment, as expected: === RUN TestDirSize matrix_test.go:938: stat size is different from fstat size: pStat=80 pFstat=30 matrix_test.go:941: fstat size is different: pSt=30 cSt=80 matrix_test.go:938: stat size is different from fstat size: pStat=100 pFstat=50 matrix_test.go:941: fstat size is different: pSt=50 cSt=100 matrix_test.go:938: stat size is different from fstat size: pStat=120 pFstat=70 matrix_test.go:941: fstat size is different: pSt=70 cSt=120 matrix_test.go:938: stat size is different from fstat size: pStat=140 pFstat=90 matrix_test.go:941: fstat size is different: pSt=90 cSt=140 matrix_test.go:938: stat size is different from fstat size: pStat=160 pFstat=110 matrix_test.go:941: fstat size is different: pSt=110 cSt=160 https://github.com/rfjakob/gocryptfs/issues/951
2025-08-03tests: matrix: enable ctlsockJakob Unterwurzacher
2025-08-03tests: matrix: make "matrix" localJakob Unterwurzacher
2025-08-03tests: matrix: factor out MainTestJakob Unterwurzacher
2025-08-03tests: overlayfs_test: fix typo in commentJakob Unterwurzacher
2025-08-03tests: root_test: move btrfs test to new fileJakob Unterwurzacher
2025-07-14tests: TestBtrfsQuirks: skip if mkfs.btrfs is not installedJakob Unterwurzacher
Fixes https://github.com/rfjakob/gocryptfs/issues/930
2025-07-08Fix all staticcheck errors in gocryptfs codebasecopilot-swe-agent[bot]
Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Add staticcheck to test.bash for continuous static analysis Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Fix nil pointer dereference in timesToTimespec function The previous fix for deprecated fuse.UtimeToTimespec caused a panic because unix.TimeToTimespec doesn't handle nil pointers. This fix properly handles nil pointers by using unix.UTIME_OMIT while still using the non-deprecated unix.TimeToTimespec function. Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Undo SA6002 changes and add staticcheck ignore directive instead Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com>
2025-07-07Fix a bunch of staticcheck errorsJakob Unterwurzacher
Tool-assisted.
2025-06-20tests: reverse: delete static directory treeJakob Unterwurzacher
2025-06-20tests: reverse: generate directory tree for exlucude tests dynamicallyJakob Unterwurzacher
2025-06-20testing: reverse: add some verbose loggingJakob Unterwurzacher
2025-06-19testing: reverse: factor out newReverseFSJakob Unterwurzacher
Will be used soon in a new gitignore test. Relates-to: https://github.com/rfjakob/gocryptfs/issues/927
2025-06-05tests: add TestRootForceOwnerJakob Unterwurzacher
$ make root_test [...] === RUN TestRootForceOwner root_test.go:398: mkdir /var/tmp/gocryptfs-test-parent-0/3816769547/TestRootForceOwner.2366169656.mnt/dir1: permission denied root_test.go:408: open /var/tmp/gocryptfs-test-parent-0/3816769547/TestRootForceOwner.2366169656.mnt/file1: permission denied root_test.go:415: mknod: permission denied --- FAIL: TestRootForceOwner (0.04s) https://github.com/rfjakob/gocryptfs/issues/783
2025-05-10tests: fsstress-gocryptfs.bash: inform user that they should wait for cleanupJakob Unterwurzacher
Without this message, fsstress-gocryptfs.bash seems to just hang after Ctrl-C.
2025-04-26darwin: tests/defaults: fix unix.Getdents build failureJakob Unterwurzacher
Error was: + go test -c -tags without_openssl -o /dev/null github.com/rfjakob/gocryptfs/v2/tests/defaults Error: tests/defaults/main_test.go:532:17: undefined: unix.Getdents Error: tests/defaults/main_test.go:538:16: undefined: unix.Getdents Error: tests/defaults/main_test.go:549:16: undefined: unix.Getdents
2025-04-19tests: add TestSeekDirJakob Unterwurzacher
Acc. to the commit message, https://github.com/hanwen/go-fuse/commit/0d1228a39dd49c83c8b7c30dec7928f5d7d84cc0 break seeking in directories. This commit appears in go-fuse v2.6.0.
2025-04-13stress_tests/pingpong.bash: better commentJakob Unterwurzacher
2025-04-07stress_tests: fsstress-gocryptfs.bash: don't try to recompileJakob Unterwurzacher
The days of GOPATH are over. Also, use the fsstress path that "sudo make install" in xfstests uses per default.
2025-04-07stress_tests/parallel_cp.sh: note that problem is fixedJakob Unterwurzacher
2025-04-05tests: fsck: generate evil files with "\r" and "\n" on the flyJakob Unterwurzacher
Because if we have them in git, we get this: $ go install github.com/rfjakob/gocryptfs/v2@latest go: downloading github.com/rfjakob/gocryptfs/v2 v2.5.2 go: github.com/rfjakob/gocryptfs/v2@latest: create zip: tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z g: malformed file path "tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\ng": invalid char '\n' g: malformed file path "tests/fsck/malleable_base64/27AG8t-XZH7G9ou2OSD_z\rg": invalid char '\r' Fixes: https://github.com/rfjakob/gocryptfs/issues/904 Relates-to: https://github.com/golang/go/issues/28001
2025-02-26tests/root_test: use our own Setgroups/Setregid/Setreuid wrappersJakob Unterwurzacher
2025-02-23tests/root_test: add TestConcurrentUserOps and TestAsUserSleepJakob Unterwurzacher
Both work with golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a but break with golang.org/x/sys v0.30.0 https://github.com/rfjakob/gocryptfs/issues/893 https://github.com/rfjakob/gocryptfs/issues/892
2025-02-17tests: root_test: add TestMainJakob Unterwurzacher
I will add more tests for https://github.com/rfjakob/gocryptfs/issues/893 soon, these will also use DefaultPlainDir.