[Libguestfs] [PATCH 4/4] Add regression test to test funny filenames (RHBZ#811649).

Richard W.M. Jones rjones at redhat.com
Thu Apr 12 18:34:53 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

---
 tests/regressions/Makefile.am   |    1 +
 tests/regressions/rhbz811649.sh |   49 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100755 tests/regressions/rhbz811649.sh

diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index a2a3673..3027cd8 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -28,6 +28,7 @@ TESTS = \
 	rhbz690819.sh \
 	rhbz789960.sh \
 	rhbz790721 \
+	rhbz811649.sh \
 	test-noexec-stack.pl
 
 tests_not_run = \
diff --git a/tests/regressions/rhbz811649.sh b/tests/regressions/rhbz811649.sh
new file mode 100755
index 0000000..1d0e56a
--- /dev/null
+++ b/tests/regressions/rhbz811649.sh
@@ -0,0 +1,49 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2012 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=811649
+# Test filenames containing a variety of characters.
+
+set -e
+export LANG=C
+
+declare -a filenames
+filenames[0]=' '
+filenames[1]=','
+filenames[2]='='
+filenames[3]='水'
+filenames[4]='-'
+filenames[5]='-hda'
+#filenames[6]=':'     # a future version of qemu may allow colon
+#filenames[7]='http:'
+#filenames[8]='file:'
+#filenames[9]='raw:'
+
+rm -f -- test1.img "${filenames[@]}"
+
+truncate -s 10M test1.img
+
+for f in "${filenames[@]}"; do
+    ln -- test1.img "$f"
+    guestfish <<EOF
+add "$f"
+run
+EOF
+done
+
+rm -f -- test1.img "${filenames[@]}"
-- 
1.7.9.3




More information about the Libguestfs mailing list