• Jakob Unterwurzacher's avatar
    fs: TestFsstress: add rename, link ; reduce runtime to 1 sec · 6a785da2
    Jakob Unterwurzacher authored
    With rename and link, it hangs within 20ms, so we can reduce the
    runtime.
    
    Also add deadlock detection & statistics printout.
    
    A good run looks like this:
    
    	$ TMPDIR=/var/tmp go test -run TestFsstress -v
    	=== RUN   TestFsstress
    	    simple_test.go:601: Operation statistics:
    	    simple_test.go:604:      creat:    33 ok, 132978 fail,  0 hung
    	    simple_test.go:604:       link:    85 ok,  37196 fail,  0 hung
    	    simple_test.go:604:      mkdir:    60 ok, 155273 fail,  0 hung
    	    simple_test.go:604:     mkfifo:    45 ok, 161937 fail,  0 hung
    	    simple_test.go:604: mknod_fifo:    55 ok, 154459 fail,  0 hung
    	    simple_test.go:604:  mknod_reg:    77 ok, 180614 fail,  0 hung
    	    simple_test.go:604: mknod_sock:    83 ok, 139479 fail,  0 hung
    	    simple_test.go:604:    readdir:    13 ok,      0 fail,  0 hung
    	    simple_test.go:604:     remove:   180 ok,     40 fail,  0 hung
    	    simple_test.go:604:     rename:   646 ok,    137 fail,  0 hung
    	    simple_test.go:604:      rmdir:    48 ok,  48342 fail,  0 hung
    	    simple_test.go:604:    symlink:    30 ok, 119954 fail,  0 hung
    	    simple_test.go:604:     unlink:   150 ok,   6121 fail,  0 hung
    
    	--- PASS: TestFsstress (1.02s)
    	PASS
    	ok  	github.com/hanwen/go-fuse/v2/fs	1.022s
    
    A bad run like this:
    
    	go-fuse/fs$ TMPDIR=/var/tmp go test -run TestFsstress -v
    	=== RUN   TestFsstress
    	    simple_test.go:592: timeout waiting for goroutines to exit (deadlocked?)
    	    simple_test.go:601: Operation statistics:
    	    simple_test.go:604:      creat:     0 ok,     44 fail, 10 hung
    	    simple_test.go:604:       link:     0 ok,      6 fail, 10 hung
    	    simple_test.go:604:      mkdir:     1 ok,    283 fail, 10 hung
    	    simple_test.go:604:     mkfifo:     1 ok,    140 fail, 10 hung
    	    simple_test.go:604: mknod_fifo:     1 ok,   1246 fail, 10 hung
    	    simple_test.go:604:  mknod_reg:     0 ok,     19 fail, 10 hung
    	    simple_test.go:604: mknod_sock:     0 ok,    110 fail, 10 hung
    	    simple_test.go:604:    readdir:     1 ok,      0 fail,  1 hung
    	    simple_test.go:604:     remove:     1 ok,      0 fail, 10 hung
    	    simple_test.go:604:     rename:     0 ok,     12 fail, 10 hung
    	    simple_test.go:604:      rmdir:     1 ok,    346 fail, 10 hung
    	    simple_test.go:604:    symlink:     1 ok,   1456 fail, 10 hung
    	    simple_test.go:604:     unlink:     2 ok,     15 fail, 10 hung
    	    simple_test.go:51: /usr/bin/fusermount: failed to unmount /var/tmp/TestFsstress302646914/mnt: Device or resource busy
    	         (code exit status 1)
    
    	--- FAIL: TestFsstress (2.30s)
    	FAIL
    
    	[hangs]
    
    Change-Id: I9eb0ce02eb1df766be257d6a87de53c6ffa6d21e
    6a785da2
simple_test.go 13.7 KB