From 0514fecd9020154df7e61c82e7db37faa259511a Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 6 Sep 2023 16:49:56 -0700 Subject: [PATCH] unix: rm unused zos test helper functions These functions are not used anywhere in zos tests. Checked with: git grep -wE 'mktmpfifo|touch|chtmpdir' \ $(git grep -lw zos | grep _test.go; ls *_zos_test.go) Change-Id: Ie8b25640578e1c607dd4e4f0fe4e7869f8e3f5d3 Reviewed-on: https://go-review.googlesource.com/c/sys/+/526296 Reviewed-by: Tobias Klauser Reviewed-by: Cherry Mui Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Dustin Ward --- unix/syscall_zos_test.go | 53 ---------------------------------------- 1 file changed, 53 deletions(-) diff --git a/unix/syscall_zos_test.go b/unix/syscall_zos_test.go index 0be76924..b89cd908 100644 --- a/unix/syscall_zos_test.go +++ b/unix/syscall_zos_test.go @@ -553,59 +553,6 @@ func TestMkdev(t *testing.T) { } } -// mktmpfifo creates a temporary FIFO and provides a cleanup function. -func mktmpfifo(t *testing.T) (*os.File, func()) { - err := unix.Mkfifo("fifo", 0666) - if err != nil { - t.Fatalf("mktmpfifo: failed to create FIFO: %v", err) - } - - f, err := os.OpenFile("fifo", os.O_RDWR, 0666) - if err != nil { - os.Remove("fifo") - t.Fatalf("mktmpfifo: failed to open FIFO: %v", err) - } - - return f, func() { - f.Close() - os.Remove("fifo") - } -} - -// utilities taken from os/os_test.go - -func touch(t *testing.T, name string) { - f, err := os.Create(name) - if err != nil { - t.Fatal(err) - } - if err := f.Close(); err != nil { - t.Fatal(err) - } -} - -// chtmpdir changes the working directory to a new temporary directory and -// provides a cleanup function. Used when PWD is read-only. -func chtmpdir(t *testing.T) func() { - oldwd, err := os.Getwd() - if err != nil { - t.Fatalf("chtmpdir: %v", err) - } - d, err := ioutil.TempDir("", "test") - if err != nil { - t.Fatalf("chtmpdir: %v", err) - } - if err := os.Chdir(d); err != nil { - t.Fatalf("chtmpdir: %v", err) - } - return func() { - if err := os.Chdir(oldwd); err != nil { - t.Fatalf("chtmpdir: %v", err) - } - os.RemoveAll(d) - } -} - func TestMountUnmount(t *testing.T) { // use an available fs var buffer struct {