mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: skip TestUseCgroupFD if cgroupfs not mounted
When building in schroot (for building Debian package), the cgroupfs is not mounted in schroot (only sysfs is mounted). Change-Id: Ieddac7b2f334d58d832f5d84d81af812badf3720 Reviewed-on: https://go-review.googlesource.com/c/go/+/460539 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
76ec919237
commit
f721fa3be9
1 changed files with 3 additions and 2 deletions
|
|
@ -505,8 +505,9 @@ func prepareCgroupFD(t *testing.T) (int, string) {
|
|||
// Need an ability to create a sub-cgroup.
|
||||
subCgroup, err := os.MkdirTemp(prefix+string(bytes.TrimSpace(cg)), "subcg-")
|
||||
if err != nil {
|
||||
// Running in an unprivileged container, this may also return EROFS #57262.
|
||||
if os.IsPermission(err) || errors.Is(err, syscall.EROFS) {
|
||||
// ErrPermission or EROFS (#57262) when running in an unprivileged container.
|
||||
// ErrNotExist when cgroupfs is not mounted in chroot/schroot.
|
||||
if os.IsNotExist(err) || os.IsPermission(err) || errors.Is(err, syscall.EROFS) {
|
||||
t.Skip(err)
|
||||
}
|
||||
t.Fatal(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue