Allow bazel to cache runtime test results

PiperOrigin-RevId: 609792921
This commit is contained in:
Andrei Vagin
2024-02-23 11:50:09 -08:00
committed by gVisor bot
parent 255614124d
commit 5b6d6e6044
2 changed files with 11 additions and 2 deletions
+3 -1
View File
@@ -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
+8 -1
View File
@@ -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
)