[Libguestfs] [PATCH] tests: move ntfs tests in a single directory

Pino Toscano ptoscano at redhat.com
Tue Mar 1 13:22:24 UTC 2016


Move test-ntfscat.sh and test-ntfsclone.sh in a single ntfs directory,
much like the tests for other filesystems.
---
 Makefile.am                       |  3 +-
 configure.ac                      |  3 +-
 tests/ntfs/Makefile.am            | 27 +++++++++++++++++
 tests/ntfs/test-ntfscat.sh        | 53 +++++++++++++++++++++++++++++++++
 tests/ntfs/test-ntfsclone.sh      | 62 +++++++++++++++++++++++++++++++++++++++
 tests/ntfscat/Makefile.am         | 26 ----------------
 tests/ntfscat/test-ntfscat.sh     | 53 ---------------------------------
 tests/ntfsclone/Makefile.am       | 26 ----------------
 tests/ntfsclone/test-ntfsclone.sh | 62 ---------------------------------------
 9 files changed, 144 insertions(+), 171 deletions(-)
 create mode 100644 tests/ntfs/Makefile.am
 create mode 100755 tests/ntfs/test-ntfscat.sh
 create mode 100755 tests/ntfs/test-ntfsclone.sh
 delete mode 100644 tests/ntfscat/Makefile.am
 delete mode 100755 tests/ntfscat/test-ntfscat.sh
 delete mode 100644 tests/ntfsclone/Makefile.am
 delete mode 100755 tests/ntfsclone/test-ntfsclone.sh

diff --git a/Makefile.am b/Makefile.am
index 1ab85e8..fe92630 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,8 +65,7 @@ SUBDIRS += tests/lvm
 SUBDIRS += tests/luks
 SUBDIRS += tests/md
 SUBDIRS += tests/selinux
-SUBDIRS += tests/ntfsclone
-SUBDIRS += tests/ntfscat
+SUBDIRS += tests/ntfs
 SUBDIRS += tests/btrfs
 SUBDIRS += tests/xfs
 SUBDIRS += tests/charsets
diff --git a/configure.ac b/configure.ac
index 0a759fe..fd8e534 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,8 +271,7 @@ AC_CONFIG_FILES([Makefile
                  tests/mountable/Makefile
                  tests/nbd/Makefile
                  tests/network/Makefile
-                 tests/ntfsclone/Makefile
-                 tests/ntfscat/Makefile
+                 tests/ntfs/Makefile
                  tests/parallel/Makefile
                  tests/protocol/Makefile
                  tests/qemu/Makefile
diff --git a/tests/ntfs/Makefile.am b/tests/ntfs/Makefile.am
new file mode 100644
index 0000000..8b8fd95
--- /dev/null
+++ b/tests/ntfs/Makefile.am
@@ -0,0 +1,27 @@
+# libguestfs
+# Copyright (C) 2012-2016 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.
+
+include $(top_srcdir)/subdir-rules.mk
+
+TESTS = \
+	test-ntfscat.sh \
+	test-ntfsclone.sh
+
+TESTS_ENVIRONMENT = $(top_builddir)/run --test
+
+EXTRA_DIST = \
+	$(TESTS)
diff --git a/tests/ntfs/test-ntfscat.sh b/tests/ntfs/test-ntfscat.sh
new file mode 100755
index 0000000..5cfdd95
--- /dev/null
+++ b/tests/ntfs/test-ntfscat.sh
@@ -0,0 +1,53 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2016 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.
+
+# Test the ntfscat-i command.
+
+set -e
+
+if [ -n "$SKIP_TEST_NTFSCAT_SH" ]; then
+    echo "$0: test skipped because environment variable is set."
+    exit 77
+fi
+
+rm -f test-mft.bin
+
+# Skip if ntfs-3g is not supported by the appliance.
+if ! guestfish add /dev/null : run : available "ntfs3g"; then
+    echo "$0: skipped because ntfs-3g is not supported by the appliance"
+    exit 77
+fi
+
+if [ ! -s ../../test-data/phony-guests/windows.img ]; then
+    echo "$0: skipped because windows.img is zero-sized"
+    exit 77
+fi
+
+# download Master File Table ($MFT).
+guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
+run
+ntfscat-i /dev/sda2 0 test-mft.bin
+EOF
+
+# test extracted file is the Master File Table
+if [ `head -c 5 test-mft.bin` != "FILE0" ]; then
+    echo "$0: wrong file extracted."
+    exit 1
+fi
+
+rm -f test-mft.bin
diff --git a/tests/ntfs/test-ntfsclone.sh b/tests/ntfs/test-ntfsclone.sh
new file mode 100755
index 0000000..668ed8a
--- /dev/null
+++ b/tests/ntfs/test-ntfsclone.sh
@@ -0,0 +1,62 @@
+#!/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.
+
+# Test the ntfsclone-in/-out commands.
+
+set -e
+
+if [ -n "$SKIP_TEST_NTFSCLONE_SH" ]; then
+    echo "$0: test skipped because environment variable is set."
+    exit 77
+fi
+
+rm -f test-ntfsclone.img ntfsclone-backup1 ntfsclone-backup2
+
+# Skip if ntfs-3g is not supported by the appliance.
+if ! guestfish add /dev/null : run : available "ntfs3g"; then
+    echo "$0: skipped because ntfs-3g is not supported by the appliance"
+    exit 77
+fi
+
+if [ ! -s ../../test-data/phony-guests/windows.img ]; then
+    echo "$0: skipped because windows.img is zero-sized"
+    exit 77
+fi
+
+# Export the filesystems to the backup file.
+guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
+run
+ntfsclone-out /dev/sda1 ntfsclone-backup1 preservetimestamps:true force:true
+ntfsclone-out /dev/sda2 ntfsclone-backup2 metadataonly:true ignorefscheck:true
+EOF
+
+# Restore to another disk image.
+output=$(guestfish -N test-ntfsclone.img=part:300M <<EOF
+ntfsclone-in ntfsclone-backup1 /dev/sda1
+vfs-type /dev/sda1
+EOF
+)
+
+if [ "$output" != "ntfs" ]; then
+    echo "$0: unexpected filesystem type after restore: $output"
+    exit 1
+fi
+
+#ls -lh ntfsclone-backup[12]
+
+rm test-ntfsclone.img ntfsclone-backup1 ntfsclone-backup2
diff --git a/tests/ntfscat/Makefile.am b/tests/ntfscat/Makefile.am
deleted file mode 100644
index dc64c3d..0000000
--- a/tests/ntfscat/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-# libguestfs
-# Copyright (C) 2016 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.
-
-include $(top_srcdir)/subdir-rules.mk
-
-TESTS = \
-	test-ntfscat.sh
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-EXTRA_DIST = \
-	$(TESTS)
diff --git a/tests/ntfscat/test-ntfscat.sh b/tests/ntfscat/test-ntfscat.sh
deleted file mode 100755
index 5cfdd95..0000000
--- a/tests/ntfscat/test-ntfscat.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash -
-# libguestfs
-# Copyright (C) 2016 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.
-
-# Test the ntfscat-i command.
-
-set -e
-
-if [ -n "$SKIP_TEST_NTFSCAT_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
-rm -f test-mft.bin
-
-# Skip if ntfs-3g is not supported by the appliance.
-if ! guestfish add /dev/null : run : available "ntfs3g"; then
-    echo "$0: skipped because ntfs-3g is not supported by the appliance"
-    exit 77
-fi
-
-if [ ! -s ../../test-data/phony-guests/windows.img ]; then
-    echo "$0: skipped because windows.img is zero-sized"
-    exit 77
-fi
-
-# download Master File Table ($MFT).
-guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
-run
-ntfscat-i /dev/sda2 0 test-mft.bin
-EOF
-
-# test extracted file is the Master File Table
-if [ `head -c 5 test-mft.bin` != "FILE0" ]; then
-    echo "$0: wrong file extracted."
-    exit 1
-fi
-
-rm -f test-mft.bin
diff --git a/tests/ntfsclone/Makefile.am b/tests/ntfsclone/Makefile.am
deleted file mode 100644
index 80795c5..0000000
--- a/tests/ntfsclone/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-include $(top_srcdir)/subdir-rules.mk
-
-TESTS = \
-	test-ntfsclone.sh
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-EXTRA_DIST = \
-	$(TESTS)
diff --git a/tests/ntfsclone/test-ntfsclone.sh b/tests/ntfsclone/test-ntfsclone.sh
deleted file mode 100755
index 668ed8a..0000000
--- a/tests/ntfsclone/test-ntfsclone.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/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.
-
-# Test the ntfsclone-in/-out commands.
-
-set -e
-
-if [ -n "$SKIP_TEST_NTFSCLONE_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
-rm -f test-ntfsclone.img ntfsclone-backup1 ntfsclone-backup2
-
-# Skip if ntfs-3g is not supported by the appliance.
-if ! guestfish add /dev/null : run : available "ntfs3g"; then
-    echo "$0: skipped because ntfs-3g is not supported by the appliance"
-    exit 77
-fi
-
-if [ ! -s ../../test-data/phony-guests/windows.img ]; then
-    echo "$0: skipped because windows.img is zero-sized"
-    exit 77
-fi
-
-# Export the filesystems to the backup file.
-guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
-run
-ntfsclone-out /dev/sda1 ntfsclone-backup1 preservetimestamps:true force:true
-ntfsclone-out /dev/sda2 ntfsclone-backup2 metadataonly:true ignorefscheck:true
-EOF
-
-# Restore to another disk image.
-output=$(guestfish -N test-ntfsclone.img=part:300M <<EOF
-ntfsclone-in ntfsclone-backup1 /dev/sda1
-vfs-type /dev/sda1
-EOF
-)
-
-if [ "$output" != "ntfs" ]; then
-    echo "$0: unexpected filesystem type after restore: $output"
-    exit 1
-fi
-
-#ls -lh ntfsclone-backup[12]
-
-rm test-ntfsclone.img ntfsclone-backup1 ntfsclone-backup2
-- 
2.5.0




More information about the Libguestfs mailing list