Skip to content

Commit f721fa3

Browse files
zhsjgopherbot
authored andcommitted
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>
1 parent 76ec919 commit f721fa3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/syscall/exec_linux_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,9 @@ func prepareCgroupFD(t *testing.T) (int, string) {
505505
// Need an ability to create a sub-cgroup.
506506
subCgroup, err := os.MkdirTemp(prefix+string(bytes.TrimSpace(cg)), "subcg-")
507507
if err != nil {
508-
// Running in an unprivileged container, this may also return EROFS #57262.
509-
if os.IsPermission(err) || errors.Is(err, syscall.EROFS) {
508+
// ErrPermission or EROFS (#57262) when running in an unprivileged container.
509+
// ErrNotExist when cgroupfs is not mounted in chroot/schroot.
510+
if os.IsNotExist(err) || os.IsPermission(err) || errors.Is(err, syscall.EROFS) {
510511
t.Skip(err)
511512
}
512513
t.Fatal(err)

0 commit comments

Comments
 (0)