mirror of https://github.com/golang/go.git
syscall: use t.TempDir in tests
Change-Id: Ibeb00306ee8f038c11f261abd99c05324bf2ab51 Reviewed-on: https://go-review.googlesource.com/c/go/+/609837 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
763781c6ec
commit
1ae6b9e31b
|
|
@ -34,11 +34,7 @@ func TestDeathSignalSetuid(t *testing.T) {
|
|||
//
|
||||
// TODO(bcmills): Why do we believe that another users will be able to
|
||||
// execute a binary in this directory? (It could be mounted noexec.)
|
||||
tempDir, err := os.MkdirTemp("", "TestDeathSignal")
|
||||
if err != nil {
|
||||
t.Fatalf("cannot create temporary directory: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tempDir)
|
||||
tempDir := t.TempDir()
|
||||
os.Chmod(tempDir, 0755)
|
||||
|
||||
tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0]))
|
||||
|
|
|
|||
|
|
@ -213,12 +213,8 @@ func TestSyscallNoError(t *testing.T) {
|
|||
}
|
||||
|
||||
// Copy the test binary to a location that a non-root user can read/execute
|
||||
// after we drop privileges
|
||||
tempDir, err := os.MkdirTemp("", "TestSyscallNoError")
|
||||
if err != nil {
|
||||
t.Fatalf("cannot create temporary directory: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tempDir)
|
||||
// after we drop privileges.
|
||||
tempDir := t.TempDir()
|
||||
os.Chmod(tempDir, 0755)
|
||||
|
||||
tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0]))
|
||||
|
|
|
|||
Loading…
Reference in New Issue