mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
unix: skip TestClonefile* on ENOSYS or ENOTSUP
The clonefile syscalls added by CL 254757 might fail on certain macOS versions and/or file systems according to the clonefile(2) manpage. Skip the corresponding tests in these cases. This fixes the test failure on the darwin-amd64-10_12 builder. Change-Id: Iae1d2b6d8e2fcddc129d639f003fbb1817b45006 Reviewed-on: https://go-review.googlesource.com/c/sys/+/255198 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
648f2a0390
commit
efd3b9a0ff
@@ -57,7 +57,9 @@ func TestClonefile(t *testing.T) {
|
||||
|
||||
clonedName := file.Name() + "-cloned"
|
||||
err := unix.Clonefile(file.Name(), clonedName, 0)
|
||||
if err != nil {
|
||||
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
||||
t.Skip("clonefile is not available or supported, skipping test")
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove(clonedName)
|
||||
@@ -78,10 +80,11 @@ func TestClonefileatWithCwd(t *testing.T) {
|
||||
|
||||
clonedName := file.Name() + "-cloned"
|
||||
err := unix.Clonefileat(unix.AT_FDCWD, file.Name(), unix.AT_FDCWD, clonedName, 0)
|
||||
if err != nil {
|
||||
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
||||
t.Skip("clonefileat is not available or supported, skipping test")
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer os.Remove(clonedName)
|
||||
|
||||
clonedData, err := ioutil.ReadFile(clonedName)
|
||||
@@ -134,7 +137,9 @@ func TestClonefileatWithRelativePaths(t *testing.T) {
|
||||
src := path.Base(srcFile.Name())
|
||||
dst := path.Base(dstFile.Name())
|
||||
err = unix.Clonefileat(srcFd, src, dstFd, dst, 0)
|
||||
if err != nil {
|
||||
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
||||
t.Skip("clonefileat is not available or supported, skipping test")
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -165,7 +170,9 @@ func TestFclonefileat(t *testing.T) {
|
||||
os.Remove(dstFile.Name())
|
||||
|
||||
err = unix.Fclonefileat(fd, unix.AT_FDCWD, dstFile.Name(), 0)
|
||||
if err != nil {
|
||||
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
||||
t.Skip("clonefileat is not available or supported, skipping test")
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user