summaryrefslogtreecommitdiff
path: root/src/syscall/exec_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: use new "unix" build tag where appropriateIan Lance Taylor2022-03-291-1/+1
| | | | | | | | | | For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* syscall: remove GOMAXPROCS change in TestExecHelperMichael Anthony Knyszek2021-11-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TestExec and TestExecHelper check for a workaround of a particular OS bug on darwin that's triggered more often via asynchronous preemption. As part of this, the test sets up 100 CPU-bound goroutines, and sets GOMAXPROCS to 50, sleeping for a little bit before calling Exec. Thus far, this is fine because the scheduler runs the Execing goroutine in a timely manner. However, CL 309869 will reduce the minimum heap size, causing a GC to happen during the test. On a 16 CPU machine, with GOMAXPROCS at 50, and 100 CPU-bound goroutines, both the OS scheduler and the Go scheduler are severly oversaturated. As a result, the test often (not always, but often) runs out for the full lifetime of those 100 goroutines, which run for about 1 second. The minimum heap size reduction is not necessary to trigger this; an additional call to runtime.GC in the helper is also sufficient to trigger this delay. The delay on its own isn't great, since it adds a whole second to all.bash on its own. However, it also seems correlated with other subprocess tests in the syscall package, namely TestPassFD and TestFcntlFlock. These tests fail in a fairly superficial way: the file descriptor for the temporary directories they make gets clobbered, is closed, or becomes stale. Change-Id: I213dd5e38967d19a8b317e6d4c5024b57f9e3fed Reviewed-on: https://go-review.googlesource.com/c/go/+/360574 Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* syscall: move TestForegroundSignal create call out of goroutineIan Lance Taylor2021-04-271-5/+24
| | | | | | | | | | | | | | | | | That way the skip takes effect. Also ignore the result of calling TIOCSPGRP when cleaing up TestForeground. It has started to fail for some reason, and the result doesn't matter. Also call TIOCSPGRP to clean up in TestForegroundSignal. For #37217 Change-Id: I2e4282d7d91ad9a198eeb12cef01c2214c2a98c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/314271 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* syscall: restore signal mask after setting foreground process groupIan Lance Taylor2021-04-271-1/+40
| | | | | | | | | | | Fixes #37217 Change-Id: I0151bb77fc4c4552d1b19c31d784943b72f84b80 Reviewed-on: https://go-review.googlesource.com/c/go/+/313653 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: use correct type for TIOCSPGRP/TIOCGPGRPJoel Sing2020-11-131-1/+3
| | | | | | | | | | | | | | | | These ioctls take a pid_t (generally a C integer aka int32) and not an int64 - we currently get away with this on little endian 64 bit platforms, since the bytes fall into the correct place, however this breaks on big endian 64 bit platforms (like openbsd/mips64). Update #40995 Change-Id: I622a0543fd562d97f76a7376a84fd2641e6d6a24 Reviewed-on: https://go-review.googlesource.com/c/go/+/267605 Trust: Joel Sing <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: use MustHaveExec in TestExecIan Lance Taylor2020-10-171-0/+1
| | | | | | | | | | | For #41702 Change-Id: Ib2b15e52aa1fef2f5e644b316c726150252fa9f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/262738 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* runtime: stop preemption during syscall.Exec on DarwinIan Lance Taylor2020-10-151-0/+45
| | | | | | | | | | | | | | | | | | | | | | On current macOS versions a program that receives a signal during an execve can fail with a SIGILL signal. This appears to be a macOS kernel bug. It has been reported to Apple. This CL partially works around the problem by using execLock to not send preemption signals during execve. Of course some other stray signal could occur, but at least we can avoid exacerbating the problem. We can't simply disable signals, as that would mean that the exec'ed process would start with all signals blocked, which it likely does not expect. Fixes #41702 Change-Id: I91b0add967b315671ddcf73269c4d30136e579b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/262438 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* syscall: if Setctty, require that Ctty be a child descriptorIan Lance Taylor2020-05-011-0/+28
| | | | | | | | | | | | | | | | | | Ctty was always handled as a child descriptor, but in some cases passing a parent descriptor would also work. This depended on unpredictable details of the implementation. Reject those cases to avoid confusion. Also reject setting both Setctty and Foreground, as they use Ctty in incompatible ways. It's unlikely that any programs set both fields, as they don't make sense together. Fixes #29458 Change-Id: Ieba2d625711fd4b82c8e65e1feed02fd1fb25e6d Reviewed-on: https://go-review.googlesource.com/c/go/+/231638 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
* syscall: add AIX operating systemClément Chigot2018-10-101-1/+1
| | | | | | | | | | | | | | | This commit adds AIX operating system to syscall package for ppc64 architecture. It also adds the file syscall_aix.go in the runtime package for syscalls needed during fork and exec. Updates: #25893 Change-Id: I301b1051b178a3efb7bbc39cdbd8e00b594d65ef Reviewed-on: https://go-review.googlesource.com/c/138720 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: extract "can I exec?" check from tests into internal/testenvRuss Cox2015-06-161-4/+3
| | | | | | | | Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime, syscall: fix Solaris exec testsAram Hăvărneanu2015-03-241-12/+3
| | | | | | | | | Also fixes a long-existing problem in the fork/exec path. Change-Id: Idec40b1cee0cfb1625fe107db3eafdc0d71798f2 Reviewed-on: https://go-review.googlesource.com/8030 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Rob Pike <r@golang.org>
* syscall: disable test that forks on darwin/armDavid Crawshaw2015-03-231-2/+10
| | | | | | | | | | This test was introduced in cl/5130 and broke the darwin/arm builder. Also check some errors, which was making the failure hard to decipher. Change-Id: Ifb1d60b9971782cf8d2e979d83f8a81249d7ee9b Reviewed-on: https://go-review.googlesource.com/7932 Reviewed-by: Rob Pike <r@golang.org>
* syscall: Add Foreground and Pgid to SysProcAttrMichael MacInnis2015-03-231-0/+217
On Unix, when placing a child in a new process group, allow that group to become the foreground process group. Also, allow a child process to join a specific process group. When setting the foreground process group, Ctty is used as the file descriptor of the controlling terminal. Ctty has been added to the BSD and Solaris SysProcAttr structures and the handling of Setctty changed to match Linux. Change-Id: I18d169a6c5ab8a6a90708c4ff52eb4aded50bc8c Reviewed-on: https://go-review.googlesource.com/5130 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>