summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShengjing Zhu <zsj950618@gmail.com>2023-01-05 15:00:25 +0800
committerGopher Robot <gobot@golang.org>2023-01-06 18:22:52 +0000
commitf721fa3be9bb52524f97b409606f9423437535e8 (patch)
treea8dc59b389f0343703dabb020212f0effd6808c8
parent76ec91923752f69d2fb20d8b5a2e7963a116ebd6 (diff)
downloadgo-git-f721fa3be9bb52524f97b409606f9423437535e8.tar.gz
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>
-rw-r--r--src/syscall/exec_linux_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index 1e21fffaef..a6900f9033 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -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)