Upgrade gvisor syscall test version to release-20251215.0

This commit is contained in:
Qingsong Chen 2025-12-31 03:16:57 +00:00 committed by Tate, Hongliang Tian
parent c1aa8a805c
commit 7764cd6839
3 changed files with 22 additions and 54 deletions

View File

@ -88,12 +88,7 @@ TESTS ?= \
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
BUILD_DIR ?= $(CUR_DIR)/../../../build
ifdef GVISOR_PREBUILT_DIR
BIN_DIR := $(GVISOR_PREBUILT_DIR)
else
BIN_DIR := $(BUILD_DIR)/syscall_test_bins
SRC_DIR := $(BUILD_DIR)/gvisor_src
endif
BIN_DIR := $(GVISOR_PREBUILT_DIR)
INITRAMFS ?= $(CUR_DIR)/../../../build/initramfs
TARGET_DIR := $(INITRAMFS)/opt/gvisor
RUN_BASH := $(CUR_DIR)/run_gvisor_test.sh
@ -107,21 +102,6 @@ all: $(TESTS)
$(TESTS): $(BIN_DIR) $(TARGET_DIR)
@cp -f $</$@ $(TARGET_DIR)/tests
ifndef GVISOR_PREBUILT_DIR
$(BIN_DIR): $(SRC_DIR)
@if ! type bazel > /dev/null; then \
echo "bazel is not installed, please run tools/install_bazel.sh with sudo permission to install it."; \
exit 1; \
fi
@rm -rf $@ && mkdir -p $@
@cd $(SRC_DIR) && bazel build --test_tag_filters=native //test/syscalls/...
@cp $(SRC_DIR)/bazel-bin/test/syscalls/linux/*_test $@
$(SRC_DIR):
@rm -rf $@ && mkdir -p $@
@cd $@ && git clone -b 20200921.0 https://github.com/asterinas/gvisor.git .
endif
$(TARGET_DIR): $(RUN_BASH) $(BLOCK_LIST) $(EXT2_BLOCK_LIST) $(EXFAT_BLOCK_LIST)
@rm -rf $@ && mkdir -p $@
@# Prepare tests dir for test binaries

View File

@ -24,24 +24,31 @@ ENV VDSO_LIBRARY_DIR="/root/linux_vdso"
#= Build syscall test =========================================================
FROM build-base AS build-bazel
FROM build-base AS build-gvisor
# Install bazel, which is required by the system call test suite from Gvisor project
RUN mkdir -p /root/bazel
COPY tools/install_bazel.sh /root/bazel/
WORKDIR /root/bazel
RUN ./install_bazel.sh
RUN apt clean && rm -rf /var/lib/apt/lists/*
WORKDIR /root
RUN rm -rf bazel
# Install required packages for bazel
RUN apt update && apt install -y curl gnupg2 git \
python-is-python3 python3 python3-setuptools python3-pip \
build-essential crossbuild-essential-arm64 qemu-user-static \
openjdk-11-jdk-headless zip unzip \
apt-transport-https ca-certificates gnupg-agent \
software-properties-common \
pkg-config libffi-dev patch diffutils libssl-dev iptables kmod \
clang crossbuild-essential-amd64 erofs-utils busybox-static libbpf-dev \
iproute2 netcat-openbsd libnuma-dev libc6-dev-i386 golang-go
FROM build-bazel AS build-gvisor
# Install bazel
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb && \
dpkg -i bazelisk-amd64.deb && \
rm bazelisk-amd64.deb
# Build the gvisor syscall test binaries
COPY test/initramfs/src/syscall/gvisor /root/gvisor
WORKDIR /root
RUN git clone -b release-20251215.0 --single-branch --depth 1 https://github.com/google/gvisor.git
WORKDIR /root/gvisor
RUN export BUILD_DIR=build && \
make ${BUILD_DIR}/syscall_test_bins
RUN bazel build --test_tag_filters=native //test/syscalls/... && \
mkdir -p /root/syscall_test_bins && \
cp bazel-bin/test/syscalls/linux/*_test /root/syscall_test_bins
#= The final stages to produce the Asterinas development image ====================
@ -82,7 +89,7 @@ RUN ln -s /root/asterinas/tools/sctrace.sh /usr/local/bin/sctrace
RUN echo 'export ASTER_SCML=$(find /root/asterinas/book/src/kernel/linux-compatibility/ -name "*.scml")' >> /root/.bashrc
# Copy the gvisor syscall test binaries
COPY --from=build-gvisor /root/gvisor/build/syscall_test_bins /root/syscall_test_bins
COPY --from=build-gvisor /root/syscall_test_bins /root/syscall_test_bins
ENV GVISOR_PREBUILT_DIR=/root/syscall_test_bins
# Add the path of Asterinas tools

View File

@ -1,19 +0,0 @@
#! /bin/bash
# SPDX-License-Identifier: MPL-2.0
set -e
if type bazel > /dev/null; then
echo "Bazel has been installed already"
exit 0
fi
apt update && apt install curl gnupg -y
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
mv bazel.gpg /etc/apt/trusted.gpg.d/
echo 'deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8' | tee /etc/apt/sources.list.d/bazel.list
apt update && apt install bazel=5.4.0 -y
echo "Bazel is installed successfully"