]> Cypherpunks repositories - gostls13.git/commitdiff
internal/testpty: move from os/signal/internal/pty
authorAustin Clements <austin@google.com>
Thu, 10 Nov 2022 21:02:48 +0000 (16:02 -0500)
committerAustin Clements <austin@google.com>
Wed, 16 Nov 2022 19:00:19 +0000 (19:00 +0000)
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>

src/go/build/deps_test.go
src/internal/testpty/pty.go [moved from src/os/signal/internal/pty/pty.go with 86% similarity]
src/internal/testpty/pty_cgo.go [moved from src/os/signal/internal/pty/pty_cgo.go with 98% similarity]
src/internal/testpty/pty_darwin.go [moved from src/os/signal/internal/pty/pty_darwin.go with 97% similarity]
src/os/signal/signal_cgo_test.go

index 39609521c347c358c901a120aa63d366315842c8..d275822ce5399c20f459ae3c8762d546a8b79ac3 100644 (file)
@@ -558,7 +558,7 @@ var depsRules = `
        < internal/obscuretestdata;
 
        CGO, OS, fmt
-       < os/signal/internal/pty;
+       < internal/testpty;
 
        NET, testing, math/rand
        < golang.org/x/net/nettest;
similarity index 86%
rename from src/os/signal/internal/pty/pty.go
rename to src/internal/testpty/pty.go
index 4bb03910362f00c10dd1e8c4653cf36bbd750bef..88a47cf85ff5c9e69e739afa663dbecf13dc77e0 100644 (file)
@@ -4,10 +4,9 @@
 
 //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"
similarity index 98%
rename from src/os/signal/internal/pty/pty_cgo.go
rename to src/internal/testpty/pty_cgo.go
index 47ca71bc651d46b0eb03340899ff878b23dcfd30..1db6a925afdc4b0944d60480b9caa8914d34c194 100644 (file)
@@ -4,7 +4,7 @@
 
 //go:build cgo && (aix || dragonfly || freebsd || (linux && !android) || netbsd || openbsd)
 
-package pty
+package testpty
 
 /*
 #define _XOPEN_SOURCE 600
similarity index 97%
rename from src/os/signal/internal/pty/pty_darwin.go
rename to src/internal/testpty/pty_darwin.go
index 6fc49f3c9a850bf143a046af997df37aca288366..f29517c0e25efae48c05f0a79672b6298dc935cc 100644 (file)
@@ -2,7 +2,7 @@
 // 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"
index 5cfb00632d2073b9f6883b88693545650b3dca5b..ac5921591e5929e363a5c8c4c6aed4596d15f6fc 100644 (file)
@@ -14,10 +14,10 @@ import (
        "context"
        "encoding/binary"
        "fmt"
+       "internal/testpty"
        "os"
        "os/exec"
        "os/signal"
-       ptypkg "os/signal/internal/pty"
        "runtime"
        "strconv"
        "syscall"
@@ -105,9 +105,9 @@ func TestTerminalSignal(t *testing.T) {
 
        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")
                }