From 1d43258699d9efc60f6062557e577c5f50c50e11 Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Thu, 10 Apr 2025 11:59:24 +0000 Subject: [PATCH 1/5] Add isolated tests "framework" Use this to add hand-crafted tests. Signed-off-by: Alexandre Ghiti --- .github/scripts/isolated_tests.sh | 37 ++++++++++++++++++++++++++++++ .github/workflows/testsuites.yml | 38 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 .github/scripts/isolated_tests.sh diff --git a/.github/scripts/isolated_tests.sh b/.github/scripts/isolated_tests.sh new file mode 100755 index 0000000..4d6c9ff --- /dev/null +++ b/.github/scripts/isolated_tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2025 Rivos Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set -euox pipefail +d=$(dirname "${BASH_SOURCE[0]}") +. $d/series/utils.sh + +logs=$(get_logs_dir) +f=${logs}/isolated-tests.log + +KERNEL_PATH=$(find "$1" -name '*vmlinuz*') +mv $KERNEL_PATH $KERNEL_PATH.gz +gunzip $KERNEL_PATH.gz + +ROOTFS_PATH=$(find /rootfs/ -name 'rootfs_rv64_ubuntu*.ext4') + +build_name=$(cat "$1/kernel_version") + +# The Docker image comes with a prebuilt python environment with all tuxrun +# dependencies +source /build/.env/bin/activate + +isolated_tests=( "cfi" ) + +mkdir -p /build/squad_json/ +parallel_log=$(mktemp -p ${ci_root}) + +for test in ${isolated_tests[@]}; do + /build/tuxrun/run --runtime null --device qemu-riscv64 --kernel $KERNEL_PATH --tests ${test} --results /build/squad_json/${test}.json --log-file-text /build/squad_json/${test}.log --timeouts ${test}=480 --overlay /build/isolated-${test}.tar.xz --rootfs $ROOTFS_PATH --boot-args "rw" || true + # Convert JSON to squad datamodel + python3 /build/my-linux/.github/scripts/series/tuxrun_to_squad_json.py --result-path /build/squad_json/${test}.json --testsuite ${test} + python3 /build/my-linux/.github/scripts/series/generate_metadata.py --logs-path /build/squad_json/ --job-url ${GITHUB_JOB_URL} --branch ${GITHUB_BRANCH_NAME} + + curl --header "Authorization: token $SQUAD_TOKEN" --form tests=@/build/squad_json/${test}.squad.json --form log=@/build/squad_json/${test}.log --form metadata=@/build/squad_json/metadata.json https://mazarinen.tail1c623.ts.net/api/submit/riscv-linux/linux-all/${build_name}/qemu +done diff --git a/.github/workflows/testsuites.yml b/.github/workflows/testsuites.yml index 5844fc7..5b3de86 100644 --- a/.github/workflows/testsuites.yml +++ b/.github/workflows/testsuites.yml @@ -172,3 +172,41 @@ jobs: path: | /build/logs/* /build/squad_json/* + + run-isolated-tests: + needs: build-kernel + if: ${{ endsWith(github.head_ref, '_manual') }} + runs-on: self-hosted + timeout-minutes: 50400 # 35 days + container: + image: ghcr.io/linux-riscv/linaro-tuxrun-dispatcher-riscv64:latest + volumes: + - /home/github/ccache:/build/ccache + - /home/github/gitref:/build/gitref + - /tmp:/tmp + steps: + - name: Download pre-built kernel + uses: actions/download-artifact@v4 + with: + name: test-kernel + path: /build/test-kernel + - name: Download CI files + uses: actions/download-artifact@v4 + with: + name: ci-files + path: /build/my-linux/.github + - name: Run checks + env: + SQUAD_TOKEN: ${{ secrets.SQUAD_TOKEN }} + GITHUB_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GITHUB_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + run: | + mkdir -p /build/logs/ + cd /build/my-linux && bash .github/scripts/isolated_tests.sh /build/test-kernel | tee -i /build/logs/all.log + - name: Collect logs and json squad + uses: actions/upload-artifact@v4 + with: + name: test-logs-isolated-tests + path: | + /build/logs/* + /build/squad_json/* From cea93be32ad7415070f36efc36600ed5070b042f Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Thu, 10 Apr 2025 12:16:35 +0000 Subject: [PATCH 2/5] Add RISCV_USER_CFI config to the ubuntu config Signed-off-by: Alexandre Ghiti --- .github/scripts/series/kconfigs/ubuntu_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/series/kconfigs/ubuntu_defconfig b/.github/scripts/series/kconfigs/ubuntu_defconfig index 7a70f41..fb95103 100644 --- a/.github/scripts/series/kconfigs/ubuntu_defconfig +++ b/.github/scripts/series/kconfigs/ubuntu_defconfig @@ -5483,6 +5483,7 @@ CONFIG_RELOCATABLE=y CONFIG_RANDOMIZE_BASE=y CONFIG_ERRATA_THEAD_MAE=y CONFIG_ERRATA_THEAD=y +CONFIG_RISCV_USER_CFI=y # DEBUG configs CONFIG_DEBUG_ATOMIC_SLEEP=y CONFIG_DEBUG_SPINLOCK=y From 2df74f84e3179ea3e5773b465e17c9f232804e76 Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Fri, 11 Apr 2025 12:15:56 +0000 Subject: [PATCH 3/5] Resize the ubuntu rootfs The ubuntu rootfs generated by mmdebstrap is only the size of the files it contains, so we need to increase its size to be used as rootfs. Signed-off-by: Alexandre Ghiti --- .github/scripts/isolated_tests.sh | 3 +++ .github/scripts/xfstests.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/scripts/isolated_tests.sh b/.github/scripts/isolated_tests.sh index 4d6c9ff..8bdd2ce 100755 --- a/.github/scripts/isolated_tests.sh +++ b/.github/scripts/isolated_tests.sh @@ -15,6 +15,9 @@ mv $KERNEL_PATH $KERNEL_PATH.gz gunzip $KERNEL_PATH.gz ROOTFS_PATH=$(find /rootfs/ -name 'rootfs_rv64_ubuntu*.ext4') +# Resize the fs +truncate -s +4G $ROOTFS_PATH +resize2fs $ROOTFS_PATH build_name=$(cat "$1/kernel_version") diff --git a/.github/scripts/xfstests.sh b/.github/scripts/xfstests.sh index bdd8a4c..f94b55b 100755 --- a/.github/scripts/xfstests.sh +++ b/.github/scripts/xfstests.sh @@ -15,6 +15,9 @@ mv $KERNEL_PATH $KERNEL_PATH.gz gunzip $KERNEL_PATH.gz ROOTFS_PATH=$(find /rootfs/ -name 'rootfs_rv64_ubuntu*.ext4') +# Resize the fs +truncate -s +20G $ROOTFS_PATH +resize2fs $ROOTFS_PATH build_name=$(cat "$1/kernel_version") From 7c4ff4fb27f30e5afb3b5d0e7e969fcfd246ef87 Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Mon, 14 Apr 2025 13:28:40 +0000 Subject: [PATCH 4/5] Use the CFI-enabled toolchain to build testsuite kernel Signed-off-by: Alexandre Ghiti --- .github/scripts/build_ubuntu_defconfig.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/scripts/build_ubuntu_defconfig.sh b/.github/scripts/build_ubuntu_defconfig.sh index 66c9b40..783826e 100755 --- a/.github/scripts/build_ubuntu_defconfig.sh +++ b/.github/scripts/build_ubuntu_defconfig.sh @@ -20,7 +20,9 @@ echo "build_name $(git describe --tags ${kernel_base_sha})" | tee -a ${f} build_name=$(git describe --tags ${kernel_base_sha}) # Build the kernel that will run LTP -export CI_TRIPLE="riscv64-linux-gnu" +export CI_TRIPLE="riscv64-unknown-linux-gnu" +# Use a CFI-enabled toolchain +export PATH=/build/INSTALL_Sept24/bin:$PATH cp $d/series/kconfigs/ubuntu_defconfig arch/riscv/configs/ $d/series/kernel_builder.sh rv64 testsuites plain gcc | tee -a ${f} From 9602dd673a1aba72281c3d9c3d70f28703618825 Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Wed, 16 Apr 2025 16:05:54 +0000 Subject: [PATCH 5/5] Add BTRFS=y for xfstests-btrfs Signed-off-by: Alexandre Ghiti --- .github/scripts/series/kconfigs/ubuntu_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/series/kconfigs/ubuntu_defconfig b/.github/scripts/series/kconfigs/ubuntu_defconfig index fb95103..42d97ed 100644 --- a/.github/scripts/series/kconfigs/ubuntu_defconfig +++ b/.github/scripts/series/kconfigs/ubuntu_defconfig @@ -5158,7 +5158,7 @@ CONFIG_XFS_RT=y CONFIG_GFS2_FS=m CONFIG_GFS2_FS_LOCKING_DLM=y CONFIG_OCFS2_FS=m -CONFIG_BTRFS_FS=m +CONFIG_BTRFS_FS=y CONFIG_BTRFS_FS_POSIX_ACL=y CONFIG_NILFS2_FS=m CONFIG_F2FS_FS=y