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} diff --git a/.github/scripts/isolated_tests.sh b/.github/scripts/isolated_tests.sh new file mode 100755 index 0000000..8bdd2ce --- /dev/null +++ b/.github/scripts/isolated_tests.sh @@ -0,0 +1,40 @@ +#!/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') +# Resize the fs +truncate -s +4G $ROOTFS_PATH +resize2fs $ROOTFS_PATH + +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/scripts/series/kconfigs/ubuntu_defconfig b/.github/scripts/series/kconfigs/ubuntu_defconfig index 7a70f41..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 @@ -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 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") 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/*