2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-06 19:10:49 +00:00

Update golang.org/x/sys/unix

This commit is contained in:
Alexander Neumann 2016-09-15 22:35:45 +02:00
parent da83bd8265
commit 595f2582fa
2 changed files with 23 additions and 8 deletions

2
vendor/manifest vendored
View File

@ -87,7 +87,7 @@
{
"importpath": "golang.org/x/sys/unix",
"repository": "https://go.googlesource.com/sys",
"revision": "a646d33e2ee3172a661fc09bca23bb4889a41bc8",
"revision": "30de6d19a3bd89a5f38ae4028e23aaa5582648af",
"branch": "master",
"path": "/unix"
}

View File

@ -7,6 +7,7 @@
package unix_test
import (
"os/exec"
"runtime"
"testing"
@ -14,23 +15,37 @@ import (
)
const MNT_WAIT = 1
const MNT_NOWAIT = 2
func TestGetfsstat(t *testing.T) {
n, err := unix.Getfsstat(nil, MNT_WAIT)
const flags = MNT_NOWAIT // see golang.org/issue/16937
n, err := unix.Getfsstat(nil, flags)
if err != nil {
t.Fatal(err)
}
data := make([]unix.Statfs_t, n)
n, err = unix.Getfsstat(data, MNT_WAIT)
n2, err := unix.Getfsstat(data, flags)
if err != nil {
t.Fatal(err)
}
empty := unix.Statfs_t{}
for _, stat := range data {
if stat == empty {
t.Fatal("an empty Statfs_t struct was returned")
if n != n2 {
t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
}
for i, stat := range data {
if stat == (unix.Statfs_t{}) {
t.Errorf("index %v is an empty Statfs_t struct", i)
}
}
if t.Failed() {
for i, stat := range data[:n2] {
t.Logf("data[%v] = %+v", i, stat)
}
mount, err := exec.Command("mount").CombinedOutput()
if err != nil {
t.Logf("mount: %v\n%s", err, mount)
} else {
t.Logf("mount: %s", mount)
}
}
}