]> git.proxmox.com Git - ovs.git/commitdiff
rhel: add option to run kernel datapath test when building rpms
authorLance Richardson <lrichard@redhat.com>
Fri, 2 Sep 2016 13:55:27 +0000 (09:55 -0400)
committerRussell Bryant <russell@ovn.org>
Fri, 9 Sep 2016 19:50:20 +0000 (15:50 -0400)
Add ability to execute kernel datapath tests when building rpms.
These tests are disabled by default, and can optionally be run
by providing "--with check_datapath_kernel" on the rpmbuild command
line.  This is intended to facilitate automated testing, and
should not be used in production environments (it is generally not
recommended to run rpmbuild as root).

Suggested-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
rhel/openvswitch-fedora.spec.in
rhel/openvswitch.spec.in

index e61ff69553eb13ead557a16088adfd1230276510..eda876748a6e5295b35600cf0a41669a8b22aaeb 100644 (file)
@@ -9,7 +9,17 @@
 #
 # If tests have to be skipped while building, specify the '--without check'
 # option. For example:
-# rpmbuild -bb --without check rhel/openvswitch-fedora.spec
+#     rpmbuild -bb --without check rhel/openvswitch-fedora.spec
+#
+# Support for executing kernel data path tests under rpmbuild is
+# provided, however this is intended for use only in test environments
+# and should not be used otherwise (these tests require root privileges).
+# These tests can be executed, for example, via:
+#    rpmbuild -rb --with check_datapath_kernel openvswitch-fedora.src.rpm
+#
+# These tests will use the currently installed OVS kernel modules, when
+# testing out of tree kernel modules the appropriate openvswitch-kmod
+# package should be installed first.
 
 #%define kernel 2.6.40.4-5.fc15.x86_64
 
@@ -67,6 +77,7 @@ Requires(postun): systemd-units
 Obsoletes: openvswitch-controller <= 0:2.1.0-1
 
 %bcond_without check
+%bcond_with check_datapath_kernel
 
 %description
 Open vSwitch provides standard network bridging functions and
@@ -234,6 +245,13 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/ovs-parse-backtrace \
         exit 1
     fi
 %endif
+%if %{with check_datapath_kernel}
+    if make check-kernel RECHECK=yes; then :;
+    else
+        cat tests/system-kmod-testsuite.log
+        exit 1
+    fi
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
index fbca1efcd17f73d196f81c08e859b6f961dfb0d5..0ef0b0425e30801fc691308cafaab23cb5171514 100644 (file)
@@ -9,7 +9,17 @@
 #
 # If tests have to be skipped while building, specify the '--without check'
 # option. For example:
-# rpmbuild -bb --without check rhel/openvswitch.spec
+#     rpmbuild -bb --without check rhel/openvswitch.spec
+#
+# Support for executing kernel data path tests under rpmbuild is
+# provided, however this is intended for use only in test environments
+# and should not be used otherwise (these tests require root privileges).
+# These tests can be executed, for example, via:
+#    rpmbuild -rb --with check_datapath_kernel openvswitch.src.rpm
+#
+# These tests will use the currently installed OVS kernel modules, when
+# testing out of tree kernel modules the appropriate openvswitch-kmod
+# package should be installed first.
 
 Name: openvswitch
 Summary: Open vSwitch daemon/database/utilities
@@ -27,6 +37,7 @@ BuildRequires: openssl-devel
 BuildRequires: checkpolicy, selinux-policy-devel
 
 %bcond_without check
+%bcond_with check_datapath_kernel
 
 %description
 Open vSwitch provides standard network bridging functions and
@@ -123,6 +134,13 @@ install -D -m 0644 lib/.libs/libopenvswitch.a \
         exit 1
     fi
 %endif
+%if %{with check_datapath_kernel}
+    if make check-kernel RECHECK=yes; then :;
+    else
+        cat tests/system-kmod-testsuite.log
+        exit 1
+    fi
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT