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 <f...@sysclose.org> Signed-off-by: Lance Richardson <lrich...@redhat.com> --- rhel/openvswitch-fedora.spec.in | 16 +++++++++++++++- rhel/openvswitch.spec.in | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index e61ff69..5eec8a0 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -9,7 +9,13 @@ # # 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 #%define kernel 2.6.40.4-5.fc15.x86_64 @@ -67,6 +73,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 +241,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 diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in index fbca1ef..eaeca18 100644 --- a/rhel/openvswitch.spec.in +++ b/rhel/openvswitch.spec.in @@ -9,7 +9,14 @@ # # 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 + Name: openvswitch Summary: Open vSwitch daemon/database/utilities @@ -27,6 +34,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 +131,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 -- 2.5.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev