[osinfo-db-tools PATCH 2/2] spec: Add %check target (and the needed deps)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that we have tests as part of osinfo-db-tools, let's enable them
when building an RPM.

A new set of BuildRequires dependencies have been added as our tests
depend on python3, python3-pytest, and python3-requests.

The %check target has been added unconditionally the tests are only
executed in case the deps are found in the system.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo-db-tools.spec.in | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/osinfo-db-tools.spec.in b/osinfo-db-tools.spec.in
index f0a5fcc..48f71c1 100644
--- a/osinfo-db-tools.spec.in
+++ b/osinfo-db-tools.spec.in
@@ -1,5 +1,11 @@
 # -*- rpm-spec -*-
 
+%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} >= 8)
+    %define supports_python3 1
+%else
+    %define supports_python3 0
+%endif
+
 Summary: Tools for managing the osinfo database
 Name: osinfo-db-tools
 Version: @VERSION@
@@ -16,6 +22,13 @@ BuildRequires: libarchive-devel
 BuildRequires: json-glib-devel
 BuildRequires: /usr/bin/pod2man
 
+%if %{supports_python3}
+#Required for testing purposes
+BuildRequires: python3
+BuildRequires: python3-pytest
+BuildRequires: python3-requests
+%endif
+
 %description
 This package provides tools for managing the osinfo database of
 information about operating systems for use with virtualization
@@ -27,6 +40,13 @@ information about operating systems for use with virtualization
 %configure
 %__make %{?_smp_mflags} V=1
 
+%check
+if ! make check
+then
+  cat tests/test-suite.log || true
+  exit 1
+fi
+
 %install
 %__make install DESTDIR=%{buildroot}
 
-- 
2.20.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux