• Jakob Unterwurzacher's avatar
    tests: fix data race in TestDirIVRace · cd7a6862
    Jakob Unterwurzacher authored
    Ironically, the test for DirIV races had a data race itself
    by writing to a bool without taking a lock.
    
    Found by running "./test.bash -race":
    
    WARNING: DATA RACE
    Write at 0x00c00001dea5 by goroutine 22:
      github.com/rfjakob/gocryptfs/tests/defaults.TestDirIVRace.func1()
          /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/diriv_test.go:39 +0x38
      github.com/rfjakob/gocryptfs/tests/defaults.TestDirIVRace()
          /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/diriv_test.go:73 +0x65c
      testing.tRunner()
          /usr/local/go/src/testing/testing.go:865 +0x163
    
    Previous read at 0x00c00001dea5 by goroutine 23:
      github.com/rfjakob/gocryptfs/tests/defaults.TestDirIVRace.func2()
          /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/diriv_test.go:51 +0x8b
    
    Goroutine 22 (running) created at:
      testing.(*T).Run()
          /usr/local/go/src/testing/testing.go:916 +0x699
      testing.runTests.func1()
          /usr/local/go/src/testing/testing.go:1157 +0xa8
      testing.tRunner()
          /usr/local/go/src/testing/testing.go:865 +0x163
      testing.runTests()
          /usr/local/go/src/testing/testing.go:1155 +0x523
      testing.(*M).Run()
          /usr/local/go/src/testing/testing.go:1072 +0x2eb
      github.com/rfjakob/gocryptfs/tests/defaults.TestMain()
          /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/main_test.go:21 +0xe1
      main.main()
          _testmain.go:76 +0x222
    
    Goroutine 23 (running) created at:
      github.com/rfjakob/gocryptfs/tests/defaults.TestDirIVRace()
          /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/diriv_test.go:43 +0x48d
      testing.tRunner()
          /usr/local/go/src/testing/testing.go:865 +0x163
    ==================
    --- FAIL: TestDirIVRace (0.00s)
        testing.go:809: race detected during execution of test
    FAIL
    cd7a6862
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
gocryptfs-xray Loading commit data...
internal Loading commit data...
profiling Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
Gopkg.lock Loading commit data...
Gopkg.toml Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
benchmark-reverse.bash Loading commit data...
benchmark.bash Loading commit data...
build-without-openssl.bash Loading commit data...
build.bash Loading commit data...
cli_args.go Loading commit data...
cli_args_test.go Loading commit data...
crossbuild.bash Loading commit data...
daemonize.go Loading commit data...
fsck.go Loading commit data...
go1.4.go Loading commit data...
golint.bash Loading commit data...
help.go Loading commit data...
info.go Loading commit data...
init_dir.go Loading commit data...
main.go Loading commit data...
masterkey.go Loading commit data...
mount.go Loading commit data...
package-source.bash Loading commit data...
package-static.bash Loading commit data...
package.bash Loading commit data...
profiling.go Loading commit data...
race.go Loading commit data...
sendusr1.go Loading commit data...
test-without-openssl.bash Loading commit data...
test.bash Loading commit data...