Add CI test

This commit is contained in:
Tom Stellard 2022-02-22 23:51:08 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent 5615a58334
commit 145f26fa48
6 changed files with 66 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
plans/basic.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

4
tests/build-gating.fmf Normal file
View File

@ -0,0 +1,4 @@
discover:
how: fmf
exexute:
how: tmt

View File

@ -0,0 +1,6 @@
summary: Test build a simple RPM package to ensure package notes are working
require:
- dnf
- dnf-plugins-core
- rpm-build
test: ./runtest.sh

8
tests/simple-rpm/runtest.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -ex
dnf -y build-dep test.spec
rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec
dnf -y build-dep test.spec -D "_with_ld_lld 1"
rpmbuild --with ld_lld --define '_sourcedir .' --define '_builddir .' -bb test.spec

View File

@ -0,0 +1,42 @@
%bcond_with ld_lld
%if %{with ld_lld}
%global extra_ldflags -fuse-ld=lld
%global _package_note_linker lld
%endif
Name: test
Version: 1
Release: 1
Summary: Test package for checking package notes
License: MIT
BuildRequires: gcc
# For %check
BuildRequires: binutils
BuildRequires: jq
%if %{with ld_lld}
BuildRequires: lld
%endif
%description
Test package for checking package notes
%build
echo 'int main(int argc, char **argv) { return 0; }' | %{build_cc} ${CFLAGS} -x c -c - -o main.o
%{build_cc} ${LDFLAGS} %{?extra_ldflags} main.o -o main
# Package notes not supported with lld, so the the build succeeding is enough.
%if %{without ld_lld}
%check
# avoid any attempt to access the network by readelf
export DEBUGINFOD_URLS=
readelf --notes ./main | sed -r -n 's/.*Packaging Metadata: (.*)/\1/p' | tee package-note.text
test "`cat package-note.text | jq -r '[.type,.name,.version,.architecture]|join(" ")'`" == "rpm %{name} %{version}-%{release} %{_arch}"
%endif
%changelog
* Sat Aug 6 2022 Jane Doe <jane@example.org> - 1-1
- Dummy