Skip to content

Commit

Permalink
Modify cgroup tests to make the tests pass with the new behavior.
Browse files Browse the repository at this point in the history
The cgroups mounting is changed, in the root container cgroups are mounted
by default and for other containers the cgroups are mounted if the spec has a
cgroup mount. These tests mount cgroups directly which will fail. This CL
modifies the cgroup tests to pass with the new behavior.

PiperOrigin-RevId: 596739547
  • Loading branch information
nybidari authored and gvisor-bot committed Jan 9, 2024
1 parent 1e61310 commit 58cbc1a
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 558 deletions.
5 changes: 5 additions & 0 deletions test/runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ func runTestCaseRunsc(testBin string, tc *gtest.TestCase, args []string, t *test
defer cleanup()
}

// Add cgroup mount to enable cgroups for all tests.
spec.Mounts = append(spec.Mounts, specs.Mount{
Destination: "/sys/fs/cgroup",
Type: "cgroup",
})
if err := runRunsc(tc, spec); err != nil {
t.Errorf("test %q failed with error %v, want nil", tc.FullName(), err)
}
Expand Down
12 changes: 4 additions & 8 deletions test/syscalls/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ syscall_test(
test = "//test/syscalls/linux:brk_test",
)

# TODO(b/315355651): Fix cgroup tests in runsc. Cgroups are mounted in the
# root/pause container by default and for other containers cgroups are bind
# mounted if the container spec has a cgroup mount. These cgroup tests
# explicitly mount the cgroups which will fail now in runsc.
# syscall_test(
# one_sandbox = False,
# test = "//test/syscalls/linux:cgroup_test",
# )
syscall_test(
one_sandbox = False,
test = "//test/syscalls/linux:cgroup_test",
)

syscall_test(
add_fusefs = True,
Expand Down
1 change: 1 addition & 0 deletions test/syscalls/linux/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4576,6 +4576,7 @@ cc_binary(
"//test/util:mount_util",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time",
gtest,
"//test/util:cleanup",
"//test/util:posix_error",
Expand Down
Loading

0 comments on commit 58cbc1a

Please sign in to comment.