-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/gocore/test: increase rlimit to max in parent
In our CI system, RLIMIT_CORE's maximum value is not `unlimited`. So `setrlimit(RLIMIT_CORE, {...RLIM_INFINITY})` fails. Instead set it to the maximum and ensure that it's not 0. A core file, even if truncated, should get created. Additionally, move the rlimit increase to the parent instead of the child. This makes it easier to add more test binaries without duplicating code. To make this stick, wrap the spawn with `(Un)LockOSThread`. The new `run()` function returns a PID, which isn't necessary here, but is useful in case `/proc/sys/kernel/core_pattern` contains format modifiers like %p, as happens in our CI. Change-Id: Ied3533e0910dde2df888e50ca88c607ef33afacc Reviewed-on: https://go-review.googlesource.com/c/debug/+/619555 Auto-Submit: Nicolas Hillegeer <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
- Loading branch information
Showing
2 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"syscall" | ||
) | ||
|
||
func main() { | ||
inf := int64(syscall.RLIM_INFINITY) | ||
lim := syscall.Rlimit{ | ||
Cur: uint64(inf), | ||
Max: uint64(inf), | ||
} | ||
if err := syscall.Setrlimit(syscall.RLIMIT_CORE, &lim); err != nil { | ||
panic(fmt.Sprintf("error setting rlimit: %v", err)) | ||
} | ||
|
||
_ = *(*int)(nil) | ||
} |