X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=tests%2Ftests-common.sh;h=79a4a2f9ea4819178ba08523e2ad94ae7906d390;hp=c80dbefff38c75792a897fb48cf0773eeb10f2fd;hb=e485f32e610f77f15a298f62647d0cfb3cf8d11b;hpb=08a55221fc6904ceaf4bd1c0532eb03e792d5420 diff --git a/tests/tests-common.sh b/tests/tests-common.sh index c80dbeff..79a4a2f9 100644 --- a/tests/tests-common.sh +++ b/tests/tests-common.sh @@ -1,13 +1,10 @@ -srcdir="${srcdir:-.}/.." -srcdir="$(cd $srcdir; pwd)" - -if stat -c %i . ; then +if stat -c %i . &> /dev/null ; then BSD_STAT=0 else BSD_STAT=1 fi -get_inode_number() +get_inode_number() { if [ "$BSD_STAT" -eq 1 ]; then stat -f %i "$1" @@ -33,3 +30,32 @@ get_file_size() stat -c %s "$1" fi } + +imagex() +{ + echo "imagex $@" + if [[ $1 == info || $1 == mountrw ]]; then + ../../imagex "$@" + else + ../../imagex "$@" > /dev/null + fi +} + +wim_ctype() +{ + imagex info $1 | grep Compression | awk '{print $2}' +} + +default_cleanup() +{ + rm -rf $TEST_SUBDIR +} + +error() +{ + echo "****************************************************************" + echo " Test failure " + echo $* + echo "****************************************************************" + exit 1 +}