mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0014-Add-a-regression-test-of-tar-out-excludes-option-RHB.patch

022f11
From 93bc2c859a0d570f965ed38c91f7ffea5e802586 Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Thu, 29 Aug 2013 13:36:56 +0100
022f11
Subject: [PATCH] Add a regression test of tar-out excludes option
022f11
 (RHBZ#1001875).
022f11
022f11
(cherry picked from commit 1b34d6171bb4aaa1134a9d867918d7163cc7e069)
022f11
---
022f11
 tests/regressions/Makefile.am    |  1 +
022f11
 tests/regressions/rhbz1001875.sh | 66 ++++++++++++++++++++++++++++++++++++++++
022f11
 2 files changed, 67 insertions(+)
022f11
 create mode 100755 tests/regressions/rhbz1001875.sh
022f11
022f11
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
022f11
index 1cc307d..5b0d1c3 100644
022f11
--- a/tests/regressions/Makefile.am
022f11
+++ b/tests/regressions/Makefile.am
022f11
@@ -33,6 +33,7 @@ TESTS = \
022f11
 	rhbz914931 \
022f11
 	rhbz957772.sh \
022f11
 	rhbz975797.sh \
022f11
+	rhbz1001875.sh \
022f11
 	test-noexec-stack.pl
022f11
 
022f11
 tests_not_run = \
022f11
diff --git a/tests/regressions/rhbz1001875.sh b/tests/regressions/rhbz1001875.sh
022f11
new file mode 100755
022f11
index 0000000..b17ca78
022f11
--- /dev/null
022f11
+++ b/tests/regressions/rhbz1001875.sh
022f11
@@ -0,0 +1,66 @@
022f11
+#!/bin/bash -
022f11
+# libguestfs
022f11
+# Copyright (C) 2013 Red Hat Inc.
022f11
+#
022f11
+# This program is free software; you can redistribute it and/or modify
022f11
+# it under the terms of the GNU General Public License as published by
022f11
+# the Free Software Foundation; either version 2 of the License, or
022f11
+# (at your option) any later version.
022f11
+#
022f11
+# This program is distributed in the hope that it will be useful,
022f11
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
022f11
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
022f11
+# GNU General Public License for more details.
022f11
+#
022f11
+# You should have received a copy of the GNU General Public License
022f11
+# along with this program; if not, write to the Free Software
022f11
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
022f11
+
022f11
+# Regression test for:
022f11
+# https://bugzilla.redhat.com/show_bug.cgi?id=1001875
022f11
+# tar-out excludes option.
022f11
+
022f11
+set -e
022f11
+export LANG=C
022f11
+
022f11
+if [ -n "$SKIP_TEST_RHBZ1001875_SH" ]; then
022f11
+    echo "$0: test skipped because environment variable is set."
022f11
+    exit 77
022f11
+fi
022f11
+
022f11
+rm -f test1.img rhbz1001875-[123].tar
022f11
+
022f11
+../../fish/guestfish -N fs -m /dev/sda1 <
022f11
+touch /hello
022f11
+touch /world
022f11
+touch /helloworld
022f11
+tar-out / rhbz1001875-1.tar "excludes:hello"
022f11
+tar-out / rhbz1001875-2.tar "excludes:hello world"
022f11
+tar-out / rhbz1001875-3.tar "excludes:he* w*"
022f11
+EOF
022f11
+
022f11
+if [ "$(tar tf rhbz1001875-1.tar | sort)" != "./
022f11
+./helloworld
022f11
+./lost+found/
022f11
+./world" ]; then
022f11
+    echo "$0: unexpected output from #1 test:"
022f11
+    tar tf rhbz1001875-1.tar | sort
022f11
+    exit 1
022f11
+fi
022f11
+
022f11
+if [ "$(tar tf rhbz1001875-2.tar | sort)" != "./
022f11
+./helloworld
022f11
+./lost+found/" ]; then
022f11
+    echo "$0: unexpected output from #2 test:"
022f11
+    tar tf rhbz1001875-2.tar | sort
022f11
+    exit 1
022f11
+fi
022f11
+
022f11
+if [ "$(tar tf rhbz1001875-3.tar | sort)" != "./
022f11
+./lost+found/" ]; then
022f11
+    echo "$0: unexpected output from #3 test:"
022f11
+    tar tf rhbz1001875-3.tar | sort
022f11
+    exit 1
022f11
+fi
022f11
+
022f11
+rm test1.img rhbz1001875-[123].tar
022f11
-- 
022f11
1.8.3.1
022f11