From 5b6d6e6044a0508e72fabfd03bd42c10e4003f53 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 23 Feb 2024 11:44:38 -0800 Subject: [PATCH] Allow bazel to cache runtime test results PiperOrigin-RevId: 609792921 --- Makefile | 4 +++- test/runtimes/defs.bzl | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3bb186e5f..8921e1701 100644 --- a/Makefile +++ b/Makefile @@ -165,6 +165,7 @@ install_runtime = $(call configure,$(1),$(2) --TESTONLY-test-name-env=RUNSC_TEST # Don't use cached results, otherwise multiple runs using different runtimes # may be skipped, if all other inputs are the same. test_runtime = $(call test,--test_env=RUNTIME=$(1) --nocache_test_results $(PARTITIONS) $(2)) +test_runtime_cached = $(call test,--test_env=RUNTIME=$(1) $(PARTITIONS) $(2)) refresh: $(RUNTIME_BIN) ## Updates the runtime binary. .PHONY: refresh @@ -254,7 +255,8 @@ RUNTIME_TESTS_FLAKY_SHORT_CIRCUIT ?= true %-runtime-tests: load-runtimes_% $(RUNTIME_BIN) @$(call install_runtime,$(RUNTIME),--watchdog-action=panic --platform=systrap) - @$(call test_runtime,$(RUNTIME),--test_timeout=1800 --test_env=RUNTIME_TESTS_FILTER=$(RUNTIME_TESTS_FILTER) --test_env=RUNTIME_TESTS_PER_TEST_TIMEOUT=$(RUNTIME_TESTS_PER_TEST_TIMEOUT) --test_env=RUNTIME_TESTS_RUNS_PER_TEST=$(RUNTIME_TESTS_RUNS_PER_TEST) --test_env=RUNTIME_TESTS_FLAKY_IS_ERROR=$(RUNTIME_TESTS_FLAKY_IS_ERROR) --test_env=RUNTIME_TESTS_FLAKY_SHORT_CIRCUIT=$(RUNTIME_TESTS_FLAKY_SHORT_CIRCUIT) //test/runtimes:$*) + @IMAGE_TAG=$(call tag,$*) && \ + $(call test_runtime_cached,$(RUNTIME),--test_timeout=1800 --test_env=RUNTIME_TESTS_FILTER=$(RUNTIME_TESTS_FILTER) --test_env=RUNTIME_TESTS_PER_TEST_TIMEOUT=$(RUNTIME_TESTS_PER_TEST_TIMEOUT) --test_env=RUNTIME_TESTS_RUNS_PER_TEST=$(RUNTIME_TESTS_RUNS_PER_TEST) --test_env=RUNTIME_TESTS_FLAKY_IS_ERROR=$(RUNTIME_TESTS_FLAKY_IS_ERROR) --test_env=RUNTIME_TESTS_FLAKY_SHORT_CIRCUIT=$(RUNTIME_TESTS_FLAKY_SHORT_CIRCUIT) --test_env=IMAGE_TAG=$${IMAGE_TAG} //test/runtimes:$*) do-tests: $(RUNTIME_BIN) @$(RUNTIME_BIN) --rootless do true diff --git a/test/runtimes/defs.bzl b/test/runtimes/defs.bzl index 2550b61a3..68143474a 100644 --- a/test/runtimes/defs.bzl +++ b/test/runtimes/defs.bzl @@ -63,6 +63,12 @@ _runtime_test = rule( executable = True, cfg = "target", ), + # runsc is needed to invalidate the bazel cache in case of any code changes. + "_runsc": attr.label( + default = "//runsc:runsc", + executable = True, + cfg = "target", + ), }, test = True, ) @@ -72,8 +78,9 @@ def runtime_test(name, **kwargs): name = name, image = name, # Resolved as images/runtimes/%s. tags = [ - "local", + "no-sandbox", "manual", + "notap", ], **kwargs )