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.
5 //go:build darwin || dragonfly || freebsd || openbsd
18 func TestGetfsstat(t *testing.T) {
19 const flags = MNT_NOWAIT // see Issue 16937
20 n, err := syscall.Getfsstat(nil, flags)
21 t.Logf("Getfsstat(nil, %d) = (%v, %v)", flags, n, err)
26 data := make([]syscall.Statfs_t, n)
27 n2, err := syscall.Getfsstat(data, flags)
28 t.Logf("Getfsstat([]syscall.Statfs_t, %d) = (%v, %v)", flags, n2, err)
33 t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
35 for i, stat := range data {
36 if stat == (syscall.Statfs_t{}) {
37 t.Errorf("index %v is an empty Statfs_t struct", i)
41 for i, stat := range data[:n2] {
42 t.Logf("data[%v] = %+v", i, stat)
44 mount, err := exec.Command("mount").CombinedOutput()
46 t.Logf("mount: %v\n%s", err, mount)
48 t.Logf("mount: %s", mount)