Signed-off-by: Matteo Cafasso <noxdafox(a)gmail.com>
---
tests/tsk/Makefile.am | 3 ++-
tests/tsk/test-filesystem-walk0.sh | 54 ++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
create mode 100755 tests/tsk/test-filesystem-walk0.sh
diff --git a/tests/tsk/Makefile.am b/tests/tsk/Makefile.am
index 80e8793..c7eac09 100644
--- a/tests/tsk/Makefile.am
+++ b/tests/tsk/Makefile.am
@@ -20,7 +20,8 @@ include $(top_srcdir)/subdir-rules.mk
TESTS = \
test-icat.sh \
test-blkcat.sh \
- test-blkls.sh
+ test-blkls.sh \
+ test-filesystem-walk0.sh
TESTS_ENVIRONMENT = $(top_builddir)/run --test
diff --git a/tests/tsk/test-filesystem-walk0.sh b/tests/tsk/test-filesystem-walk0.sh
new file mode 100755
index 0000000..c30eac2
--- /dev/null
+++ b/tests/tsk/test-filesystem-walk0.sh
@@ -0,0 +1,54 @@
+#!/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 filesystem-walk0 command.
+
+set -e
+
+if [ -n "$SKIP_TEST_FILESYSTEM_WALK0_SH" ]; then
+ echo "$0: test skipped because environment variable is set."
+ exit 77
+fi
+
+rm -f test-filesystem-walk0.bin
+
+# Skip if TSK is not supported by the appliance.
+if ! guestfish add /dev/null : run : available "libtsk"; then
+ echo "$0: skipped because TSK is not available in the appliance"
+ exit 77
+fi
+
+if [ ! -s ../../test-data/phony-guests/ubuntu.img ]; then
+ echo "$0: skipped because ubuntu.img is zero-sized"
+ exit 77
+fi
+
+# list content of disk image and store it into a file
+guestfish --ro -a ../../test-data/phony-guests/ubuntu.img <<EOF
+run
+filesystem-walk0 /dev/sda2 test-filesystem-walk0.bin
+EOF
+
+# test bin directory is in the list
+grep -q "bin" test-filesystem-walk0.bin
+if [ $? neq 0 ]; then
+ echo "$0: /bin not found in files list."
+ exit 1
+fi
+
+rm -f test-filesystem-walk0.bin
--
2.8.0.rc3