Skip to content

Commit 1ebb4fd

Browse files
amscannegvisor-bot
authored andcommitted
Fix build configurations.
This standardizes some build configurations and simplifies the structure of packages intended to avoid fighting with automated formatting tools. Updates google#6938 PiperOrigin-RevId: 426495825
1 parent e219f75 commit 1ebb4fd

File tree

15 files changed

+113
-176
lines changed

15 files changed

+113
-176
lines changed

runsc/boot/platforms/BUILD

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
load("//tools:defs.bzl", "go_library", "select_system")
1+
# The go_library rule is imported as a different name in this case,
2+
# in order to avoid automated tooling doing the wrong thing with the
3+
# operating-specific dependencies listed below.
4+
load("//tools:defs.bzl", "platforms", "select_system", exempt_go_library = "go_library")
25

36
package(licenses = ["notice"])
47

5-
# Don't rewrite the deps attribute of :platforms.
6-
# @unused
7-
glaze_ignore = [
8-
"platforms.go",
9-
"platforms_darwin.go",
10-
]
11-
12-
go_library(
8+
exempt_go_library(
139
name = "platforms",
1410
srcs = [
1511
"platforms.go",
@@ -24,9 +20,8 @@ go_library(
2420
deps = select_system(
2521
darwin = [],
2622
linux = [
27-
"//pkg/sentry/platform/kvm",
28-
"//pkg/sentry/platform/ptrace",
29-
"//runsc/boot/platforms/nonstandard",
23+
"//pkg/sentry/platform/%s" % platform
24+
for platform in platforms
3025
],
3126
),
3227
)

runsc/boot/platforms/nonstandard/BUILD

-11
This file was deleted.

runsc/boot/platforms/nonstandard/nonstandard.go

-16
This file was deleted.

runsc/boot/platforms/platforms.go

-9
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,4 @@ import (
2222
// Import platforms that runsc might use.
2323
_ "gvisor.dev/gvisor/pkg/sentry/platform/kvm"
2424
_ "gvisor.dev/gvisor/pkg/sentry/platform/ptrace"
25-
_ "gvisor.dev/gvisor/runsc/boot/platforms/nonstandard"
26-
)
27-
28-
const (
29-
// Ptrace runs the sandbox with the ptrace platform.
30-
Ptrace = "ptrace"
31-
32-
// KVM runs the sandbox with the KVM platform.
33-
KVM = "kvm"
3425
)

runsc/container/BUILD

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//tools:defs.bzl", "go_library", "go_test", "more_shards")
1+
load("//tools:defs.bzl", "default_platform", "go_library", "go_test", "more_shards", "platforms")
22

33
package(licenses = ["notice"])
44

@@ -39,12 +39,18 @@ go_test(
3939
size = "large",
4040
srcs = [
4141
"console_test.go",
42-
"container_norace_test.go",
43-
"container_race_test.go",
4442
"container_test.go",
4543
"multi_container_test.go",
4644
"shared_volume_test.go",
4745
],
46+
# Only run the default platform for the tsan test, which should
47+
# be compatible. For non-tsan builds, run all platforms.
48+
args = select({
49+
"//conditions:default": ["-test_platforms=%s" % ",".join(
50+
[p for (p, tags) in platforms.items() if "manual" not in tags],
51+
)],
52+
"//tools:gotsan": ["-test_platforms=%s" % default_platform],
53+
}),
4854
data = [
4955
"//runsc",
5056
"//test/cmd/test_app",
@@ -60,13 +66,14 @@ go_test(
6066
"//pkg/sentry/control",
6167
"//pkg/sentry/kernel",
6268
"//pkg/sentry/kernel/auth",
69+
"//pkg/sentry/platform",
6370
"//pkg/sync",
6471
"//pkg/test/testutil",
6572
"//pkg/unet",
6673
"//pkg/urpc",
6774
"//runsc/boot",
68-
"//runsc/boot/platforms",
6975
"//runsc/config",
76+
"//runsc/flag",
7077
"//runsc/specutils",
7178
"@com_github_cenkalti_backoff//:go_default_library",
7279
"@com_github_kr_pty//:go_default_library",

runsc/container/console_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func receiveConsolePTY(srv *unet.ServerSocket) (*os.File, error) {
121121

122122
// Test that an pty FD is sent over the console socket if one is provided.
123123
func TestConsoleSocket(t *testing.T) {
124-
for name, conf := range configs(t, all...) {
124+
for name, conf := range configs(t, false /* noOverlay */) {
125125
t.Run(name, func(t *testing.T) {
126126
spec := testutil.NewSpecWithArgs("true")
127127
spec.Process.Terminal = true
@@ -163,7 +163,7 @@ func TestConsoleSocket(t *testing.T) {
163163

164164
// Test that an pty FD is sent over the console socket if one is provided.
165165
func TestMultiContainerConsoleSocket(t *testing.T) {
166-
for name, conf := range configs(t, all...) {
166+
for name, conf := range configs(t, false /* noOverlay */) {
167167
t.Run(name, func(t *testing.T) {
168168
rootDir, cleanup, err := testutil.SetupRootDir()
169169
if err != nil {
@@ -500,7 +500,7 @@ func TestJobControlSignalRootContainer(t *testing.T) {
500500

501501
// Test that terminal works with root and sub-containers.
502502
func TestMultiContainerTerminal(t *testing.T) {
503-
for name, conf := range configs(t, all...) {
503+
for name, conf := range configs(t, false /* noOverlay */) {
504504
t.Run(name, func(t *testing.T) {
505505
rootDir, cleanup, err := testutil.SetupRootDir()
506506
if err != nil {

runsc/container/container_norace_test.go

-21
This file was deleted.

runsc/container/container_race_test.go

-21
This file was deleted.

0 commit comments

Comments
 (0)