mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
27301e8247
commit
b16e94d13d
1 changed files with 3 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ package syscall_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
|
|
@ -504,7 +505,8 @@ func prepareCgroupFD(t *testing.T) (int, string) {
|
||||||
// Need an ability to create a sub-cgroup.
|
// Need an ability to create a sub-cgroup.
|
||||||
subCgroup, err := os.MkdirTemp(prefix+string(bytes.TrimSpace(cg)), "subcg-")
|
subCgroup, err := os.MkdirTemp(prefix+string(bytes.TrimSpace(cg)), "subcg-")
|
||||||
if err != nil {
|
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.Skip(err)
|
||||||
}
|
}
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue