#!/bin/bash set -eux VMTEST_SETUPCMD="PROJECT_NAME=${PROJECT_NAME} ./${PROJECT_NAME}/travis-ci/vmtest/run_selftests.sh" echo "KERNEL: $KERNEL" # Build latest pahole ${VMTEST_ROOT}/build_pahole.sh travis-ci/vmtest/pahole # Install required packages wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a /etc/apt/sources.list sudo apt-get -qq update sudo apt-get -qq -y install clang lld llvm # Build selftests (and latest kernel, if necessary) KERNEL="${KERNEL}" ${VMTEST_ROOT}/prepare_selftests.sh travis-ci/vmtest/bpf-next # Escape whitespace characters. setup_cmd=$(sed 's/\([[:space:]]\)/\\\1/g' <<< "${VMTEST_SETUPCMD}") sudo adduser "${USER}" kvm if [[ "${KERNEL}" = 'LATEST' ]]; then sudo -E sudo -E -u "${USER}" "${VMTEST_ROOT}/run.sh" -b travis-ci/vmtest/bpf-next -o -d ~ -s "${setup_cmd}" ~/root.img; else sudo -E sudo -E -u "${USER}" "${VMTEST_ROOT}/run.sh" -k "${KERNEL}*" -o -d ~ -s "${setup_cmd}" ~/root.img; fi