From: Martin Vidner Date: Thu, 5 Dec 2019 09:58:50 +0000 (+0100) Subject: Run the zypp-plugin tests X-Git-Tag: v0.8.7^2~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f79848ce2720fe1013efe72d87a7bf91e5a9477f;p=thirdparty%2Fsnapper.git Run the zypp-plugin tests The tests need rubygem ruby-dbus but we're not adding a build time dependency in the RPM spec file, instead putting it to the Docker images used in Travis --- diff --git a/Dockerfile.debian b/Dockerfile.debian index de789137..8e6a89bd 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -8,6 +8,7 @@ RUN apt-get update && \ autoconf \ automake \ build-essential \ + dbus \ debhelper \ devscripts \ docbook-xsl \ @@ -27,6 +28,7 @@ RUN apt-get update && \ libz-dev \ locales-all \ rapidjson-dev \ + ruby-dbus \ xsltproc RUN mkdir -p /usr/src/app diff --git a/Dockerfile.leap b/Dockerfile.leap index c5d5a310..5596a63d 100644 --- a/Dockerfile.leap +++ b/Dockerfile.leap @@ -1,7 +1,14 @@ # Build the latest openSUSE Leap image FROM opensuse/leap -RUN zypper --non-interactive in --no-recommends \ +# we need to install Ruby first to define the %{rb_ver} RPM macro +# see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run +# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache +# why we need "zypper clean -a" at the end +RUN zypper --non-interactive in --no-recommends --force-resolution ruby && zypper clean -a + +RUN RUBY_VERSION=ruby:`rpm --eval '%{rb_ver}'` && \ + zypper --non-interactive in --no-recommends \ autoconf \ automake \ dbus-1-devel \ @@ -23,6 +30,7 @@ RUN zypper --non-interactive in --no-recommends \ pam-devel \ rapidjson-devel \ rpm-build \ + "rubygem($RUBY_VERSION:ruby-dbus)" \ which RUN mkdir -p /usr/src/app diff --git a/Dockerfile.tumbleweed b/Dockerfile.tumbleweed index 5289fa48..187ab754 100644 --- a/Dockerfile.tumbleweed +++ b/Dockerfile.tumbleweed @@ -1,7 +1,14 @@ # Build the latest openSUSE Tumbleweed image FROM opensuse/tumbleweed -RUN zypper --non-interactive in --no-recommends \ +# we need to install Ruby first to define the %{rb_ver} RPM macro +# see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run +# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache +# why we need "zypper clean -a" at the end +RUN zypper --non-interactive in --no-recommends --force-resolution ruby && zypper clean -a + +RUN RUBY_VERSION=ruby:`rpm --eval '%{rb_ver}'` && \ + zypper --non-interactive in --no-recommends \ autoconf \ automake \ dbus-1-devel \ @@ -23,6 +30,7 @@ RUN zypper --non-interactive in --no-recommends \ pam-devel \ rapidjson-devel \ rpm-build \ + "rubygem($RUBY_VERSION:ruby-dbus)" \ which RUN mkdir -p /usr/src/app diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 32660323..0cc6bdee 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -8,6 +8,7 @@ RUN apt-get update && \ autoconf \ automake \ build-essential \ + dbus \ debhelper \ devscripts \ docbook-xsl \ @@ -28,6 +29,7 @@ RUN apt-get update && \ libxml2-dev \ libz-dev \ rapidjson-dev \ + ruby-dbus \ xsltproc RUN mkdir -p /usr/src/app diff --git a/configure.ac b/configure.ac index c4cec82c..4379a766 100644 --- a/configure.ac +++ b/configure.ac @@ -193,6 +193,7 @@ AC_OUTPUT( testsuite-real/Makefile testsuite-cmp/Makefile zypp-plugin/Makefile + zypp-plugin/testsuite/Makefile package/snapper.spec:snapper.spec.in dists/debian/snapper-Debian.dsc.in:dists/debian/snapper-Debian.dsc.in.in dists/debian/snapper-xUbuntu.dsc.in:dists/debian/snapper-xUbuntu.dsc.in.in diff --git a/zypp-plugin/Makefile.am b/zypp-plugin/Makefile.am index 90117392..65687334 100644 --- a/zypp-plugin/Makefile.am +++ b/zypp-plugin/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = testsuite + if HAVE_ZYPP plugindir = /usr/lib/zypp/plugins/commit @@ -15,4 +17,4 @@ snapper_zypp_plugin_LDFLAGS = \ ../dbus/libdbus.la \ -lboost_regex -endif \ No newline at end of file +endif diff --git a/zypp-plugin/testsuite/.gitignore b/zypp-plugin/testsuite/.gitignore new file mode 100644 index 00000000..42f17101 --- /dev/null +++ b/zypp-plugin/testsuite/.gitignore @@ -0,0 +1,3 @@ +*.log +*.trs +test-suite.log diff --git a/zypp-plugin/testsuite/Makefile.am b/zypp-plugin/testsuite/Makefile.am new file mode 100644 index 00000000..780192ff --- /dev/null +++ b/zypp-plugin/testsuite/Makefile.am @@ -0,0 +1,9 @@ +if HAVE_ZYPP + +check_SCRIPTS = test1 +noinst_SCRIPTS = mock-snapperd + +TESTS = $(check_SCRIPTS) + +EXTRA_DIST = $(check_SCRIPTS) $(noinst_SCRIPTS) +endif diff --git a/zypp-plugin/testsuite/test1 b/zypp-plugin/testsuite/test1 index b54262fb..20384e13 100755 --- a/zypp-plugin/testsuite/test1 +++ b/zypp-plugin/testsuite/test1 @@ -51,6 +51,12 @@ test_pre_del() { } setup() { + MOCKDEP=(ruby -rdbus -e 1) + if ! "${MOCKDEP[@]}"; then + echo "Mock snapperd cannot be run, skipping test" + echo "('${MOCKDEP[@]}' failed)" + exit 77 + fi $MYDIR/mock-snapperd & sleep 1 PID=$!