Skip to content

Commit

Permalink
programs: add kvm-unit-tests-qemu
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Li <philip.li@intel.com>
  • Loading branch information
rli9 committed Jun 14, 2024
1 parent 29ff63b commit 22ce2d0
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
16 changes: 16 additions & 0 deletions programs/kvm-unit-tests-qemu/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
short_description: >
The kvm-unit-tests are a set of tests which can be used to verify virtualized CPUs
(like KVM and others), emulated CPUs (like TCG from QEMU) or even real CPU behavior.
This test suite with -qemu suffix won't use the qemu binary provided in
distribution, but will clone official qemu git tree and build qemu from
source code.
homepage: https://gitlab.com/kvm-unit-tests/kvm-unit-tests

parameters:
qemu_branch: qemu/master
qemu_commit:
qemu_config: x86_64-softmmu

results:
1 change: 1 addition & 0 deletions programs/kvm-unit-tests-qemu/parse
1 change: 1 addition & 0 deletions programs/kvm-unit-tests-qemu/pkg/PKGBUILD
1 change: 1 addition & 0 deletions programs/kvm-unit-tests-qemu/pkg/addon
36 changes: 36 additions & 0 deletions programs/kvm-unit-tests-qemu/pkg/depends
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
acpica-tools
build-essential
git
info2man
libaio-dev
libasound2-dev
libcap-dev
libcap-ng-dev
libfdt-dev
libfdt1
libglib2.0-0
libglib2.0-dev
libnfs-dev
libpipewire-0.3-dev
libpixman-1-0
libpixman-1-dev
libpulse-dev
libsdl1.2debian
libsdl2-dev
libseccomp-dev
libslirp-dev
libspice-protocol-dev
libspice-server-dev
liburing-dev
libvdeplug-dev
libxen-dev
libxkbcommon-dev
ninja-build
pkg-config
psmisc
python-csvkit
python-pip
python-tomli
python-venv
virt-what
zlib1g-dev
59 changes: 59 additions & 0 deletions programs/kvm-unit-tests-qemu/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

. $LKP_SRC/lib/mount.sh
. $LKP_SRC/lib/debug.sh
. $LKP_SRC/lib/upload.sh
. $LKP_SRC/lib/tests/kvm-unit-tests.sh
. $LKP_SRC/lib/git.sh
. $LKP_SRC/lib/misc-base.sh
. $LKP_SRC/lib/reproduce-log.sh

## Tests for x86 architecture are run as kernel images for qemu
## that supports multiboot format. Tests uses an infrastructure
## called from the bios code. The infrastructure initialize the
## system/cpu's, switch to long-mode and calls the 'main' function
## of the individual test. Tests uses a qemu's virtual test device,
## named testdev, for services like printing, exiting, query memory size etc.

build_qemu()
{
[ -n "$qemu_config" ] || die "can not find qemu_config"
[ -n "$qemu_commit" ] || die "can not find qemu_commit"
[ -n "$qemu_branch" ] || die "can not find qemu_branch"

qemu_remote=${qemu_branch%%/*}

git_clone_update --recursive https://gitlab.com/qemu-project/$qemu_remote.git "$QEMU_REPO_ROOT" 2>&1 || die "failed clone qemu tree $qemu_remote"

cd "$QEMU_REPO_ROOT" || die "fail to enter $QEMU_REPO_ROOT"
log_cmd git checkout -q $qemu_commit || die "failed to checkout qemu commit $qemu_commit"

log_cmd ./configure --target-list="$qemu_config" --disable-docs || die "failed to run ./configure"

unset LDFLAGS
log_cmd make -j $nr_cpu 2>&1 || die "failed to make"

$QEMU --help >/dev/null || die "QEMU Emulator can not work normally."
}

QEMU_REPO_ROOT="$BENCHMARK_ROOT/qemu"
QEMU="$QEMU_REPO_ROOT/build/qemu-system-x86_64"

build_qemu
$QEMU --version

cd $BENCHMARK_ROOT/kvm-unit-tests || die "no $BENCHMARK_ROOT/kvm-unit-tests"

export QEMU

fixup_tests
setup_test_environment || die "failed to setup test environment"

run_tests
exit_code=$?

upload_test_results

[ $exit_code -ne 0 ] && dump_qemu

exit $exit_code

0 comments on commit 22ce2d0

Please sign in to comment.