Skip to content

Commit

Permalink
syscall: skip TestUseCgroupFD if cgroupfs mounted RO
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
Auto-Submit: Bryan Mills <[email protected]>
Run-TryBot: Paul Murphy <[email protected]>
  • Loading branch information
pmur authored and gopherbot committed Dec 12, 2022
1 parent 27301e8 commit b16e94d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/syscall/exec_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package syscall_test

import (
"bytes"
"errors"
"flag"
"fmt"
"internal/testenv"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b16e94d

Please sign in to comment.