Skip to content

Commit 48fd850

Browse files
committed
Merge pull request #12184 from avagin:bazel-runtime-test-cache
PiperOrigin-RevId: 813436229
2 parents 160bd42 + c65a289 commit 48fd850

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
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
@@ -12,6 +12,9 @@ go_test(
1212
"exec_test.go",
1313
"integration_test.go",
1414
],
15+
16+
# runsc is needed to invalidate the bazel cache in case of any code changes.
17+
data = ["//runsc"],
1518
library = ":integration",
1619
tags = [
1720
# Requires docker and runsc to be configured before the test runs.
@@ -36,6 +39,8 @@ go_test(
3639
srcs = [
3740
"integration_runtime_test.go",
3841
],
42+
# runsc is needed to invalidate the bazel cache in case of any code changes.
43+
data = ["//runsc"],
3944
library = ":integration",
4045
tags = [
4146
# Requires docker and runsc to be configured before the test runs.
@@ -58,6 +63,8 @@ go_test(
5863
srcs = [
5964
"runtime_in_docker_test.go",
6065
],
66+
# runsc is needed to invalidate the bazel cache in case of any code changes.
67+
data = ["//runsc"],
6168
library = ":integration",
6269
tags = [
6370
# Requires docker and runsc to be configured before the test runs.

test/e2e/integration_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,13 @@ func TestJobControl(t *testing.T) {
364364
if _, err := p.Write(time.Second, []byte{0x03}); err != nil {
365365
t.Fatalf("error exit: %v", err)
366366
}
367+
if logs, err := p.Logs(); err != nil {
368+
t.Logf("failed to read output: %s", err)
369+
} else {
370+
t.Logf("output: %s", logs)
371+
}
367372

368-
if err := d.WaitTimeout(ctx, 3*time.Second); err != nil {
373+
if err := d.WaitTimeout(ctx, 10*time.Second); err != nil {
369374
t.Fatalf("WaitTimeout failed: %v", err)
370375
}
371376

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)