From 528cddb7626b235a476f49b008da32e7d23b33ac Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Mon, 10 Jul 2023 09:13:53 +0200 Subject: [PATCH] re-import sources as agreed with the maintainer --- .gitignore | 4 +- tests/libva-tests/runtests.sh | 80 +++++++++++++++++++++++++++++++++++ tests/tests.yml | 30 +++++++++++++ 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100755 tests/libva-tests/runtests.sh create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index 53a4bfe..5dbc45f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/libva-2.13.0.tar.gz -/libva-2.13.0.tar.gz +/libva-*.tar.bz2 +/libva-*.tar.gz diff --git a/tests/libva-tests/runtests.sh b/tests/libva-tests/runtests.sh new file mode 100755 index 0000000..a124086 --- /dev/null +++ b/tests/libva-tests/runtests.sh @@ -0,0 +1,80 @@ +#!/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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..6ab984e --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,30 @@ +--- +- 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