| 1 | package sftp |
| 2 | |
| 3 | import ( |
| 4 | "syscall" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestClientStatVFS(t *testing.T) { |
| 9 | if *testServerImpl { |
| 10 | t.Skipf("go server does not support FXP_EXTENDED") |
| 11 | } |
| 12 | sftp, cmd := testClient(t, READWRITE, NODELAY) |
| 13 | defer cmd.Wait() |
| 14 | defer sftp.Close() |
| 15 | |
| 16 | vfs, err := sftp.StatVFS("/") |
| 17 | if err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | |
| 21 | |
| 22 | s := syscall.Statfs_t{} |
| 23 | err = syscall.Statfs("/", &s) |
| 24 | if err != nil { |
| 25 | t.Fatal(err) |
| 26 | } |
| 27 | |
| 28 | |
| 29 | if vfs.Files != uint64(s.Files) { |
| 30 | t.Fatal("fr_size does not match") |
| 31 | } |
| 32 | |
| 33 | if vfs.Bfree != uint64(s.Bfree) { |
| 34 | t.Fatal("f_bsize does not match") |
| 35 | } |
| 36 | |
| 37 | if vfs.Favail != uint64(s.Ffree) { |
| 38 | t.Fatal("f_namemax does not match") |
| 39 | } |
| 40 | } |