Skip to content

Commit

Permalink
Fix build configurations.
Browse files Browse the repository at this point in the history
This standardizes some build configurations and simplifies the structure
of packages intended to avoid fighting with automated formatting tools.

Updates #6938

PiperOrigin-RevId: 426495825
  • Loading branch information
amscanne authored and gvisor-bot committed Feb 4, 2022
1 parent e219f75 commit 1ebb4fd
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 176 deletions.
19 changes: 7 additions & 12 deletions runsc/boot/platforms/BUILD
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
load("//tools:defs.bzl", "go_library", "select_system")
# The go_library rule is imported as a different name in this case,
# in order to avoid automated tooling doing the wrong thing with the
# operating-specific dependencies listed below.
load("//tools:defs.bzl", "platforms", "select_system", exempt_go_library = "go_library")

package(licenses = ["notice"])

# Don't rewrite the deps attribute of :platforms.
# @unused
glaze_ignore = [
"platforms.go",
"platforms_darwin.go",
]

go_library(
exempt_go_library(
name = "platforms",
srcs = [
"platforms.go",
Expand All @@ -24,9 +20,8 @@ go_library(
deps = select_system(
darwin = [],
linux = [
"//pkg/sentry/platform/kvm",
"//pkg/sentry/platform/ptrace",
"//runsc/boot/platforms/nonstandard",
"//pkg/sentry/platform/%s" % platform
for platform in platforms
],
),
)
11 changes: 0 additions & 11 deletions runsc/boot/platforms/nonstandard/BUILD

This file was deleted.

16 changes: 0 additions & 16 deletions runsc/boot/platforms/nonstandard/nonstandard.go

This file was deleted.

9 changes: 0 additions & 9 deletions runsc/boot/platforms/platforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,4 @@ import (
// Import platforms that runsc might use.
_ "gvisor.dev/gvisor/pkg/sentry/platform/kvm"
_ "gvisor.dev/gvisor/pkg/sentry/platform/ptrace"
_ "gvisor.dev/gvisor/runsc/boot/platforms/nonstandard"
)

const (
// Ptrace runs the sandbox with the ptrace platform.
Ptrace = "ptrace"

// KVM runs the sandbox with the KVM platform.
KVM = "kvm"
)
15 changes: 11 additions & 4 deletions runsc/container/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//tools:defs.bzl", "go_library", "go_test", "more_shards")
load("//tools:defs.bzl", "default_platform", "go_library", "go_test", "more_shards", "platforms")

package(licenses = ["notice"])

Expand Down Expand Up @@ -39,12 +39,18 @@ go_test(
size = "large",
srcs = [
"console_test.go",
"container_norace_test.go",
"container_race_test.go",
"container_test.go",
"multi_container_test.go",
"shared_volume_test.go",
],
# Only run the default platform for the tsan test, which should
# be compatible. For non-tsan builds, run all platforms.
args = select({
"//conditions:default": ["-test_platforms=%s" % ",".join(
[p for (p, tags) in platforms.items() if "manual" not in tags],
)],
"//tools:gotsan": ["-test_platforms=%s" % default_platform],
}),
data = [
"//runsc",
"//test/cmd/test_app",
Expand All @@ -60,13 +66,14 @@ go_test(
"//pkg/sentry/control",
"//pkg/sentry/kernel",
"//pkg/sentry/kernel/auth",
"//pkg/sentry/platform",
"//pkg/sync",
"//pkg/test/testutil",
"//pkg/unet",
"//pkg/urpc",
"//runsc/boot",
"//runsc/boot/platforms",
"//runsc/config",
"//runsc/flag",
"//runsc/specutils",
"@com_github_cenkalti_backoff//:go_default_library",
"@com_github_kr_pty//:go_default_library",
Expand Down
6 changes: 3 additions & 3 deletions runsc/container/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func receiveConsolePTY(srv *unet.ServerSocket) (*os.File, error) {

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

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

// Test that terminal works with root and sub-containers.
func TestMultiContainerTerminal(t *testing.T) {
for name, conf := range configs(t, all...) {
for name, conf := range configs(t, false /* noOverlay */) {
t.Run(name, func(t *testing.T) {
rootDir, cleanup, err := testutil.SetupRootDir()
if err != nil {
Expand Down
21 changes: 0 additions & 21 deletions runsc/container/container_norace_test.go

This file was deleted.

21 changes: 0 additions & 21 deletions runsc/container/container_race_test.go

This file was deleted.

Loading

0 comments on commit 1ebb4fd

Please sign in to comment.