From ac0d2adf56afd4870c9f2a346dc1b2c1f14f39cc Mon Sep 17 00:00:00 2001 From: Matteo Cafasso Date: Mon, 7 Mar 2016 21:22:20 +0200 Subject: [PATCH] added icat API tests Signed-off-by: Matteo Cafasso --- Makefile.am | 1 + configure.ac | 1 + tests/tsk/Makefile.am | 26 +++++++++++++++++++++ tests/tsk/test-icat.sh | 53 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 tests/tsk/Makefile.am create mode 100755 tests/tsk/test-icat.sh diff --git a/Makefile.am b/Makefile.am index fe9263015..42ff07291 100644 --- a/Makefile.am +++ b/Makefile.am @@ -83,6 +83,7 @@ SUBDIRS += tests/journal SUBDIRS += tests/relative-paths SUBDIRS += tests/gdisk SUBDIRS += tests/regressions +SUBDIRS += tests/tsk endif # libguestfs-test-tool diff --git a/configure.ac b/configure.ac index 4c964696b..ff9618748 100644 --- a/configure.ac +++ b/configure.ac @@ -282,6 +282,7 @@ AC_CONFIG_FILES([Makefile tests/selinux/Makefile tests/syslinux/Makefile tests/tmpdirs/Makefile + tests/tsk/Makefile tests/xfs/Makefile tests/xml/Makefile tools/Makefile diff --git a/tests/tsk/Makefile.am b/tests/tsk/Makefile.am new file mode 100644 index 000000000..e060e5874 --- /dev/null +++ b/tests/tsk/Makefile.am @@ -0,0 +1,26 @@ +# 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-icat.sh + +TESTS_ENVIRONMENT = $(top_builddir)/run --test + +EXTRA_DIST = \ + $(TESTS) diff --git a/tests/tsk/test-icat.sh b/tests/tsk/test-icat.sh new file mode 100755 index 000000000..e1fdc5afc --- /dev/null +++ b/tests/tsk/test-icat.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 icat command. + +set -e + +if [ -n "$SKIP_TEST_ICAT_SH" ]; then + echo "$0: test skipped because environment variable is set." + exit 77 +fi + +rm -f test-mft.bin + +# Skip if TSK is not supported by the appliance. +if ! guestfish add /dev/null : run : available "icat"; then + echo "$0: skipped because TSK is not available in 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 <