go/src/os
qmuntal 7007dfcd0c os: clean-up NewFile tests
This CL removes some unnecessary code and duplicated NewFile tests
cases.

It also simplifies TestPipeCanceled by removing the need for using
SetReadDeadline. Using CancelIoEx instead of CancelIo makes the cancel
operations to finish almost instantly. The latter could take more than
20s to finish if called from a thread different from the one that
called ReadFile.

Change-Id: I9033cbcad277666bc2aec89b3e5a3ef529da2cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/663755
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-09 13:06:17 -07:00
..
exec all: use exec.Command.String in test logs 2025-03-20 09:10:13 -07:00
signal all: use testenv.Executable instead of os.Executable and os.Args[0] 2025-02-24 11:03:10 -08:00
testdata os: check permissions of CopyFS copied files 2024-10-04 14:46:36 +00:00
user all: use a more straightforward return value 2025-02-18 09:28:50 -08:00
copy_test.go internal/poll: avoid overflow in sendfile limit, simplify Solaris 2024-10-30 20:15:22 +00:00
dir.go os: remove unused testingForceReadDirLstat 2025-03-07 11:33:06 -08:00
dir_darwin.go os: make File.Readdir et al concurrency-safe 2024-04-15 20:52:06 +00:00
dir_plan9.go os: fix race condition in readdir by atomically initializing dirinfo 2025-02-04 18:18:11 -08:00
dir_unix.go os: fix race condition in readdir by atomically initializing dirinfo 2025-02-04 18:18:11 -08:00
dir_windows.go os: make File.Readdir et al concurrency-safe 2024-04-15 20:52:06 +00:00
dirent_aix.go
dirent_dragonfly.go
dirent_freebsd.go
dirent_js.go
dirent_linux.go
dirent_netbsd.go
dirent_openbsd.go
dirent_solaris.go
dirent_wasip1.go
eloop_netbsd.go os: recognize EFTYPE, EINVAL as a refusal to open a symlink 2024-11-21 15:20:22 +00:00
eloop_other.go os: recognize EFTYPE, EINVAL as a refusal to open a symlink 2024-11-21 15:20:22 +00:00
env.go
env_test.go os: don't log the entire environment in tests 2025-02-20 22:15:35 -08:00
env_unix_test.go
error.go os: clarify that IsNotExist, IsExist, IsPermission and IsTimeout work with nil errors 2024-07-11 00:10:03 +00:00
error_errno.go os: treat Getwd result of ENOMEM the same as ENAMETOOLONG 2024-09-04 00:53:44 +00:00
error_plan9.go os: treat Getwd result of ENOMEM the same as ENAMETOOLONG 2024-09-04 00:53:44 +00:00
error_test.go
error_unix_test.go
error_windows_test.go
example_test.go os: document CopyFS behavior for symlinks in destination 2024-07-24 18:24:15 +00:00
exec.go os: improve comments for process support, minor code cleanup 2025-02-07 17:12:12 -08:00
exec_linux.go os: separate Process.handle into a separate memory allocation 2025-02-04 13:10:59 -08:00
exec_nohandle.go os: separate Process.handle into a separate memory allocation 2025-02-04 13:10:59 -08:00
exec_plan9.go os: simplify Process.Release 2025-02-07 17:10:44 -08:00
exec_posix.go os: dup pidfd if caller sets PidFD manually 2024-08-31 22:13:58 +00:00
exec_test.go os: always return syscall.ECHILD from Wait for done process 2024-06-11 18:08:44 +00:00
exec_unix.go os: simplify Process.Release 2025-02-07 17:10:44 -08:00
exec_unix_test.go os: don't try to signal PID -1 on Unix 2024-07-17 20:32:58 +00:00
exec_windows.go os: simplify Process.Release 2025-02-07 17:10:44 -08:00
exec_windows_test.go
executable.go
executable_darwin.go cmd/link: disallow pull-only linknames 2024-05-15 19:57:43 +00:00
executable_dragonfly.go os: sysctl-based Executable implementation for NetBSD 2024-11-18 19:09:39 +00:00
executable_freebsd.go os: sysctl-based Executable implementation for NetBSD 2024-11-18 19:09:39 +00:00
executable_netbsd.go os: sysctl-based Executable implementation for NetBSD 2024-11-18 19:09:39 +00:00
executable_path.go
executable_plan9.go
executable_procfs.go os: sysctl-based Executable implementation for NetBSD 2024-11-18 19:09:39 +00:00
executable_solaris.go cmd/link: disallow pull-only linknames 2024-05-15 19:57:43 +00:00
executable_sysctl.go os: sysctl-based Executable implementation for NetBSD 2024-11-18 19:09:39 +00:00
executable_test.go os: improve TestExecutable 2024-09-03 20:16:11 +00:00
executable_wasm.go
executable_windows.go
export_freebsd_test.go internal,os: employ copy_file_range(2) for file-to-file copying on FreeBSD 2024-08-15 19:23:02 +00:00
export_linux_test.go os: simplify process status 2025-02-06 17:14:46 -08:00
export_test.go os: remove unused testingForceReadDirLstat 2025-03-07 11:33:06 -08:00
export_unix_test.go
export_windows_test.go Revert "os: check for valid Windows path when creating files" 2024-11-19 17:26:40 +00:00
fifo_test.go math,os,os/*: use testenv.Executable 2024-09-03 20:11:30 +00:00
file.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
file_mutex_plan9.go
file_open_unix.go
file_open_wasip1.go
file_plan9.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
file_posix.go os: add Root.Chtimes 2025-03-18 17:32:48 -07:00
file_test.go io/fs: add ReadLinkFS interface 2025-02-03 08:38:43 -08:00
file_unix.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
file_wasip1.go
file_windows.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
getwd.go os: add and use ignoringEINTR2 2024-11-16 08:22:18 +00:00
getwd_unix_test.go os: check for EACCES, not EPERM, in Getwd test 2024-09-12 00:11:48 +00:00
os_test.go os: add Root.Symlink 2025-03-28 11:02:40 -07:00
os_unix_test.go os: don't wrap os.Getgroups error in tests 2025-03-20 08:15:51 -07:00
os_windows_test.go os: clean-up NewFile tests 2025-04-09 13:06:17 -07:00
path.go os: use filepathlite.VolumeName 2024-04-30 15:38:09 +00:00
path_plan9.go os: use filepathlite.VolumeName 2024-04-30 15:38:09 +00:00
path_test.go
path_unix.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
path_windows.go os: avoid symlink races in RemoveAll on Windows 2025-03-31 15:36:10 -07:00
path_windows_test.go Revert "os: check for valid Windows path when creating files" 2024-11-19 17:26:40 +00:00
pidfd_linux.go os: improve comments for process support, minor code cleanup 2025-02-07 17:12:12 -08:00
pidfd_linux_test.go syscall: on exec failure, close pidfd 2024-09-10 22:35:31 +00:00
pidfd_other.go os: dup pidfd if caller sets PidFD manually 2024-08-31 22:13:58 +00:00
pipe2_unix.go
pipe_test.go all: use testenv.Executable instead of os.Executable and os.Args[0] 2025-02-24 11:03:10 -08:00
pipe_unix.go
pipe_wasm.go
proc.go
rawconn.go
rawconn_test.go
read_test.go os: use t.TempDir in TestReadOnlyWriteFile 2024-08-20 16:06:05 +00:00
readfrom_freebsd_test.go internal,os: employ copy_file_range(2) for file-to-file copying on FreeBSD 2024-08-15 19:23:02 +00:00
readfrom_linux_test.go Revert "os: employ sendfile(2) for file-to-file copying on Linux when needed" 2025-01-29 06:29:28 -08:00
readfrom_sendfile_test.go Revert "os: employ sendfile(2) for file-to-file copying on Linux when needed" 2025-01-29 06:29:28 -08:00
readfrom_solaris_test.go os: increase the amount of data transfer for sendfile(2) to reduce syscalls 2024-08-15 20:21:47 +00:00
readfrom_unix_test.go os: only employ sendfile(3ext) on illumos when target is regular file 2024-08-16 23:34:45 +00:00
removeall_at.go os: avoid symlink races in RemoveAll on Windows 2025-03-31 15:36:10 -07:00
removeall_noat.go os: avoid symlink races in RemoveAll on Windows 2025-03-31 15:36:10 -07:00
removeall_test.go os: simplify TestRemoveAllDot 2024-08-20 16:06:03 +00:00
removeall_unix.go os: avoid symlink races in RemoveAll on Windows 2025-03-31 15:36:10 -07:00
removeall_windows.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
root.go os: add Root.Symlink 2025-03-28 11:02:40 -07:00
root_js.go os: add Root.Remove 2024-11-20 23:21:14 +00:00
root_nonwindows.go os: add Root 2024-11-20 23:20:45 +00:00
root_noopenat.go os: add Root.Symlink 2025-03-28 11:02:40 -07:00
root_openat.go os: avoid panic in Root when symlink references the root 2025-03-27 22:25:37 -07:00
root_plan9.go os: add Root.Remove 2024-11-20 23:21:14 +00:00
root_test.go os: add Root.Symlink 2025-03-28 11:02:40 -07:00
root_unix.go os: avoid symlink races in RemoveAll on Windows 2025-03-31 15:36:10 -07:00
root_unix_test.go os: don't wrap os.Getgroups error in tests 2025-03-20 08:15:51 -07:00
root_windows.go os: support overlapped IO with NewFile 2025-04-04 14:00:21 -07:00
root_windows_test.go os: add Root.Symlink 2025-03-28 11:02:40 -07:00
stat.go
stat_aix.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_darwin.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_dragonfly.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_freebsd.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_js.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_linux.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_netbsd.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_openbsd.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_plan9.go os: consolidate and clarify File.Fd docs 2025-02-13 13:10:32 -08:00
stat_solaris.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
stat_test.go os: convert poll.ErrFileClosed to ErrClosed for Stat 2024-04-03 22:38:03 +00:00
stat_unix.go os: convert poll.ErrFileClosed to ErrClosed for Stat 2024-04-03 22:38:03 +00:00
stat_wasip1.go os: add Root.FS 2024-11-20 23:21:42 +00:00
stat_windows.go all: use a more straightforward return value 2025-02-18 09:28:50 -08:00
sticky_bsd.go
sticky_notbsd.go
sys.go
sys_aix.go
sys_bsd.go
sys_js.go
sys_linux.go
sys_plan9.go
sys_solaris.go
sys_unix.go
sys_wasip1.go
sys_windows.go
tempfile.go os: document file mode of temporary files 2024-04-12 18:04:39 +00:00
tempfile_test.go os: use t.TempDir in TestMkdirTemp, TestCreateTemp 2024-08-20 16:06:08 +00:00
timeout_test.go all: use built-in max/min to simplify the code 2025-04-07 12:59:28 -07:00
types.go os: make File.Readdir et al concurrency-safe 2024-04-15 20:52:06 +00:00
types_plan9.go
types_unix.go
types_windows.go os: use filepathlite.Base 2024-05-07 18:44:48 +00:00
wait6_dragonfly.go
wait6_freebsd64.go
wait6_freebsd_386.go
wait6_freebsd_arm.go
wait6_netbsd.go
wait_unimp.go
wait_wait6.go os: correctly handle errno==0 in (*Process).blockUntilWaitable 2024-11-18 23:26:47 +00:00
wait_waitid.go internal/syscall/unix, os: add and use Waitid syscall wrapper on linux 2024-11-19 20:40:51 +00:00
writeto_linux_test.go os: employ sendfile(2) for file-to-file copying on SunOS when needed 2024-08-12 18:44:38 +00:00
zero_copy_freebsd.go os: update the linux minimal version and fix a typo for zero-copy 2024-09-03 15:44:06 +00:00
zero_copy_linux.go Revert "os: employ sendfile(2) for file-to-file copying on Linux when needed" 2025-01-29 06:29:28 -08:00
zero_copy_posix.go os: employ sendfile(2) for file-to-file copying on SunOS when needed 2024-08-12 18:44:38 +00:00
zero_copy_solaris.go net,os: consolidate poll.SendFile sending until EOF with 0 2024-11-01 01:09:12 +00:00
zero_copy_stub.go internal,os: employ copy_file_range(2) for file-to-file copying on FreeBSD 2024-08-15 19:23:02 +00:00