github.com/dolotech/hongbao@v0.0.0-20191130105438-fd59d7a5dda5/src/golang.org/x/sys/unix/syscall_solaris_test.go (about)

     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.
     4  
     5  // +build solaris
     6  
     7  package unix_test
     8  
     9  import (
    10  	"os/exec"
    11  	"testing"
    12  
    13  	"golang.org/x/sys/unix"
    14  )
    15  
    16  func TestStatvfs(t *testing.T) {
    17  	if err := unix.Statvfs("", nil); err == nil {
    18  		t.Fatal(`Statvfs("") expected failure`)
    19  	}
    20  
    21  	statvfs := unix.Statvfs_t{}
    22  	if err := unix.Statvfs("/", &statvfs); err != nil {
    23  		t.Errorf(`Statvfs("/") failed: %v`, err)
    24  	}
    25  
    26  	if t.Failed() {
    27  		mount, err := exec.Command("mount").CombinedOutput()
    28  		if err != nil {
    29  			t.Logf("mount: %v\n%s", err, mount)
    30  		} else {
    31  			t.Logf("mount: %s", mount)
    32  		}
    33  	}
    34  }