mirror of https://github.com/restic/restic.git
Update golang.org/x/sys/unix
This commit is contained in:
parent
da83bd8265
commit
595f2582fa
|
@ -87,7 +87,7 @@
|
||||||
{
|
{
|
||||||
"importpath": "golang.org/x/sys/unix",
|
"importpath": "golang.org/x/sys/unix",
|
||||||
"repository": "https://go.googlesource.com/sys",
|
"repository": "https://go.googlesource.com/sys",
|
||||||
"revision": "a646d33e2ee3172a661fc09bca23bb4889a41bc8",
|
"revision": "30de6d19a3bd89a5f38ae4028e23aaa5582648af",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"path": "/unix"
|
"path": "/unix"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package unix_test
|
package unix_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -14,23 +15,37 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const MNT_WAIT = 1
|
const MNT_WAIT = 1
|
||||||
|
const MNT_NOWAIT = 2
|
||||||
|
|
||||||
func TestGetfsstat(t *testing.T) {
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := make([]unix.Statfs_t, n)
|
data := make([]unix.Statfs_t, n)
|
||||||
n, err = unix.Getfsstat(data, MNT_WAIT)
|
n2, err := unix.Getfsstat(data, flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if n != n2 {
|
||||||
empty := unix.Statfs_t{}
|
t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
|
||||||
for _, stat := range data {
|
}
|
||||||
if stat == empty {
|
for i, stat := range data {
|
||||||
t.Fatal("an empty Statfs_t struct was returned")
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue