Add CI test
This commit is contained in:
parent
5615a58334
commit
145f26fa48
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
5
plans/basic.fmf
Normal file
5
plans/basic.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
summary: Basic smoke test
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
4
tests/build-gating.fmf
Normal file
4
tests/build-gating.fmf
Normal file
@ -0,0 +1,4 @@
|
||||
discover:
|
||||
how: fmf
|
||||
exexute:
|
||||
how: tmt
|
6
tests/simple-rpm/main.fmf
Normal file
6
tests/simple-rpm/main.fmf
Normal 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
8
tests/simple-rpm/runtest.sh
Executable 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
|
42
tests/simple-rpm/test.spec
Normal file
42
tests/simple-rpm/test.spec
Normal 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
|
Loading…
Reference in New Issue
Block a user