We're going to use this for another test, so make it more accessible.
Preparation for #37486.
Change-Id: If194cc4244c4b9e1b1f253759b813555b39ad67e
Reviewed-on: https://go-review.googlesource.com/c/go/+/449502
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
< internal/obscuretestdata;
CGO, OS, fmt
- < os/signal/internal/pty;
+ < internal/testpty;
NET, testing, math/rand
< golang.org/x/net/nettest;
//go:build ((aix || dragonfly || freebsd || (linux && !android) || netbsd || openbsd) && cgo) || darwin
-// Package pty is a simple pseudo-terminal package for Unix systems,
+// Package testpty is a simple pseudo-terminal package for Unix systems,
// implemented by calling C functions via cgo.
-// This is only used for testing the os/signal package.
-package pty
+package testpty
import (
"fmt"
//go:build cgo && (aix || dragonfly || freebsd || (linux && !android) || netbsd || openbsd)
-package pty
+package testpty
/*
#define _XOPEN_SOURCE 600
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package pty
+package testpty
import (
"internal/syscall/unix"
"context"
"encoding/binary"
"fmt"
+ "internal/testpty"
"os"
"os/exec"
"os/signal"
- ptypkg "os/signal/internal/pty"
"runtime"
"strconv"
"syscall"
t.Parallel()
- pty, procTTYName, err := ptypkg.Open()
+ pty, procTTYName, err := testpty.Open()
if err != nil {
- ptyErr := err.(*ptypkg.PtyError)
+ ptyErr := err.(*testpty.PtyError)
if ptyErr.FuncName == "posix_openpt" && ptyErr.Errno == syscall.EACCES {
t.Skip("posix_openpt failed with EACCES, assuming chroot and skipping")
}