diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 80 |
1 files changed, 78 insertions, 2 deletions
@@ -156,12 +156,24 @@ syscall-tests: ## Run all system call tests. @$(call submake,test TARGETS="test/syscalls/...") %-runtime-tests: load-runtimes_% +ifeq ($(PARTITION),) + @$(eval PARTITION := 1) +endif +ifeq ($(TOTAL_PARTITIONS),) + @$(eval TOTAL_PARTITIONS := 1) +endif @$(call submake,install-test-runtime) - @$(call submake,test-runtime OPTIONS="--test_timeout=10800" TARGETS="//test/runtimes:$*") + @$(call submake,test-runtime OPTIONS="--test_timeout=10800 --test_arg=--partition=$(PARTITION) --test_arg=--total_partitions=$(TOTAL_PARTITIONS)" TARGETS="//test/runtimes:$*") %-runtime-tests_vfs2: load-runtimes_% +ifeq ($(PARTITION),) + @$(eval PARTITION := 1) +endif +ifeq ($(TOTAL_PARTITIONS),) + @$(eval TOTAL_PARTITIONS := 1) +endif @$(call submake,install-test-runtime RUNTIME="vfs2" ARGS="--vfs2") - @$(call submake,test-runtime RUNTIME="vfs2" OPTIONS="--test_timeout=10800" TARGETS="//test/runtimes:$*") + @$(call submake,test-runtime RUNTIME="vfs2" OPTIONS="--test_timeout=10800 --test_arg=--partition=$(PARTITION) --test_arg=--total_partitions=$(TOTAL_PARTITIONS)" TARGETS="//test/runtimes:$*") do-tests: runsc @$(call submake,run TARGETS="//runsc" ARGS="--rootless do true") @@ -210,6 +222,15 @@ iptables-tests: load-iptables @$(call submake,test-runtime RUNTIME="iptables" TARGETS="//test/iptables:iptables_test") .PHONY: iptables-tests +# Run the iptables tests with runsc only. Useful for developing to skip runc +# testing. +iptables-runsc-tests: load-iptables + @sudo modprobe iptable_filter + @sudo modprobe ip6table_filter + @$(call submake,install-test-runtime RUNTIME="iptables" ARGS="--net-raw") + @$(call submake,test-runtime RUNTIME="iptables" TARGETS="//test/iptables:iptables_test") +.PHONY: iptables-runsc-tests + packetdrill-tests: load-packetdrill @$(call submake,install-test-runtime RUNTIME="packetdrill") @$(call submake,test-runtime RUNTIME="packetdrill" TARGETS="$(shell $(MAKE) query TARGETS='attr(tags, packetdrill, tests(//...))')") @@ -240,6 +261,61 @@ containerd-tests: containerd-test-1.3.4 containerd-tests: containerd-test-1.4.0-beta.0 ## +## Benchmarks. +## +## Targets to run benchmarks. See //test/benchmarks for details. +## +## common arguments: +## RUNTIME_ARGS - arguments to runsc placed in /etc/docker/daemon.json +## e.g. "--platform=ptrace" +## 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. +## BENCHMARKS_PLATFORMS - platforms to run benchmarks (e.g. ptrace kvm). +## +RUNTIME_ARGS := --net-raw --platform=ptrace +BENCHMARKS_PROJECT := gvisor-benchmarks +BENCHMARKS_DATASET := kokoro +BENCHMARKS_TABLE := benchmarks +BENCHMARKS_SUITE := start +BENCHMARKS_UPLOAD := false +BENCHMARKS_OFFICIAL := false +BENCHMARKS_PLATFORMS := ptrace + +init-benchmark-table: ## Initializes a BigQuery table with the benchmark schema +## (see //tools/bigquery/bigquery.go). If the table alread exists, this is a noop. + $(call submake, run TARGETS=//tools/parsers:parser ARGS="init --project=$(BENCHMARKS_PROJECT) \ + --dataset=$(BENCHMARKS_DATASET) --table=$(BENCHMARKS_TABLE)") +.PHONY: init-benchmark-table + +benchmark-platforms: load-benchmarks-images ## Runs benchmarks for runc and all given platforms in BENCHMARK_PLATFORMS. + $(call submake, run-benchmark RUNTIME="runc") + $(foreach PLATFORM,$(BENCHMARKS_PLATFORMS),\ + $(call submake,benchmark-platform RUNTIME="$(PLATFORM)" RUNTIME_ARGS="--platform=$(PLATFORM) --net-raw --vfs2") && \ + $(call submake,benchmark-platform RUNTIME="$(PLATFORM)_vfs1" RUNTIME_ARGS="--platform=$(PLATFORM) --net-raw")) +.PHONY: benchmark-platforms + +benchmark-platform: ## Installs a runtime with the given platform args. + @$(call submake,install-test-runtime ARGS="$(RUNTIME_ARGS)") + @$(call submake, run-benchmark) +.PHONY: benchmark-platform + +run-benchmark: ## Runs single benchmark and optionally sends data to BigQuery. + $(eval T := $(shell mktemp /tmp/logs.$(RUNTIME).XXXXXX)) + $(call submake,sudo TARGETS="$(TARGETS)" ARGS="--runtime=$(RUNTIME) $(ARGS)" | tee $(T)) + @if [[ "$(BENCHMARKS_UPLOAD)" == "true" ]]; then \ + @$(call submake,run TARGETS=tools/parsers:parser ARGS="parse --file=$(T) \ + --runtime=$(RUNTIME) --suite_name=$(BENCHMARKS_SUITE) \ + --project=$(BENCHMARKS_PROJECT) --dataset=$(BENCHMARKS_DATASET) \ + --table=$(BENCHMARKS_TABLE) --official=$(BENCHMARKS_OFFICIAL)"); \ + fi; + rm -rf $T +.PHONY: run-benchmark + +## ## Website & documentation helpers. ## ## The website is built from repository documentation and wrappers, using |