Convert the STI test to TMT

This commit is contained in:
Jakub Haruda 2025-07-09 17:17:41 +02:00
parent 528cddb762
commit f9dec0a74d
5 changed files with 65 additions and 110 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -1,80 +0,0 @@
#!/bin/bash
function error() {
echo "$0: Error: $*" >&2
exit 1
}
function tarball_fullname() {
ls -1 $1.tar.* | head -1
}
function tarball_exists() {
ls -1 $1.tar.* > /dev/null 1>&2 && test -s $(tarball_fullname $1)
}
# Script directory is now a working directory.
cd $(dirname $0) || error "cannot cd to $(dirname $0)"
# Handy shortcuts.
need_libva_utils_version=$(rpm -q --queryformat='%{VERSION}\n' libva)
[[ "x${need_libva_utils_version}" == "x" ]] && error "libva version cannot be retrieved"
libva_utils_tarball_basename=libva-utils-${need_libva_utils_version}
# Get the libva-utils Fedora repo.
git clone https://src.fedoraproject.org/rpms/libva-utils.git || error "cannot fetch libva-utils Fedora repo"
# cd to repo.
cd libva-utils || error "cannot cd to libva-utils"
# Checkout the commit with desired libva-utils version.
git checkout $(git log -S "${libva_utils_tarball_basename}.tar" --oneline | tail -1 | awk '{print $1;}') || error "cannot checkout desired commit"
# Try to fetch desired tarball.
spectool -g libva-utils.spec
if ! tarball_exists ${libva_utils_tarball_basename}; then
echo '{ "ANSIBLE_MODULE_ARGS": { "package": "libva-utils", "sources": "./sources", "target": "./" } }' > args.json
python3 /usr/share/ansible/roles/standard-test-source/library/source-lookaside.py args.json
fi
# Still no success? Let's take it from upstream as the last try.
if ! tarball_exists ${libva_utils_tarball_basename}; then
wget -O ${libva_utils_tarball_basename}.tar.gz "https://github.com/intel/libva-utils/archive/${need_libva_utils_version}.tar.gz"
tarball_exists ${libva_utils_tarball_basename} || error "cannot fetch libva-utils tarball"
fi
libva_utils_tarball=$(tarball_fullname ${libva_utils_tarball_basename})
# Unpack the sources.
case "${libva_utils_tarball}" in
*.tar.gz)
gzip -dc "${libva_utils_tarball}" | tar -xof -
;;
*.tar.bz2)
bzip2 -dc "${libva_utils_tarball}" | tar -xof -
;;
*.tar.xz)
xz -dc "${libva_utils_tarball}" | tar -xof -
;;
*)
error "cannot unpack ${libva_utils_tarball}"
;;
esac
# Enter the directory with unpacked sources.
cd libva-utils-${need_libva_utils_version} || error "cannot cd to libva-utils-${need_libva_utils_version}"
# Build the tests.
autoreconf -fvi || error "cannot reconfigure libva-utils"
rpm --eval '%configure --enable-tests' > configure.wrap || error "cannot wrap configure"
bash configure.wrap || error "cannot configure libva-utils"
make || error "cannot build libva-utils"
# These tests can run also in VM (other needs real working graphic adapter).
GTEST_FILTER='Internal.Resolution'
GTEST_FILTER="${GTEST_FILTER}:VAAPIFixture.getDisplay"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.vaInitialize_vaTerminate_Bad_Environment"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.vaInitialize_vaTerminate_Bad_vaSetDriverName"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.InitTermWithoutDisplay"
export GTEST_FILTER
# Run the tests.
./test/test_va_api

22
tests/main.fmf Normal file
View File

@ -0,0 +1,22 @@
test: ./runtests.sh
duration: 15m
recommend:
- git
- wget
- rpm-build
- redhat-rpm-config
- autoconf
- automake
- libtool
- pkgconfig
- make
- gcc
- gcc-c++
- libX11
- libX11-devel
- libdrm
- libdrm-devel
- libva
- libva-devel
- wayland-devel
framework: shell

42
tests/runtests.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
function error() {
echo "$0: Error: $*" >&2
exit 1
}
function tarball_fullname() {
ls -1 $1.tar.* | head -1
}
function tarball_exists() {
ls -1 $1.tar.* > /dev/null 1>&2 && test -s $(tarball_fullname $1)
}
# Script directory is now a working directory.
cd $(dirname $0) || error "cannot cd to $(dirname $0)"
git clone https://github.com/intel/libva-utils --no-tags --no-checkout || error "cannot git clone intel/libva-utils"
# Enter the directory with unpacked sources.
cd libva-utils || error "cannot cd to libva-utils"
GIT_COMMIT_LIBVA="7bad184b2cf2ffaf4fb3cc71d4df63d7b142d592"
git reset --hard ${GIT_COMMIT_LIBVA} || error "cannot checkout the commit ${GIT_COMMIT_LIBVA}"
# Build the tests.
autoreconf -fvi || error "cannot reconfigure libva-utils"
rpm --eval '%configure --enable-tests' > configure.wrap || error "cannot wrap configure"
bash configure.wrap || error "cannot configure libva-utils"
make || error "cannot build libva-utils"
# These tests can run also in VM (other needs real working graphic adapter).
GTEST_FILTER='Internal.Resolution'
GTEST_FILTER="${GTEST_FILTER}:VAAPIFixture.getDisplay"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.vaInitialize_vaTerminate_Bad_Environment"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.vaInitialize_vaTerminate_Bad_vaSetDriverName"
GTEST_FILTER="${GTEST_FILTER}:VAAPIInitTerminate.InitTermWithoutDisplay"
export GTEST_FILTER
# Run the tests.
./test/test_va_api

View File

@ -1,30 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- git
- spectool
- wget
- rpm-build
- redhat-rpm-config
- autoconf
- automake
- libtool
- pkgconfig
- make
- gcc
- gcc-c++
- libX11
- libX11-devel
- libdrm
- libdrm-devel
- libva
- libva-devel
- wayland-devel
tests:
- smoke:
dir: ./libva-tests
run: ./runtests.sh