1
0
mirror of https://github.com/golang/go synced 2024-09-29 12:24:31 -06:00

syscall: skip TestUseCgroupFD if cgroupfs mounted RO

The skipping logic should also trigger if /sys/fs/cgroup is
mounted read-only too. This is how it is mounted on the
ppc64le/p10 containers today.

Fixes #57262

Change-Id: Idc0ab050052ebf5777ac09f9519215b437b0ee7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/456835
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
This commit is contained in:
Paul E. Murphy 2022-12-12 09:31:59 -06:00 committed by Gopher Robot
parent 27301e8247
commit b16e94d13d

View File

@ -8,6 +8,7 @@ package syscall_test
import (
"bytes"
"errors"
"flag"
"fmt"
"internal/testenv"
@ -504,7 +505,8 @@ 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 {
if os.IsPermission(err) {
// Running in an unprivileged container, this may also return EROFS #57262.
if os.IsPermission(err) || errors.Is(err, syscall.EROFS) {
t.Skip(err)
}
t.Fatal(err)