os: pull in os.Rename and some of its tests from upstream

Skip part of the test on Windows because of https://github.com/tinygo-org/tinygo/issues/2480

TODO: fix 2480 and unskip test
TODO: pull in rest of upstream tests, fix problems they find

Requested in https://github.com/tinygo-org/tinygo/issues/2109
This commit is contained in:
Dan Kegel
2022-01-03 10:52:41 -08:00
committed by Ron Evans
parent 72e15af1fa
commit 29f7ebc63e
5 changed files with 127 additions and 1 deletions
+9
View File
@@ -18,6 +18,15 @@ func fixLongPath(path string) string {
return path
}
func rename(oldname, newname string) error {
// TODO: import rest of upstream tests, handle fancy cases
err := syscall.Rename(oldname, newname)
if err != nil {
return &LinkError{"rename", oldname, newname, err}
}
return nil
}
func Pipe() (r *File, w *File, err error) {
var p [2]int
err = handleSyscallError(syscall.Pipe2(p[:], syscall.O_CLOEXEC))