Skip to content

Commit c65a289

Browse files
committed
test: allow to cache results of image and integration tests
1 parent c4395b8 commit c65a289

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

Makefile

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ nogo-tests:
232232
#
233233
# FIXME(gvisor.dev/issue/10045): Need to fix broken tests.
234234
unit-tests: ## Local package unit tests in pkg/..., tools/.., etc.
235-
@$(call test,--test_tag_filters=-nogo$(COMMA)-requires-kvm --build_tag_filters=-network_plugins -- //:all pkg/... tools/... runsc/... vdso/... test/trace/... -//pkg/metric:metric_test -//pkg/coretag:coretag_test -//tools/tracereplay:tracereplay_test -//test/trace:trace_test)
235+
@$(call test,--test_tag_filters=-nogo$(COMMA)-requires-kvm --build_tag_filters=-network_plugins --test_env=CGROUPV2=$(CGROUPV2) -- //:all pkg/... tools/... runsc/... vdso/... test/trace/... -//pkg/metric:metric_test -//pkg/coretag:coretag_test -//tools/tracereplay:tracereplay_test -//test/trace:trace_test)
236236
.PHONY: unit-tests
237237

238238
# See unit-tests: this includes runsc/container.
239239
container-tests: ## Run all tests in runsc/container/...
240-
@$(call test,--test_tag_filters=-nogo runsc/container/...)
240+
@$(call test,--test_tag_filters=-nogo --test_env=CGROUPV2=$(CGROUPV2) runsc/container/...)
241241
.PHONY: container-tests
242242

243243
tests: ## Runs all unit tests and syscall tests.
@@ -366,45 +366,45 @@ docker-tests: load-basic $(RUNTIME_BIN)
366366
@$(call install_runtime,$(RUNTIME)-host-uds,--host-uds=all) # Used by TestHostSocketConnect.
367367
@$(call install_runtime,$(RUNTIME)-overlay,--overlay2=all:self) # Used by TestOverlay*.
368368
@$(call install_runtime,$(RUNTIME)-save-restore-netstack,--save-restore-netstack=true) # Used by TestRestoreListenConnWithNetstackSR.
369-
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS) --test_env=TEST_SAVE_RESTORE_NETSTACK=true //test/e2e:integration_runtime_test //test/e2e:runtime_in_docker_test)
369+
@$(call test_runtime_cached,$(RUNTIME),$(INTEGRATION_TARGETS) --test_env=TEST_SAVE_RESTORE_NETSTACK=true //test/e2e:integration_runtime_test //test/e2e:runtime_in_docker_test)
370370
.PHONY: docker-tests
371371

372372
plugin-network-tests: load-basic $(RUNTIME_BIN)
373-
@$(call install_runtime,$(RUNTIME),--network=plugin)
374-
@$(call test_runtime,$(RUNTIME), --test_arg=-test.run=ConnectToSelf $(INTEGRATION_TARGETS))
373+
@$(call install_runtime,$(RUNTIME)-dpdk,--network=plugin)
374+
@$(call test_runtime_cached,$(RUNTIME)-dpdk, --test_arg=-test.run=ConnectToSelf $(INTEGRATION_TARGETS))
375375

376376
plugin-network-tests: RUNSC_TARGET=--config plugin-tldk //runsc:runsc-plugin-stack
377377

378378
overlay-tests: load-basic $(RUNTIME_BIN)
379-
@$(call install_runtime,$(RUNTIME),--overlay2=all:dir=/tmp)
380-
@$(call install_runtime,$(RUNTIME)-docker,--net-raw --overlay2=all:dir=/tmp)
381-
@$(call test_runtime,$(RUNTIME),--test_env=TEST_OVERLAY=true $(INTEGRATION_TARGETS))
379+
@$(call install_runtime,$(RUNTIME)-overlay,--overlay2=all:dir=/tmp)
380+
@$(call install_runtime,$(RUNTIME)-overlay-docker,--net-raw --overlay2=all:dir=/tmp)
381+
@$(call test_runtime_cached,$(RUNTIME)-overlay,--test_env=TEST_OVERLAY=true $(INTEGRATION_TARGETS))
382382
.PHONY: overlay-tests
383383

384384
swgso-tests: load-basic $(RUNTIME_BIN)
385-
@$(call install_runtime,$(RUNTIME),--software-gso=true --gso=false)
386-
@$(call install_runtime,$(RUNTIME)-docker,--net-raw --software-gso=true --gso=false)
387-
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
385+
@$(call install_runtime,$(RUNTIME)-swgso,--software-gso=true --gso=false)
386+
@$(call install_runtime,$(RUNTIME)-swgso-docker,--net-raw --software-gso=true --gso=false)
387+
@$(call test_runtime_cached,$(RUNTIME)-swgso,$(INTEGRATION_TARGETS))
388388
.PHONY: swgso-tests
389389

390390
hostnet-tests: load-basic $(RUNTIME_BIN)
391-
@$(call install_runtime,$(RUNTIME),--network=host --net-raw)
392-
@$(call test_runtime,$(RUNTIME),--test_env=TEST_CHECKPOINT=false --test_env=TEST_HOSTNET=true --test_env=TEST_NET_RAW=true $(INTEGRATION_TARGETS))
391+
@$(call install_runtime,$(RUNTIME)-hostnet,--network=host --net-raw)
392+
@$(call test_runtime_cached,$(RUNTIME)-hostnet,--test_env=TEST_CHECKPOINT=false --test_env=TEST_HOSTNET=true --test_env=TEST_NET_RAW=true $(INTEGRATION_TARGETS))
393393
.PHONY: hostnet-tests
394394

395395
kvm-tests: load-basic $(RUNTIME_BIN)
396396
@(lsmod | grep -E '^(kvm_intel|kvm_amd)') || sudo modprobe kvm
397397
@if ! test -w /dev/kvm; then sudo chmod a+rw /dev/kvm; fi
398398
@$(call test,//pkg/sentry/platform/kvm:kvm_test)
399-
@$(call install_runtime,$(RUNTIME),--platform=kvm)
400-
@$(call install_runtime,$(RUNTIME)-docker,--net-raw --platform=kvm)
401-
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
399+
@$(call install_runtime,$(RUNTIME)-kvm,--platform=kvm)
400+
@$(call install_runtime,$(RUNTIME)-kvm-docker,--net-raw --platform=kvm)
401+
@$(call test_runtime_cached,$(RUNTIME)-kvm,$(INTEGRATION_TARGETS))
402402
.PHONY: kvm-tests
403403

404404
systrap-tests: load-basic $(RUNTIME_BIN)
405-
@$(call install_runtime,$(RUNTIME),--platform=systrap)
406-
@$(call install_runtime,$(RUNTIME)-docker,--net-raw --platform=systrap)
407-
@$(call test_runtime,$(RUNTIME),$(INTEGRATION_TARGETS))
405+
@$(call install_runtime,$(RUNTIME)-systrap,--platform=systrap)
406+
@$(call install_runtime,$(RUNTIME)-systrap-docker,--net-raw --platform=systrap)
407+
@$(call test_runtime_cached,$(RUNTIME)-systrap,$(INTEGRATION_TARGETS))
408408
.PHONY: systrap-tests
409409

410410
iptables-tests: load-iptables $(RUNTIME_BIN)

test/e2e/BUILD

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ go_test(
1919
"manual",
2020
],
2121
visibility = ["//:sandbox"],
22+
23+
# runsc is needed to invalidate the bazel cache in case of any code changes.
24+
data = ["//runsc"],
2225
deps = [
2326
"//pkg/abi/linux",
2427
"//pkg/sentry/kernel/auth",
@@ -31,6 +34,8 @@ go_test(
3134
)
3235

3336
go_test(
37+
# runsc is needed to invalidate the bazel cache in case of any code changes.
38+
data = ["//runsc"],
3439
name = "integration_runtime_test",
3540
size = "large",
3641
srcs = [
@@ -53,6 +58,8 @@ go_test(
5358
)
5459

5560
go_test(
61+
# runsc is needed to invalidate the bazel cache in case of any code changes.
62+
data = ["//runsc"],
5663
name = "runtime_in_docker_test",
5764
size = "large",
5865
srcs = [

test/image/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ go_test(
1616
"mysql.sql",
1717
"ruby.rb",
1818
"ruby.sh",
19+
# runsc is needed to invalidate the bazel cache in case of any code changes.
20+
"//runsc",
1921
],
2022
library = ":image",
2123
tags = [

0 commit comments

Comments
 (0)