github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/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  //go:build solaris
     6  // +build solaris
     7  
     8  package unix_test
     9  
    10  import (
    11  	"os/exec"
    12  	"testing"
    13  
    14  	"golang.org/x/sys/unix"
    15  )
    16  
    17  func TestStatvfs(t *testing.T) {
    18  	if err := unix.Statvfs("", nil); err == nil {
    19  		t.Fatal(`Statvfs("") expected failure`)
    20  	}
    21  
    22  	statvfs := unix.Statvfs_t{}
    23  	if err := unix.Statvfs("/", &statvfs); err != nil {
    24  		t.Errorf(`Statvfs("/") failed: %v`, err)
    25  	}
    26  
    27  	if t.Failed() {
    28  		mount, err := exec.Command("mount").CombinedOutput()
    29  		if err != nil {
    30  			t.Logf("mount: %v\n%s", err, mount)
    31  		} else {
    32  			t.Logf("mount: %s", mount)
    33  		}
    34  	}
    35  }
    36  
    37  func TestSysconf(t *testing.T) {
    38  	n, err := unix.Sysconf(3 /* SC_CLK_TCK */)
    39  	if err != nil {
    40  		t.Fatalf("Sysconf: %v", err)
    41  	}
    42  	t.Logf("Sysconf(SC_CLK_TCK) = %d", n)
    43  }