mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-29 21:36:43 -04:00
unix: use filepath in tests where appropriate
Change-Id: I0b80cdf4fcf48b80139bf4439f4c78954c972382 Reviewed-on: https://go-review.googlesource.com/c/sys/+/527155 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Gopher Robot
parent
4848eb0479
commit
cb4ecd9fe9
@@ -9,7 +9,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@@ -126,8 +126,8 @@ func TestClonefileatWithRelativePaths(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
src := path.Base(srcFile.Name())
|
src := filepath.Base(srcFile.Name())
|
||||||
dst := path.Base(dstFile.Name())
|
dst := filepath.Base(dstFile.Name())
|
||||||
err = unix.Clonefileat(srcFd, src, dstFd, dst, 0)
|
err = unix.Clonefileat(srcFd, src, dstFd, dst, 0)
|
||||||
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
if err == unix.ENOSYS || err == unix.ENOTSUP {
|
||||||
t.Skip("clonefileat is not available or supported, skipping test")
|
t.Skip("clonefileat is not available or supported, skipping test")
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -102,7 +101,7 @@ const testfile = "gocapmodetest"
|
|||||||
const testfile2 = testfile + "2"
|
const testfile2 = testfile + "2"
|
||||||
|
|
||||||
func CapEnterTest() {
|
func CapEnterTest() {
|
||||||
_, err := os.OpenFile(path.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
|
_, err := os.OpenFile(filepath.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("OpenFile: %s", err))
|
panic(fmt.Sprintf("OpenFile: %s", err))
|
||||||
}
|
}
|
||||||
@@ -112,7 +111,7 @@ func CapEnterTest() {
|
|||||||
panic(fmt.Sprintf("CapEnter: %s", err))
|
panic(fmt.Sprintf("CapEnter: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = os.OpenFile(path.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
|
_, err = os.OpenFile(filepath.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
panic("OpenFile works!")
|
panic("OpenFile works!")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user