tools/testing/selftests/bpf/vmtest.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/vmtest.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/vmtest.sh
Extension
.sh
Size
11716 bytes
Lines
485
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

set -e

# This script currently only works for the following platforms,
# as it is based on the VM image used by the BPF CI, which is
# available only for these architectures. We can also specify
# the local rootfs image generated by the following script:
# https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh
PLATFORM="${PLATFORM:-$(uname -m)}"
case "${PLATFORM}" in
s390x)
	QEMU_BINARY=qemu-system-s390x
	QEMU_CONSOLE="ttyS1"
	HOST_FLAGS=(-smp 2 -enable-kvm)
	CROSS_FLAGS=(-smp 2)
	BZIMAGE="arch/s390/boot/vmlinux"
	ARCH="s390"
	;;
x86_64)
	QEMU_BINARY=qemu-system-x86_64
	QEMU_CONSOLE="ttyS0,115200"
	HOST_FLAGS=(-cpu host -enable-kvm -smp 8)
	CROSS_FLAGS=(-smp 8)
	BZIMAGE="arch/x86/boot/bzImage"
	ARCH="x86"
	;;
aarch64)
	QEMU_BINARY=qemu-system-aarch64
	QEMU_CONSOLE="ttyAMA0,115200"
	HOST_FLAGS=(-M virt,gic-version=3 -cpu host -enable-kvm -smp 8)
	CROSS_FLAGS=(-M virt,gic-version=3 -cpu cortex-a76 -smp 8)
	BZIMAGE="arch/arm64/boot/Image"
	ARCH="arm64"
	;;
riscv64)
	# required qemu version v7.2.0+
	QEMU_BINARY=qemu-system-riscv64
	QEMU_CONSOLE="ttyS0,115200"
	HOST_FLAGS=(-M virt -cpu host -enable-kvm -smp 8)
	CROSS_FLAGS=(-M virt -cpu rv64,sscofpmf=true -smp 8)
	BZIMAGE="arch/riscv/boot/Image"
	ARCH="riscv"
	;;
ppc64el)
	QEMU_BINARY=qemu-system-ppc64
	QEMU_CONSOLE="hvc0"
	# KVM could not be tested for powerpc, therefore not enabled for now.
	HOST_FLAGS=(-machine pseries -cpu POWER9)
	CROSS_FLAGS=(-machine pseries -cpu POWER9)
	BZIMAGE="vmlinux"
	ARCH="powerpc"
	;;
*)
	echo "Unsupported architecture"
	exit 1
	;;
esac
DEFAULT_COMMAND="./test_progs"
MOUNT_DIR="mnt"
LOCAL_ROOTFS_IMAGE=""
ROOTFS_IMAGE="root.img"
OUTPUT_DIR="$HOME/.bpf_selftests"
KCONFIG_REL_PATHS=("tools/testing/selftests/bpf/config"
	"tools/testing/selftests/bpf/config.vm"
	"tools/testing/selftests/bpf/config.${PLATFORM}")
INDEX_URL="https://raw.githubusercontent.com/libbpf/ci/master/INDEX"
NUM_COMPILE_JOBS="$(nproc)"
LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")"

Annotation

Implementation Notes