From a883b6518799b6fdd10e3f400ca6509104aaf2e6 Mon Sep 17 00:00:00 2001 From: LI Qing Date: Wed, 3 Jan 2024 11:29:28 +0800 Subject: [PATCH] Refine the scripts for syscall test --- regression/syscall_test/Makefile | 2 +- regression/syscall_test/run_syscall_test.sh | 4 ++-- tools/docker/Dockerfile.ubuntu22.04 | 7 +++---- tools/install_bazel.sh | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 tools/install_bazel.sh diff --git a/regression/syscall_test/Makefile b/regression/syscall_test/Makefile index e4044251..b96af384 100644 --- a/regression/syscall_test/Makefile +++ b/regression/syscall_test/Makefile @@ -63,7 +63,7 @@ $(TESTS): $(BIN_DIR) $(TARGET_DIR) ifndef ASTER_PREBUILT_SYSCALL_TEST $(BIN_DIR): $(SRC_DIR) @if ! type bazel > /dev/null; then \ - echo "bazel is not installed, please run $(CUR_DIR)/install_bazel.sh with sudo permission to install it."; \ + echo "bazel is not installed, please run tools/install_bazel.sh with sudo permission to install it."; \ exit 1; \ fi @rm -rf $@ && mkdir -p $@ diff --git a/regression/syscall_test/run_syscall_test.sh b/regression/syscall_test/run_syscall_test.sh index d87ee2cc..5b9e6fd5 100755 --- a/regression/syscall_test/run_syscall_test.sh +++ b/regression/syscall_test/run_syscall_test.sh @@ -39,7 +39,7 @@ run_one_test(){ ret=0 if [ -f $TEST_BIN_DIR/$1 ]; then get_blocklist_subtests $1 - $TEST_BIN_DIR/$1 --gtest_filter=-$BLOCK + cd $TEST_BIN_DIR && ./$1 --gtest_filter=-$BLOCK ret=$? #After executing the test, it is necessary to clean the directory to ensure no residual data remains rm -rf $TEST_TMP_DIR/* @@ -72,4 +72,4 @@ if [ $TESTS != $PASSED_TESTS ]; then cat $FAIL_CASES fi -exit $RESULT \ No newline at end of file +exit $RESULT diff --git a/tools/docker/Dockerfile.ubuntu22.04 b/tools/docker/Dockerfile.ubuntu22.04 index 7de884d5..5b28bb7c 100644 --- a/tools/docker/Dockerfile.ubuntu22.04 +++ b/tools/docker/Dockerfile.ubuntu22.04 @@ -64,11 +64,10 @@ RUN rm -rf sysbench-1.0.20 \ FROM build-base as build-bazel # 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 curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg -RUN mv bazel.gpg /etc/apt/trusted.gpg.d -RUN echo 'deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8' | tee /etc/apt/sources.list.d/bazel.list -RUN apt update && apt install bazel=5.4.0 -y +RUN ./install_bazel.sh RUN apt clean && rm -rf /var/lib/apt/lists/* WORKDIR /root RUN rm -rf bazel diff --git a/tools/install_bazel.sh b/tools/install_bazel.sh new file mode 100755 index 00000000..46d2f990 --- /dev/null +++ b/tools/install_bazel.sh @@ -0,0 +1,19 @@ +#! /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"