X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=tests%2Ftest-imagex-ntfs;h=45404d17a15a0dfdd50f1adabe91e00811465009;hp=dbfd10a7342cb77e7ae83f1e23f000dc621e4367;hb=0ce54d08c0b1c56f37ea2998acd6847da7ced8a2;hpb=a04b98b2b4f8823d5f6473584c0b4cb7506edc87 diff --git a/tests/test-imagex-ntfs b/tests/test-imagex-ntfs index dbfd10a7..45404d17 100755 --- a/tests/test-imagex-ntfs +++ b/tests/test-imagex-ntfs @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script does some sanity testing of the 'imagex' program, specifically # checking the NTFS capture and apply features. @@ -9,20 +9,20 @@ # remain mounted. set -e -srcdir=${srcdir:-.} -srcdir=`realpath $srcdir` cd tests +. tests-common.sh imagex() { ../imagex $@ > /dev/null } __do_unmount() { - if ! fusermount -u $1; then + if ! fusermount -z -u $1; then error "Failed to unmount \"$1\"" fi } + do_unmount() { if mountpoint $1 &> /dev/null; then __do_unmount $1 @@ -31,8 +31,15 @@ do_unmount() { __do_mount() { options="$3" - if ! ntfs-3g ${options:+-o $options} $1 $2; then - error "Could not mount NTFS volume \"$1\" on \"$2\". Make sure ntfs-3g is installed." + if [ -z "$options" ]; then + options="no_def_opts,silent" + else + options="$options,no_def_opts,silent" + fi + if ! ntfs-3g -o $options $1 $2; then + error "Could not mount NTFS volume \"$1\" on \"$2\"! Make sure ntfs-3g is "\ + "installed, and that you are either running the tests as root or have ntfs-3g "\ + "installed setuid root, so that we can mount a NTFS volume." fi } @@ -43,7 +50,7 @@ do_mount() { do_mkntfs() { if ! mkntfs --force --fast $1 &> /dev/null; then - error "Could not create NTFS volume on \"$1\". Make sure ntfs-3g / ntfsprogs are installed" + error "Could not create NTFS volume \"$1\"! Make sure ntfsprogs are installed." fi } @@ -68,7 +75,10 @@ cleanup() { error() { echo "****************************************************************" echo " Test failure " - echo $* + while [ $# -gt 0 ]; do + echo $1 + shift + done echo "****************************************************************" exit 1 } @@ -189,7 +199,7 @@ do_test 'echo 1 > file; setfattr -n user.aa -v 1111 file; setfattr -n user.aaa -v 1111 file; setfattr -n user.aaaa -v 1111 file;' - + msg "file with named data streams with same contents as other file" do_test 'echo -n > file; setfattr -n user.a -v 1111 file; @@ -226,7 +236,7 @@ do_test 'touch file; touch file2; setfattr -n system.ntfs_acl -v 0s`cat $srcdir/tests/security_descriptor_1.base64` file setfattr -n system.ntfs_acl -v 0s`cat $srcdir/tests/security_descriptor_2.base64` file' - + msg "files with different security descriptors and some with the same security descriptor" do_test 'touch file; touch file2;