2020-04-24 21:10:28 +00:00
|
|
|
#!/usr/bin/make -f
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
# Copyright 2019 The gVisor Authors.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2019-11-12 04:26:38 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
default: runsc
|
|
|
|
.PHONY: default
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
# Header for debugging (used by other macros).
|
|
|
|
header = echo --- $(1) >&2
|
|
|
|
|
|
|
|
# Make hacks.
|
|
|
|
EMPTY :=
|
|
|
|
SPACE := $(EMPTY) $(EMPTY)
|
2020-12-30 23:06:47 +00:00
|
|
|
SHELL = /bin/bash
|
2020-12-09 17:31:44 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
## usage: make <target>
|
|
|
|
## or
|
2020-06-02 18:30:26 +00:00
|
|
|
## make <build|test|copy|run|sudo> STARTUP_OPTIONS="..." OPTIONS="..." TARGETS="..." ARGS="..."
|
2020-04-24 21:10:28 +00:00
|
|
|
##
|
|
|
|
## Basic targets.
|
|
|
|
##
|
|
|
|
## This Makefile wraps basic build and test targets for ease-of-use. Bazel
|
|
|
|
## is run inside a canonical Docker container in order to simplify up-front
|
|
|
|
## requirements.
|
|
|
|
##
|
|
|
|
## There are common arguments that may be passed to targets. These are:
|
|
|
|
## OPTIONS - Build or test options.
|
|
|
|
## TARGETS - The bazel targets.
|
|
|
|
## ARGS - Arguments for run or sudo.
|
|
|
|
##
|
|
|
|
## Additionally, the copy target expects a DESTINATION to be provided.
|
|
|
|
##
|
|
|
|
## For example, to build runsc using this Makefile, you can run:
|
|
|
|
## make build OPTIONS="" TARGETS="//runsc"'
|
|
|
|
##
|
|
|
|
help: ## Shows all targets and help from the Makefile (this message).
|
2020-12-09 17:31:44 +00:00
|
|
|
@grep --no-filename -E '^([a-z.A-Z_%-]+:.*?|)##' $(MAKEFILE_LIST) | \
|
2020-04-24 21:10:28 +00:00
|
|
|
awk 'BEGIN {FS = "(:.*?|)## ?"}; { \
|
|
|
|
if (length($$1) > 0) { \
|
|
|
|
printf " \033[36m%-20s\033[0m %s\n", $$1, $$2; \
|
|
|
|
} else { \
|
|
|
|
printf "%s\n", $$2; \
|
|
|
|
} \
|
|
|
|
}'
|
2020-12-09 17:31:44 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
build: ## Builds the given $(TARGETS) with the given $(OPTIONS). E.g. make build TARGETS=runsc
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call build,$(OPTIONS) $(TARGETS))
|
|
|
|
.PHONY: build
|
|
|
|
|
|
|
|
test: ## Tests the given $(TARGETS) with the given $(OPTIONS). E.g. make test TARGETS=pkg/buffer:buffer_test
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call test,$(OPTIONS) $(TARGETS))
|
2020-12-09 17:31:44 +00:00
|
|
|
.PHONY: test
|
|
|
|
|
|
|
|
copy: ## Copies the given $(TARGETS) to the given $(DESTINATION). E.g. make copy TARGETS=runsc DESTINATION=/tmp
|
|
|
|
@$(call copy,$(TARGETS),$(DESTINATION))
|
|
|
|
.PHONY: copy
|
|
|
|
|
|
|
|
run: ## Runs the given $(TARGETS), built with $(OPTIONS), using $(ARGS). E.g. make run TARGETS=runsc ARGS=-version
|
2020-12-11 21:23:27 +00:00
|
|
|
@$(call run,$(TARGETS),$(ARGS))
|
2020-12-09 17:31:44 +00:00
|
|
|
.PHONY: run
|
|
|
|
|
|
|
|
sudo: ## Runs the given $(TARGETS) as per run, but using "sudo -E". E.g. make sudo TARGETS=test/root:root_test ARGS=-test.v
|
2020-12-11 21:23:27 +00:00
|
|
|
@$(call sudo,$(TARGETS),$(ARGS))
|
2020-12-09 17:31:44 +00:00
|
|
|
.PHONY: sudo
|
|
|
|
|
|
|
|
# Load image helpers.
|
|
|
|
include tools/images.mk
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
# Load all bazel wrappers.
|
|
|
|
#
|
|
|
|
# This file should define the basic "build", "test", "run" and "sudo" rules, in
|
2020-12-09 17:31:44 +00:00
|
|
|
# addition to the $(BRANCH_NAME) and $(BUILD_ROOTS) variables.
|
2020-04-24 21:10:28 +00:00
|
|
|
ifneq (,$(wildcard tools/google.mk))
|
|
|
|
include tools/google.mk
|
|
|
|
else
|
|
|
|
include tools/bazel.mk
|
|
|
|
endif
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
##
|
2020-12-09 17:31:44 +00:00
|
|
|
## Development helpers and tooling.
|
2020-04-24 21:10:28 +00:00
|
|
|
##
|
2020-12-09 17:31:44 +00:00
|
|
|
## These targets faciliate local development by automatically
|
|
|
|
## installing and configuring a runtime. Several variables may
|
|
|
|
## be used here to tweak the installation:
|
|
|
|
## RUNTIME - The name of the installed runtime (default: branch).
|
|
|
|
## RUNTIME_DIR - Where the runtime will be installed (default: temporary directory with the $RUNTIME).
|
|
|
|
## RUNTIME_BIN - The runtime binary (default: $RUNTIME_DIR/runsc).
|
|
|
|
## RUNTIME_LOG_DIR - The logs directory (default: $RUNTIME_DIR/logs).
|
|
|
|
## RUNTIME_LOGS - The log pattern (default: $RUNTIME_LOG_DIR/runsc.log.%TEST%.%TIMESTAMP%.%COMMAND%).
|
2020-04-24 21:10:28 +00:00
|
|
|
##
|
2020-12-09 17:31:44 +00:00
|
|
|
ifeq (,$(BRANCH_NAME))
|
|
|
|
RUNTIME := runsc
|
|
|
|
RUNTIME_DIR := $(shell dirname $(shell mktemp -u))/$(RUNTIME)
|
|
|
|
else
|
|
|
|
RUNTIME := $(BRANCH_NAME)
|
|
|
|
RUNTIME_DIR := $(shell dirname $(shell mktemp -u))/$(RUNTIME)
|
|
|
|
endif
|
|
|
|
RUNTIME_BIN := $(RUNTIME_DIR)/runsc
|
|
|
|
RUNTIME_LOG_DIR := $(RUNTIME_DIR)/logs
|
|
|
|
RUNTIME_LOGS := $(RUNTIME_LOG_DIR)/runsc.log.%TEST%.%TIMESTAMP%.%COMMAND%
|
|
|
|
|
|
|
|
$(RUNTIME_BIN): # See below.
|
|
|
|
@mkdir -p "$(RUNTIME_DIR)"
|
|
|
|
@$(call copy,//runsc,$(RUNTIME_BIN))
|
|
|
|
.PHONY: $(RUNTIME_BIN) # Real file, but force rebuild.
|
|
|
|
|
|
|
|
# Configure helpers for below.
|
|
|
|
configure_noreload = \
|
|
|
|
$(call header,CONFIGURE $(1) → $(RUNTIME_BIN) $(2)); \
|
|
|
|
sudo $(RUNTIME_BIN) install --experimental=true --runtime="$(1)" -- --debug-log "$(RUNTIME_LOGS)" $(2) && \
|
|
|
|
sudo rm -rf "$(RUNTIME_LOG_DIR)" && mkdir -p "$(RUNTIME_LOG_DIR)"
|
|
|
|
reload_docker = \
|
|
|
|
sudo systemctl reload docker && \
|
|
|
|
if test -f /etc/docker/daemon.json; then \
|
|
|
|
sudo chmod 0755 /etc/docker && \
|
|
|
|
sudo chmod 0644 /etc/docker/daemon.json; \
|
|
|
|
fi
|
|
|
|
configure = $(call configure_noreload,$(1),$(2)) && $(reload_docker)
|
|
|
|
|
|
|
|
# Helpers for above. Requires $(RUNTIME_BIN) dependency.
|
2020-12-30 23:06:47 +00:00
|
|
|
install_runtime = $(call configure,$(1),$(2) --TESTONLY-test-name-env=RUNSC_TEST_NAME)
|
2020-12-17 20:40:26 +00:00
|
|
|
# Don't use cached results, otherwise multiple runs using different runtimes
|
2020-12-30 23:06:47 +00:00
|
|
|
# may be skipped, if all other inputs are the same.
|
|
|
|
test_runtime = $(call test,--test_arg=--runtime=$(1) --nocache_test_results $(PARTITIONS) $(2))
|
2020-12-09 17:31:44 +00:00
|
|
|
|
2020-12-16 19:42:58 +00:00
|
|
|
refresh: $(RUNTIME_BIN) ## Updates the runtime binary.
|
|
|
|
.PHONY: refresh
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
dev: $(RUNTIME_BIN) ## Installs a set of local runtimes. Requires sudo.
|
|
|
|
@$(call configure_noreload,$(RUNTIME),--net-raw)
|
|
|
|
@$(call configure_noreload,$(RUNTIME)-d,--net-raw --debug --strace --log-packets)
|
|
|
|
@$(call configure_noreload,$(RUNTIME)-p,--net-raw --profile)
|
|
|
|
@$(call configure_noreload,$(RUNTIME)-vfs2-d,--net-raw --debug --strace --log-packets --vfs2)
|
|
|
|
@$(call reload_docker)
|
|
|
|
.PHONY: dev
|
|
|
|
|
|
|
|
nogo: ## Surfaces all nogo findings.
|
|
|
|
@$(call build,--build_tag_filters nogo //...)
|
|
|
|
@$(call run,//tools/github $(foreach dir,$(BUILD_ROOTS),-path=$(CURDIR)/$(dir)) -dry-run nogo)
|
|
|
|
.PHONY: nogo
|
|
|
|
|
|
|
|
go: ## Builds the Go branch.
|
|
|
|
@$(call clean)
|
|
|
|
@$(call build,//:gopath)
|
|
|
|
@tools/go_branch.sh
|
|
|
|
|
|
|
|
gazelle: ## Runs gazelle to update WORKSPACE.
|
|
|
|
@$(call run,//:gazelle update-repos -from_file=go.mod -prune)
|
|
|
|
.PHONY: gazelle
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
##
|
|
|
|
## Canonical build and test targets.
|
|
|
|
##
|
|
|
|
## These targets are used by continuous integration and provide
|
|
|
|
## convenient entrypoints for testing changes. If you're adding a
|
|
|
|
## new subsystem or workflow, consider adding a new target here.
|
|
|
|
##
|
2020-11-23 22:43:42 +00:00
|
|
|
## Some targets support a PARTITION (1-indexed) and TOTAL_PARTITIONS
|
|
|
|
## environment variables for high-level test sharding. Unlike most
|
|
|
|
## other variables, these are sourced from the environment.
|
|
|
|
##
|
|
|
|
PARTITION ?= 1
|
|
|
|
TOTAL_PARTITIONS ?= 1
|
2020-12-03 08:58:36 +00:00
|
|
|
PARTITIONS := --test_arg=--partition=$(PARTITION) --test_arg=--total_partitions=$(TOTAL_PARTITIONS)
|
2020-11-23 22:43:42 +00:00
|
|
|
|
2020-04-24 21:10:28 +00:00
|
|
|
runsc: ## Builds the runsc binary.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call build,-c opt //runsc)
|
2020-04-24 21:10:28 +00:00
|
|
|
.PHONY: runsc
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-07-21 01:03:04 +00:00
|
|
|
debian: ## Builds the debian packages.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call build,-c opt //debian:debian)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: debian
|
|
|
|
|
2020-07-31 23:18:23 +00:00
|
|
|
smoke-tests: ## Runs a simple smoke test after build runsc.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call run,//runsc,--alsologtostderr --network none --debug --TESTONLY-unsafe-nonroot=true --rootless do true)
|
2020-04-24 21:10:28 +00:00
|
|
|
.PHONY: smoke-tests
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-09-21 17:25:41 +00:00
|
|
|
fuse-tests:
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,--test_tag_filters=fuse $(PARTITIONS) test/fuse/...)
|
2020-09-21 17:25:41 +00:00
|
|
|
.PHONY: fuse-tests
|
|
|
|
|
2020-07-21 01:03:04 +00:00
|
|
|
unit-tests: ## Local package unit tests in pkg/..., runsc/, tools/.., etc.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,pkg/... runsc/... tools/...)
|
2020-09-21 17:25:41 +00:00
|
|
|
.PHONY: unit-tests
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-07-21 01:03:04 +00:00
|
|
|
tests: ## Runs all unit tests and syscall tests.
|
2020-10-19 23:26:42 +00:00
|
|
|
tests: unit-tests syscall-tests
|
2020-04-24 21:10:28 +00:00
|
|
|
.PHONY: tests
|
2019-05-03 21:11:55 +00:00
|
|
|
|
2020-07-21 01:03:04 +00:00
|
|
|
integration-tests: ## Run all standard integration tests.
|
|
|
|
integration-tests: docker-tests overlay-tests hostnet-tests swgso-tests
|
2020-12-04 00:53:22 +00:00
|
|
|
integration-tests: do-tests kvm-tests containerd-test-1.3.9
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: integration-tests
|
|
|
|
|
|
|
|
network-tests: ## Run all networking integration tests.
|
|
|
|
network-tests: iptables-tests packetdrill-tests packetimpact-tests
|
|
|
|
.PHONY: network-tests
|
|
|
|
|
|
|
|
syscall-%-tests:
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,--test_tag_filters=runsc_$* $(PARTITIONS) test/syscalls/...)
|
2020-07-21 01:03:04 +00:00
|
|
|
|
|
|
|
syscall-native-tests:
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,--test_tag_filters=native $(PARTITIONS) test/syscalls/...)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: syscall-native-tests
|
|
|
|
|
|
|
|
syscall-tests: ## Run all system call tests.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,$(PARTITIONS) test/syscalls/...)
|
2020-07-21 01:03:04 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
%-runtime-tests: load-runtimes_% $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),) # Ensure flags are cleared.
|
|
|
|
@$(call test_runtime,$(RUNTIME),--test_timeout=10800 //test/runtimes:$*)
|
2020-07-21 01:03:04 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
%-runtime-tests_vfs2: load-runtimes_% $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--vfs2)
|
|
|
|
@$(call test_runtime,$(RUNTIME),--test_timeout=10800 //test/runtimes:$*)
|
2020-09-10 18:40:46 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
do-tests:
|
|
|
|
@$(call run,//runsc,--rootless do true)
|
|
|
|
@$(call run,//runsc,--rootless -network=none do true)
|
|
|
|
@$(call sudo,//runsc,do true)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: do-tests
|
|
|
|
|
|
|
|
simple-tests: unit-tests # Compatibility target.
|
|
|
|
.PHONY: simple-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
# Standard integration targets.
|
|
|
|
INTEGRATION_TARGETS := //test/image:image_test //test/e2e:integration_test
|
|
|
|
|
|
|
|
docker-tests: load-basic $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),) # Clear flags.
|
|
|
|
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
|
|
|
|
@$(call install_runtime,$(RUNTIME),--vfs2)
|
|
|
|
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: docker-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
overlay-tests: load-basic $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--overlay)
|
|
|
|
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: overlay-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
swgso-tests: load-basic $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--software-gso=true --gso=false)
|
|
|
|
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: swgso-tests
|
2020-09-18 01:25:20 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
hostnet-tests: load-basic $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--network=host)
|
|
|
|
@$(call test_runtime,$(RUNTIME),--test_arg=-checkpoint=false --test_arg=-hostnet=true $(INTEGRATION_TARGETS))
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: hostnet-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
kvm-tests: load-basic $(RUNTIME_BIN)
|
2020-07-21 01:03:04 +00:00
|
|
|
@(lsmod | grep -E '^(kvm_intel|kvm_amd)') || sudo modprobe kvm
|
2020-12-09 17:31:44 +00:00
|
|
|
@if ! test -w /dev/kvm; then sudo chmod a+rw /dev/kvm; fi
|
|
|
|
@$(call test,//pkg/sentry/platform/kvm:kvm_test)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--platform=kvm)
|
|
|
|
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: kvm-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
iptables-tests: load-iptables $(RUNTIME_BIN)
|
2020-09-18 04:52:54 +00:00
|
|
|
@sudo modprobe iptable_filter
|
|
|
|
@sudo modprobe ip6table_filter
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call test,--test_arg=-runtime=runc $(PARTITIONS) //test/iptables:iptables_test)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),--net-raw)
|
|
|
|
@$(call test_runtime,$(RUNTIME),//test/iptables:iptables_test)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: iptables-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
packetdrill-tests: load-packetdrill $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),) # Clear flags.
|
|
|
|
@$(call test_runtime,$(RUNTIME),//test/packetdrill:all_tests)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: packetdrill-tests
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
packetimpact-tests: load-packetimpact $(RUNTIME_BIN)
|
2020-09-14 18:08:56 +00:00
|
|
|
@sudo modprobe iptable_filter
|
|
|
|
@sudo modprobe ip6table_filter
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),) # Clear flags.
|
|
|
|
@$(call test_runtime,$(RUNTIME),--jobs=HOST_CPUS*3 --local_test_jobs=HOST_CPUS*3 //test/packetimpact/tests:all_tests)
|
2020-07-21 01:03:04 +00:00
|
|
|
.PHONY: packetimpact-tests
|
|
|
|
|
2020-07-13 23:10:58 +00:00
|
|
|
# Specific containerd version tests.
|
2020-12-09 17:31:44 +00:00
|
|
|
containerd-test-%: load-basic_alpine load-basic_python load-basic_busybox load-basic_resolv load-basic_httpd load-basic_ubuntu $(RUNTIME_BIN)
|
2020-12-30 23:06:47 +00:00
|
|
|
@$(call install_runtime,$(RUNTIME),) # Clear flags.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(call sudo,tools/installers:containerd,$*)
|
|
|
|
@$(call sudo,tools/installers:shim)
|
|
|
|
@$(call sudo,test/root:root_test,--runtime=$(RUNTIME) -test.v)
|
2020-05-06 05:00:14 +00:00
|
|
|
|
|
|
|
# Note that we can't run containerd-test-1.1.8 tests here.
|
|
|
|
#
|
|
|
|
# Containerd 1.1.8 should work, but because of a bug in loading images locally
|
|
|
|
# (https://github.com/kubernetes-sigs/cri-tools/issues/421), we are unable to
|
|
|
|
# actually drive the tests. The v1 API is tested exclusively through 1.2.13.
|
|
|
|
containerd-tests: ## Runs all supported containerd version tests.
|
|
|
|
containerd-tests: containerd-test-1.2.13
|
2020-12-04 00:53:22 +00:00
|
|
|
containerd-tests: containerd-test-1.3.9
|
2020-12-04 23:03:21 +00:00
|
|
|
containerd-tests: containerd-test-1.4.3
|
2020-05-06 05:00:14 +00:00
|
|
|
|
2020-11-05 23:40:54 +00:00
|
|
|
##
|
|
|
|
## Benchmarks.
|
|
|
|
##
|
|
|
|
## Targets to run benchmarks. See //test/benchmarks for details.
|
|
|
|
##
|
|
|
|
## common arguments:
|
2020-12-30 23:06:47 +00:00
|
|
|
## BENCHMARKS_PROJECT - BigQuery project to which to send data.
|
|
|
|
## BENCHMARKS_DATASET - BigQuery dataset to which to send data.
|
|
|
|
## BENCHMARKS_TABLE - BigQuery table to which to send data.
|
|
|
|
## BENCHMARKS_SUITE - name of the benchmark suite. See //tools/bigquery/bigquery.go.
|
|
|
|
## BENCHMARKS_UPLOAD - if true, upload benchmark data from the run.
|
|
|
|
## BENCHMARKS_OFFICIAL - marks the data as official.
|
2020-11-05 23:40:54 +00:00
|
|
|
## BENCHMARKS_PLATFORMS - platforms to run benchmarks (e.g. ptrace kvm).
|
2020-12-30 23:06:47 +00:00
|
|
|
## BENCHMARKS_FILTER - filter to be applied to the test suite.
|
|
|
|
## BENCHMARKS_OPTIONS - options to be passed to the test.
|
2020-11-05 23:40:54 +00:00
|
|
|
##
|
2020-12-30 23:06:47 +00:00
|
|
|
BENCHMARKS_PROJECT ?= gvisor-benchmarks
|
|
|
|
BENCHMARKS_DATASET ?= kokoro
|
|
|
|
BENCHMARKS_TABLE ?= benchmarks
|
|
|
|
BENCHMARKS_SUITE ?= ffmpeg
|
|
|
|
BENCHMARKS_UPLOAD ?= false
|
|
|
|
BENCHMARKS_OFFICIAL ?= false
|
|
|
|
BENCHMARKS_PLATFORMS ?= ptrace
|
|
|
|
BENCHMARKS_TARGETS := //test/benchmarks/media:ffmpeg_test
|
|
|
|
BENCHMARKS_FILTER := .
|
|
|
|
BENCHMARKS_OPTIONS := -test.benchtime=10s
|
|
|
|
BENCHMARKS_ARGS := -test.v -test.bench=$(BENCHMARKS_FILTER) -pprof-dir=/tmp/profile -pprof-cpu -pprof-heap -pprof-block -pprof-mutex $(BENCHMARKS_OPTIONS)
|
2020-11-05 23:40:54 +00:00
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
init-benchmark-table: ## Initializes a BigQuery table with the benchmark schema.
|
|
|
|
@$(call run,//tools/parsers:parser,init --project=$(BENCHMARKS_PROJECT) --dataset=$(BENCHMARKS_DATASET) --table=$(BENCHMARKS_TABLE))
|
2020-11-05 23:40:54 +00:00
|
|
|
.PHONY: init-benchmark-table
|
|
|
|
|
2020-12-09 17:31:44 +00:00
|
|
|
# $(1) is the runtime name, $(2) are the arguments.
|
|
|
|
run_benchmark = \
|
2020-12-30 23:06:47 +00:00
|
|
|
($(call header,BENCHMARK $(1) $(2)); \
|
|
|
|
set -euo pipefail; \
|
|
|
|
if test "$(1)" != "runc"; then $(call install_runtime,$(1),--profile $(2)); fi; \
|
|
|
|
export T=$$(mktemp --tmpdir logs.$(1).XXXXXX); \
|
|
|
|
$(call sudo,$(BENCHMARKS_TARGETS),-runtime=$(1) $(BENCHMARKS_ARGS)) | tee $$T; \
|
|
|
|
if test "$(BENCHMARKS_UPLOAD)" = "true"; then \
|
|
|
|
$(call run,tools/parsers:parser,parse --debug --file=$$T --runtime=$(1) --suite_name=$(BENCHMARKS_SUITE) --project=$(BENCHMARKS_PROJECT) --dataset=$(BENCHMARKS_DATASET) --table=$(BENCHMARKS_TABLE) --official=$(BENCHMARKS_OFFICIAL)); \
|
2020-12-09 17:31:44 +00:00
|
|
|
fi; \
|
2020-12-30 23:06:47 +00:00
|
|
|
rm -rf $$T)
|
2020-12-09 17:31:44 +00:00
|
|
|
|
2020-12-30 23:06:47 +00:00
|
|
|
benchmark-platforms: load-benchmarks $(RUNTIME_BIN) ## Runs benchmarks for runc and all given platforms in BENCHMARK_PLATFORMS.
|
2020-12-09 17:31:44 +00:00
|
|
|
@$(foreach PLATFORM,$(BENCHMARKS_PLATFORMS), \
|
2020-12-30 23:06:47 +00:00
|
|
|
$(call run_benchmark,$(PLATFORM),--platform=$(PLATFORM) --vfs2) && \
|
|
|
|
) true
|
|
|
|
@$(call run-benchmark,runc)
|
2020-11-05 23:40:54 +00:00
|
|
|
.PHONY: benchmark-platforms
|
|
|
|
|
2020-12-30 23:06:47 +00:00
|
|
|
run-benchmark: load-benchmarks $(RUNTIME_BIN) ## Runs single benchmark and optionally sends data to BigQuery.
|
|
|
|
@$(call run_benchmark,$(RUNTIME),)
|
2020-11-05 23:40:54 +00:00
|
|
|
.PHONY: run-benchmark
|
|
|
|
|
2020-04-28 05:24:58 +00:00
|
|
|
##
|
|
|
|
## Website & documentation helpers.
|
|
|
|
##
|
|
|
|
## The website is built from repository documentation and wrappers, using
|
|
|
|
## using a locally-defined Docker image (see images/jekyll). The following
|
|
|
|
## variables may be set when using website-push:
|
|
|
|
## WEBSITE_IMAGE - The name of the container image.
|
|
|
|
## WEBSITE_SERVICE - The backend service.
|
|
|
|
## WEBSITE_PROJECT - The project id to use.
|
|
|
|
## WEBSITE_REGION - The region to deploy to.
|
|
|
|
##
|
|
|
|
WEBSITE_IMAGE := gcr.io/gvisordev/gvisordev
|
|
|
|
WEBSITE_SERVICE := gvisordev
|
|
|
|
WEBSITE_PROJECT := gvisordev
|
|
|
|
WEBSITE_REGION := us-central1
|
|
|
|
|
|
|
|
website-build: load-jekyll ## Build the site image locally.
|
2020-12-11 05:47:38 +00:00
|
|
|
@$(call run,//website:website,$(WEBSITE_IMAGE))
|
2020-04-28 05:24:58 +00:00
|
|
|
.PHONY: website-build
|
|
|
|
|
|
|
|
website-server: website-build ## Run a local server for development.
|
2020-10-23 04:21:16 +00:00
|
|
|
@docker run -i -p 8080:8080 $(WEBSITE_IMAGE)
|
2020-04-28 05:24:58 +00:00
|
|
|
.PHONY: website-server
|
|
|
|
|
|
|
|
website-push: website-build ## Push a new image and update the service.
|
2020-10-16 00:19:21 +00:00
|
|
|
@docker push $(WEBSITE_IMAGE)
|
2020-04-28 05:24:58 +00:00
|
|
|
.PHONY: website-push
|
|
|
|
|
|
|
|
website-deploy: website-push ## Deploy a new version of the website.
|
|
|
|
@gcloud run deploy $(WEBSITE_SERVICE) --platform=managed --region=$(WEBSITE_REGION) --project=$(WEBSITE_PROJECT) --image=$(WEBSITE_IMAGE)
|
2020-07-31 23:18:23 +00:00
|
|
|
.PHONY: website-deploy
|
2020-04-28 05:24:58 +00:00
|
|
|
|
2020-05-29 18:23:50 +00:00
|
|
|
##
|
|
|
|
## Repository builders.
|
|
|
|
##
|
|
|
|
## This builds a local apt repository. The following variables may be set:
|
|
|
|
## RELEASE_ROOT - The repository root (default: "repo" directory).
|
|
|
|
## RELEASE_KEY - The repository GPG private key file (default: dummy key is created).
|
|
|
|
## RELEASE_NIGHTLY - Set to true if a nightly release (default: false).
|
2020-06-01 17:27:59 +00:00
|
|
|
## RELEASE_COMMIT - The commit or Change-Id for the release (needed for tag).
|
|
|
|
## RELEASE_NAME - The name of the release in the proper format (needed for tag).
|
|
|
|
## RELEASE_NOTES - The file containing release notes (needed for tag).
|
2020-05-29 18:23:50 +00:00
|
|
|
##
|
2020-12-09 17:31:44 +00:00
|
|
|
RELEASE_ROOT := $(CURDIR)/repo
|
|
|
|
RELEASE_KEY := repo.key
|
|
|
|
RELEASE_NIGHTLY := false
|
|
|
|
RELEASE_COMMIT :=
|
|
|
|
RELEASE_NAME :=
|
|
|
|
RELEASE_NOTES :=
|
2020-06-03 18:30:49 +00:00
|
|
|
GPG_TEST_OPTIONS := $(shell if gpg --pinentry-mode loopback --version >/dev/null 2>&1; then echo --pinentry-mode loopback; fi)
|
2020-12-09 17:31:44 +00:00
|
|
|
|
2020-05-29 18:23:50 +00:00
|
|
|
$(RELEASE_KEY):
|
|
|
|
@echo "WARNING: Generating a key for testing ($@); don't use this."
|
2020-12-09 17:31:44 +00:00
|
|
|
@T=$$(mktemp --tmpdir keyring.XXXXXX); \
|
2020-11-10 19:59:15 +00:00
|
|
|
C=$$(mktemp --tmpdir config.XXXXXX); \
|
2020-06-03 18:30:49 +00:00
|
|
|
echo Key-Type: DSA >> $$C && \
|
|
|
|
echo Key-Length: 1024 >> $$C && \
|
|
|
|
echo Name-Real: Test >> $$C && \
|
|
|
|
echo Name-Email: test@example.com >> $$C && \
|
|
|
|
echo Expire-Date: 0 >> $$C && \
|
|
|
|
echo %commit >> $$C && \
|
2020-09-08 04:16:22 +00:00
|
|
|
gpg --batch $(GPG_TEST_OPTIONS) --passphrase '' --no-default-keyring --secret-keyring $$T --no-tty --gen-key $$C && \
|
|
|
|
gpg --batch $(GPG_TEST_OPTIONS) --export-secret-keys --no-default-keyring --secret-keyring $$T > $@; \
|
2020-06-03 18:30:49 +00:00
|
|
|
rc=$$?; rm -f $$T $$C; exit $$rc
|
2020-05-29 18:23:50 +00:00
|
|
|
|
|
|
|
release: $(RELEASE_KEY) ## Builds a release.
|
|
|
|
@mkdir -p $(RELEASE_ROOT)
|
2020-12-09 17:31:44 +00:00
|
|
|
@export T=$$(mktemp -d --tmpdir release.XXXXXX); \
|
|
|
|
$(call copy,//runsc:runsc,$$T) && \
|
|
|
|
$(call copy,//shim/v1:gvisor-containerd-shim,$$T) && \
|
|
|
|
$(call copy,//shim/v2:containerd-shim-runsc-v1,$$T) && \
|
|
|
|
$(call copy,//debian:debian,$$T) && \
|
2020-05-29 18:23:50 +00:00
|
|
|
NIGHTLY=$(RELEASE_NIGHTLY) tools/make_release.sh $(RELEASE_KEY) $(RELEASE_ROOT) $$T/*; \
|
|
|
|
rc=$$?; rm -rf $$T; exit $$rc
|
|
|
|
.PHONY: release
|
|
|
|
|
2020-06-01 17:27:59 +00:00
|
|
|
tag: ## Creates and pushes a release tag.
|
|
|
|
@tools/tag_release.sh "$(RELEASE_COMMIT)" "$(RELEASE_NAME)" "$(RELEASE_NOTES)"
|
|
|
|
.PHONY: tag
|