1 // Copyright 2017 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.
13 "golang.org/x/sys/unix"
16 func TestPipe2(t *testing.T) {
19 err := unix.Pipe2(pipes[:], 0)
21 t.Fatalf("pipe2: %v", err)
26 n, err := unix.Write(w, []byte(s))
28 t.Errorf("bad write: %v", err)
32 t.Errorf("bad write count: %d", n)
37 t.Errorf("bad close: %v", err)
41 var buf [10 + len(s)]byte
42 n, err := unix.Read(r, buf[:])
44 t.Fatalf("bad read: %v", err)
47 t.Fatalf("bad read count: %d", n)
49 if string(buf[:n]) != s {
50 t.Fatalf("bad contents: %s", string(buf[:n]))
54 t.Fatalf("bad close: %v", err)
58 func TestStatvfs(t *testing.T) {
59 if err := unix.Statvfs("", nil); err == nil {
60 t.Fatal(`Statvfs("") expected failure`)
63 statvfs := unix.Statvfs_t{}
64 if err := unix.Statvfs("/", &statvfs); err != nil {
65 t.Errorf(`Statvfs("/") failed: %v`, err)
69 mount, err := exec.Command("mount").CombinedOutput()
71 t.Logf("mount: %v\n%s", err, mount)
73 t.Logf("mount: %s", mount)