Tweaks to containerd tests and helpers.

PiperOrigin-RevId: 565839195
This commit is contained in:
Nicolas Lacasse
2023-09-15 20:02:41 -07:00
committed by gVisor bot
parent d81768d4c8
commit 3134858468
3 changed files with 18 additions and 4 deletions
+14 -2
View File
@@ -331,13 +331,25 @@ fsstress-test: load-basic $(RUNTIME_BIN)
@$(call test_runtime,$(RUNTIME),//test/fsstress:fsstress_test)
.PHONY: fsstress-test
# Helper to install containerd.
# $(1) is the containerd version.
install_containerd = \
($(call header,INSTALL CONTAINERD); \
export T=$$(mktemp -d --tmpdir containerd.XXXXXX); \
cp tools/install_containerd.sh $$T && \
cd /tmp && \
sudo -H "PATH=$$PATH" $$T/install_containerd.sh $(1); \
rm -rf $$T)
# Specific containerd version tests.
containerd-test-%: load-basic_alpine load-basic_python load-basic_busybox load-basic_symlink-resolv load-basic_httpd load-basic_ubuntu $(RUNTIME_BIN)
@$(call install_runtime,$(RUNTIME),) # Clear flags.
@sudo -H tools/install_containerd.sh $*
@$(call install_containerd,$*)
ifeq (,$(STAGED_BINARIES))
@$(call sudocopy,//shim:containerd-shim-runsc-v1,"$$(dirname $$(which containerd))")
@(export T=$$(mktemp -d --tmpdir containerd.XXXXXX); \
$(call copy,//shim:containerd-shim-runsc-v1,$$T) && \
sudo mv $$T/containerd-shim-runsc-v1 "$$(dirname $$(which containerd))"; \
rm -rf $$T)
else
gsutil cat "$(STAGED_BINARIES)" | \
sudo tar -C "$$(dirname $$(which containerd))" -zxvf - containerd-shim-runsc-v1
-1
View File
@@ -265,7 +265,6 @@ copy = $(call header,COPY $(1) $(2)) && $(call build_paths,$(1),cp -fa {} $(
run = $(call header,RUN $(1) $(2)) && $(call build_paths,$(1),{} $(2))
sudo = $(call header,SUDO $(1) $(2)) && $(call build_paths,$(1),sudo -E {} $(2))
test = $(call header,TEST $(1)) && $(call wrapper,$(BAZEL) test --strip=never $(BAZEL_OPTIONS) $(TEST_OPTIONS) $(1))
sudocopy = $(call header,COPY $(1) $(2)) && $(call build_paths,$(1),sudo cp -fa {} $(2))
clean: ## Cleans the bazel cache.
@$(call clean)
+4 -1
View File
@@ -65,9 +65,12 @@ install_helper() {
#
# Ubuntu 16.04 has only btrfs-tools, while 18.04 has a transitional package,
# and later versions no longer have the transitional package.
#
# If we can't detect the VERSION_ID, we assume it's a newer version and use
# libbtrfs-dev.
source /etc/os-release
declare BTRFS_DEV
if [[ "${VERSION_ID%.*}" -le "18" ]]; then
if [[ ! -z "${VERSION_ID}" && "${VERSION_ID%.*}" -le "18" ]]; then
BTRFS_DEV="btrfs-tools"
else
BTRFS_DEV="libbtrfs-dev"