[nbdkit] Backport some upstream patches, fixing a minor bug and adding more tests.

Richard W.M. Jones rjones at fedoraproject.org
Fri Feb 21 12:50:58 UTC 2014


commit fe5a3ca24a9d3f2ea3d2488fa2950420b2503e0b
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Feb 21 12:47:00 2014 +0000

    Backport some upstream patches, fixing a minor bug and adding more tests.
    
    Also:
    - Enable the tests since kernel bug is fixed.

 ...NULL-pointer-to-asprintf-when-generating-.patch |   27 ++
 ...t-the-nbdkit-command-line-more-thoroughly.patch |  493 ++++++++++++++++++++
 nbdkit.spec                                        |   18 +-
 3 files changed, 534 insertions(+), 4 deletions(-)
---
diff --git a/0001-Don-t-pass-NULL-pointer-to-asprintf-when-generating-.patch b/0001-Don-t-pass-NULL-pointer-to-asprintf-when-generating-.patch
new file mode 100644
index 0000000..101555b
--- /dev/null
+++ b/0001-Don-t-pass-NULL-pointer-to-asprintf-when-generating-.patch
@@ -0,0 +1,27 @@
+From 030c5e2573faa84887b09b847bb48a280a698f1f Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Sun, 16 Feb 2014 12:55:48 +0000
+Subject: [PATCH 1/2] Don't pass NULL pointer to asprintf when generating --run
+ command.
+
+This fixes commit 4ce0dbc3f425e6d609cc6739dac8c23b44b1c61b.
+---
+ src/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/main.c b/src/main.c
+index 9c1c2f0..9dcd030 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -546,7 +546,7 @@ run_command (void)
+                 "port='%s'\n"
+                 "unixsocket='%s'\n"
+                 "%s",
+-                url, port, unixsocket, run);
++                url, port ? port : "", unixsocket ? unixsocket : "", run);
+   if (r == -1) {
+     perror ("asprintf");
+     exit (EXIT_FAILURE);
+-- 
+1.8.4.2
+
diff --git a/0002-tests-Test-the-nbdkit-command-line-more-thoroughly.patch b/0002-tests-Test-the-nbdkit-command-line-more-thoroughly.patch
new file mode 100644
index 0000000..0a61cb4
--- /dev/null
+++ b/0002-tests-Test-the-nbdkit-command-line-more-thoroughly.patch
@@ -0,0 +1,493 @@
+From 76d7450b5b5abea8781fbe99c0053bbd9704d247 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Sun, 16 Feb 2014 12:10:01 +0000
+Subject: [PATCH 2/2] tests: Test the nbdkit command line more thoroughly.
+
+---
+ tests/Makefile.am         | 28 ++++++++++++++--
+ tests/test-captive.sh     | 54 +++++++++++++++++++++++++++++++
+ tests/test-dump-config.sh | 41 ++++++++++++++++++++++++
+ tests/test-foreground.sh  | 80 ++++++++++++++++++++++++++++++++++++++++++++++
+ tests/test-help-plugin.sh | 41 ++++++++++++++++++++++++
+ tests/test-help.sh        | 41 ++++++++++++++++++++++++
+ tests/test-single.sh      | 40 +++++++++++++++++++++++
+ tests/test-start.sh       | 81 +++++++++++++++++++++++++++++++++++++++++++++++
+ 8 files changed, 403 insertions(+), 3 deletions(-)
+ create mode 100755 tests/test-captive.sh
+ create mode 100755 tests/test-dump-config.sh
+ create mode 100755 tests/test-foreground.sh
+ create mode 100755 tests/test-help-plugin.sh
+ create mode 100755 tests/test-help.sh
+ create mode 100755 tests/test-single.sh
+ create mode 100755 tests/test-start.sh
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 417cb3d..619bed2 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -33,9 +33,31 @@
+ CLEANFILES = *~
+ MAINTAINERCLEANFILES =
+ 
+-EXTRA_DIST = test.pl test.py
++EXTRA_DIST = \
++	test-captive.sh \
++	test-dump-config.sh \
++	test-foreground.sh \
++	test-help.sh \
++	test-help-plugin.sh \
++	test.pl \
++	test.py \
++	test-single.sh \
++	test-start.sh
++
++# Basic server command line and start-up tests.
++
++TESTS = \
++	test-help.sh \
++	test-help-plugin.sh \
++	test-dump-config.sh \
++	test-start.sh \
++	test-foreground.sh \
++	test-single.sh \
++	test-captive.sh
++
++# In-depth tests need libguestfs, since that is a convenient way to
++# drive qemu.
+ 
+-# Tests need libguestfs, since that is a convenient way to drive qemu.
+ if HAVE_LIBGUESTFS
+ 
+ # Use the 'direct' backend, and ensure maximum libguestfs debugging is
+@@ -52,7 +74,7 @@ libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
+ 
+ # Basic connection test.
+ check_PROGRAMS = test-connect
+-TESTS = test-connect
++TESTS += test-connect
+ check_DATA =
+ 
+ test_connect_SOURCES = test-connect.c test.h
+diff --git a/tests/test-captive.sh b/tests/test-captive.sh
+new file mode 100755
+index 0000000..5f18b5f
+--- /dev/null
++++ b/tests/test-captive.sh
+@@ -0,0 +1,54 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++set -x
++
++# Test nbdkit --run (captive nbdkit) option.
++
++rm -f captive.sock captive.out
++
++../src/nbdkit -U captive.sock \
++    ../plugins/example1/.libs/nbdkit-example1-plugin.so \
++    --run 'sleep 5; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket' > captive.out
++
++# Check the output.
++if [ "$(cat captive.out)" != "nbd=nbd:unix:$(pwd)/captive.sock
++port=
++socket=$(pwd)/captive.sock" ]; then
++    echo "$0: unexpected output"
++    cat captive.out
++    exit 1
++fi
++
++rm captive.sock captive.out
+diff --git a/tests/test-dump-config.sh b/tests/test-dump-config.sh
+new file mode 100755
+index 0000000..1ed7fb7
+--- /dev/null
++++ b/tests/test-dump-config.sh
+@@ -0,0 +1,41 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++
++output="$(../src/nbdkit --dump-config)"
++if [[ ! ( "$output" =~ ^libdir= ) ]]; then
++    echo "$0: unexpected output from nbdkit --dump-config"
++    echo "$output"
++    exit 1
++fi
+diff --git a/tests/test-foreground.sh b/tests/test-foreground.sh
+new file mode 100755
+index 0000000..daa733e
+--- /dev/null
++++ b/tests/test-foreground.sh
+@@ -0,0 +1,80 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++set -x
++
++# Test nbdkit -f option.
++
++rm -f foreground.pid foreground.sock
++
++../src/nbdkit \
++    -f -P foreground.pid -U foreground.sock \
++    ../plugins/example1/.libs/nbdkit-example1-plugin.so &
++bg_pid=$!
++
++# We may have to wait a short time for the pid file to appear.
++for i in `seq 1 10`; do
++    if test -f foreground.pid; then
++        break
++    fi
++    sleep 1
++done
++if ! test -f foreground.pid; then
++    echo "$0: PID file was not created"
++    exit 1
++fi
++
++pid="$(cat foreground.pid)"
++
++test "$bg_pid" -eq "$pid"
++
++# Check the socket was created (and is a socket).
++test -S foreground.sock
++
++# Kill the process.
++kill $pid
++
++# Check the process exits (eventually).
++for i in `seq 1 10`; do
++    if ! kill -s 0 $pid; then
++        break;
++    fi
++    sleep 1
++done
++if kill -s 0 $pid; then
++    echo "$0: process did not exit after sending a signal"
++    exit 1
++fi
++
++rm foreground.pid foreground.sock
+diff --git a/tests/test-help-plugin.sh b/tests/test-help-plugin.sh
+new file mode 100755
+index 0000000..dba1028
+--- /dev/null
++++ b/tests/test-help-plugin.sh
+@@ -0,0 +1,41 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++
++output="$(../src/nbdkit ../plugins/file/.libs/nbdkit-file-plugin.so --help)"
++if [[ ! ( "$output" =~ "nbdkit file plugin" ) ]]; then
++    echo "$0: unexpected output from nbdkit file --help"
++    echo "$output"
++    exit 1
++fi
+diff --git a/tests/test-help.sh b/tests/test-help.sh
+new file mode 100755
+index 0000000..299480b
+--- /dev/null
++++ b/tests/test-help.sh
+@@ -0,0 +1,41 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++
++output="$(../src/nbdkit --help)"
++if [[ ! ( "$output" =~ dump-config ) ]]; then
++    echo "$0: unexpected output from nbdkit --help"
++    echo "$output"
++    exit 1
++fi
+diff --git a/tests/test-single.sh b/tests/test-single.sh
+new file mode 100755
+index 0000000..ab0827d
+--- /dev/null
++++ b/tests/test-single.sh
+@@ -0,0 +1,40 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++set -x
++
++# Test nbdkit -s option.
++# XXX Not sure what is a really good test of this.
++
++../src/nbdkit -s ../plugins/example1/.libs/nbdkit-example1-plugin.so </dev/null
+diff --git a/tests/test-start.sh b/tests/test-start.sh
+new file mode 100755
+index 0000000..7422040
+--- /dev/null
++++ b/tests/test-start.sh
+@@ -0,0 +1,81 @@
++#!/bin/bash -
++# nbdkit
++# Copyright (C) 2014 Red Hat Inc.
++# All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are
++# met:
++#
++# * Redistributions of source code must retain the above copyright
++# notice, this list of conditions and the following disclaimer.
++#
++# * Redistributions in binary form must reproduce the above copyright
++# notice, this list of conditions and the following disclaimer in the
++# documentation and/or other materials provided with the distribution.
++#
++# * Neither the name of Red Hat nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++# SUCH DAMAGE.
++
++set -e
++set -x
++
++# Test nbdkit starts up, forks in the background, writes a PID file,
++# and can be killed.
++
++rm -f start.pid start.sock
++
++../src/nbdkit \
++    -P start.pid -U start.sock \
++    ../plugins/example1/.libs/nbdkit-example1-plugin.so
++
++# We may have to wait a short time for the pid file to appear.
++for i in `seq 1 10`; do
++    if test -f start.pid; then
++        break
++    fi
++    sleep 1
++done
++if ! test -f start.pid; then
++    echo "$0: PID file was not created"
++    exit 1
++fi
++
++pid="$(cat start.pid)"
++
++# Check the process exists.
++kill -s 0 $pid
++
++# Check the socket was created (and is a socket).
++test -S start.sock
++
++# Kill the process.
++kill $pid
++
++# Check the process exits (eventually).
++for i in `seq 1 10`; do
++    if ! kill -s 0 $pid; then
++        break;
++    fi
++    sleep 1
++done
++if kill -s 0 $pid; then
++    echo "$0: process did not exit after sending a signal"
++    exit 1
++fi
++
++rm start.pid start.sock
+-- 
+1.8.4.2
+
diff --git a/nbdkit.spec b/nbdkit.spec
index 7ef6185..059499b 100644
--- a/nbdkit.spec
+++ b/nbdkit.spec
@@ -2,13 +2,17 @@
 
 Name:           nbdkit
 Version:        1.1.6
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        NBD server
 
 License:        BSD
 URL:            https://github.com/libguestfs/nbdkit
 Source0:        http://libguestfs.org/download/nbdkit/%{name}-%{version}.tar.gz
 
+# Upstream patches, fixing a minor bug and adding more tests.
+Patch1: 0001-Don-t-pass-NULL-pointer-to-asprintf-when-generating-.patch
+Patch2: 0002-tests-Test-the-nbdkit-command-line-more-thoroughly.patch
+
 BuildRequires:  /usr/bin/pod2man
 BuildRequires:  libguestfs-devel
 BuildRequires:  libvirt-devel
@@ -147,6 +151,11 @@ plugins for %{name}.
 %prep
 %setup -q
 
+%patch1 -p1
+%patch2 -p1
+# Grrr 'patch' doesn't restore permissions:
+chmod +x tests/*.sh
+
 
 %build
 # Force immediate binding for hardened build for plugins.
@@ -164,14 +173,11 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
 
 
 %check
-# Completely disabled because Rawhide kernel is broken (RHBZ#991808).
-%if 0
 %if 0%{?fedora} >= 19
 # libguestfs 1.20 in Fedora 18 doesn't support NBD client protocol, so
 # the tests cannot be run.
 make check
 %endif
-%endif
 
 
 %files
@@ -241,6 +247,10 @@ make check
 
 
 %changelog
+* Fri Feb 21 2014 Richard W.M. Jones <rjones at redhat.com> - 1.1.6-2
+- Backport some upstream patches, fixing a minor bug and adding more tests.
+- Enable the tests since kernel bug is fixed.
+
 * Sun Feb 16 2014 Richard W.M. Jones <rjones at redhat.com> - 1.1.6-1
 - New upstream version 1.1.6.
 


More information about the scm-commits mailing list