syscall_bsd_test.go 634 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build darwin dragonfly freebsd openbsd
  5. package unix_test
  6. import (
  7. "testing"
  8. "unix"
  9. )
  10. const MNT_WAIT = 1
  11. func TestGetfsstat(t *testing.T) {
  12. n, err := unix.Getfsstat(nil, MNT_WAIT)
  13. if err != nil {
  14. t.Fatal(err)
  15. }
  16. data := make([]unix.Statfs_t, n)
  17. n, err = unix.Getfsstat(data, MNT_WAIT)
  18. if err != nil {
  19. t.Fatal(err)
  20. }
  21. empty := unix.Statfs_t{}
  22. for _, stat := range data {
  23. if stat == empty {
  24. t.Fatal("an empty Statfs_t struct was returned")
  25. }
  26. }
  27. }