File tela.spec of Package tela
#
# spec file for package test
#
# Copyright (c) 2026 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: tela
Version: 1.0
Release: 0
Summary: A framework for running tests that supports dynamic resource matching
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License: MIT
Group: Development/Tools/Other
URL: https://github.com/ibm-s390-linux/%{name}
Source0: %{name}-%{version}.tar.gz
Source1: %{name}-tests.tar.gz
Source2: README.SUSE
Source3: %{name}-rpmlintrc
Patch010: tela-fixes.patch
BuildRequires: glibc-devel-static
BuildRequires: iproute2
BuildRequires: hostname
BuildRequires: distribution-release
BuildRequires: util-linux
BuildRequires: coreutils
BuildRequires: grep
BuildRequires: sed
BuildRequires: rpm
BuildRequires: gzip
BuildRequires: tar
BuildRequires: fdupes
# The framework dynamically compiles .c files to .o files during test execution
Requires: make
Requires: gcc
ExclusiveArch: s390 s390x
%description
tela is a framework for running tests.
- Test execution is controlled by a Makefile.
- Test output is shown in human-readable format,
or in TAP13 format.
- Test programs can be written in any language,
but additional support APIs are only available for Bash and C programs.
tela supports dynamic resource matching.
- Test authors can specify resource requirements
(e.g. number of CPUs, a certain type of PCI device, or a remote system)
that are dynamically matched against a list of available resources.
- This removes the need to hard-code IDs of required resources in test cases,
allowing them to be run without changes on different test systems.
%package devel
Summary: Development files for the tela test framework
Group: Development/Tools/Other
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description devel
Development files and header files for developing tests
using the tela framework.
%package tests
Summary: S390x specific test suite for tela
Group: Development/Tools/Other
Requires: %{name} = %{version}
# This package remains arch-specific because the tests are for s390x
BuildArch: noarch
%description tests
This package contains a specialized home-brewed test suite for
verifying s390x system resources using the tela framework.
%prep
%autosetup -p1 -a1 -n %{name}-master
# Copy the SUSE-specific README into the build directory so %doc catches it
cp %{SOURCE2} .
%build
%make_build
strip src/%{name}
%install
install -d -m 0755 %{buildroot}%{_bindir}
install -d -m 0755 %{buildroot}%{_datadir}/%{name}
install -d -m 0755 %{buildroot}%{_includedir}/%{name}
# 1. Install the main binary
install -m 0755 src/tela %{buildroot}%{_bindir}/%{name}
# 2. Copy the core framework structure to the data directory
# We keep the source structure intact because tela.mak relies on relative paths
cp -a src %{buildroot}%{_datadir}/%{name}/
cp -a tests %{buildroot}%{_datadir}/%{name}/
cp -a doc %{buildroot}%{_datadir}/%{name}/
cp -a examples %{buildroot}%{_datadir}/%{name}/
install -m 0644 tela.mak %{buildroot}%{_datadir}/%{name}/
# 3. Install headers
cp src/*.h %{buildroot}%{_includedir}/%{name}/ || true
cp src/api/*.h %{buildroot}%{_includedir}/%{name}/ || true
# 4. Clean up compiled objects to pass rpmlint, but KEEP the .c source files.
# The tela.mak engine dynamically recompiles these during 'make check'.
find %{buildroot}%{_datadir}/%{name} -name "*.o" -type f -delete
rm -f %{buildroot}%{_datadir}/%{name}/src/tela
# 5. Clean up examples and unnecessary Makefiles
rm -f %{buildroot}%{_datadir}/%{name}/examples/api/day
rm -f %{buildroot}%{_datadir}/%{name}/examples/api/dev_null
rm -f %{buildroot}%{_datadir}/%{name}/doc/Makefile
rm -f %{buildroot}%{_datadir}/%{name}/doc/resources/Makefile
rm -f %{buildroot}%{_datadir}/%{name}/examples/api/Makefile
rm -f %{buildroot}%{_datadir}/%{name}/examples/match/Makefile
%fdupes %{buildroot}%{_datadir}/%{name}
%check
# Ensure the internal libexec tools are in the path for the tests
export PATH=$PATH:$PWD/src/libexec
/usr/bin/make -O -j8 V=1 clean
/usr/bin/make -O -j8 V=1 help
# 1. Generate resources
/usr/bin/make -O -j8 V=1 telarc | tee ~/.telarc
/usr/bin/make -O -j8 V=1 --makefile=tests/s390x-tests-suite/Makefile telastate | tee tests/s390x-tests-suite/resources.yaml
# 2. Run the actual tests against the original state
/usr/bin/make -O -j8 V=1 --makefile=tests/s390x-tests-suite/Makefile check \
TELA_RC=tests/s390x-tests-suite/resources.yaml \
LOG=tests/s390x-tests-suite/test.log
# 3. Generate the plan based on the successful run
/usr/bin/make -O -j8 V=1 --makefile=tests/s390x-tests-suite/Makefile plan \
TELA_RC=tests/s390x-tests-suite/resources.yaml \
LOG=tests/s390x-tests-suite/test.log
# 4. Safely activate the plan for packaging (do not run make check again)
if [ -f tests/s390x-tests-suite/system.sh.yaml.new ]; then
cat tests/s390x-tests-suite/system.sh.yaml.new >> tests/s390x-tests-suite/system.sh.yaml
rm tests/s390x-tests-suite/system.sh.yaml.new
fi
%files
%license LICENSE
%doc README.md HOWTO.md README.SUSE
%{_bindir}/%{name}
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/tela.mak
%{_datadir}/%{name}/src/
%files devel
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%{_datadir}/%{name}/doc/
%{_datadir}/%{name}/examples/
%files tests
%{_datadir}/%{name}/tests/
%changelog