Issue: #850. Windows/cygwin fixes to SVN:2942

This commit is contained in:
Robin Mills
2012-11-10 20:24:09 +00:00
parent f3f10c5992
commit 6d45927b69
3 changed files with 49 additions and 44 deletions
+45 -35
View File
@@ -1,30 +1,5 @@
#!/bin/bash
##
# locale setting
export LC_ALL=C
##
# initialize globals
this=$(basename $0 .sh)
here=$PWD
datapath="../data"
testdir="$here/tmp"
datadir="../data"
if [ -z "$EXIV2_BINDIR" ] ; then
bin="$here/../bin"
else
bin="$EXIV2_BINDIR"
fi
exe=$(uname)
if [ "${os:0:4}" == "CYGW" -o $exe==mingw ]; then
exe=.exe
else
unset exe
fi
##
# run a test
runTest()
@@ -228,7 +203,7 @@ iptcTest()
cp $datapath/$dst $test
#run tests
$bin/metacopy -ip $datapath/$src $test
runTest metacopy -ip $datapath/$src $test
#check results
diffCheck $test $good
@@ -242,7 +217,7 @@ diffCheck()
good=$2
#run diff and check results
diff -q --binary $test $good
diff -q --binary $diffargs $test $good
if [ $? -ne 0 ]; then
errors=`expr $errors + 1`
else
@@ -366,23 +341,59 @@ extendedTest()
}
##
# prepare temp files
# prepare temp files and other variables
prepareTest()
{
diffargs="--strip-trailing-cr"
good="$here/data/${this}.out"
results="$here/tmp/${this}.out"
##
# cygwin needs a private version of diff for linux compatibility
# locale setting
export LC_ALL=C
##
# initialize globals
this=$(basename $0 .sh)
here=$PWD
datapath="../data"
testdir="$here/tmp"
datadir="../data"
if [ -z "$EXIV2_BINDIR" ] ; then
bin="$here/../bin"
else
bin="$EXIV2_BINDIR"
fi
os=$(uname)
if [ "${os:0:4}" == "CYGW" ]; then
export "PATH=$PWD/../msvc:$PATH"
export PLATFORM=cygwin
else
export PLATFORM=$os
fi
if [ "$PLATFORM" == cygwin -o "$PLATFORM" == mingw ]; then
exe=.exe
fi
if [ "$PLATFORM" == cygwin -o "$PLATFORM" == mingw ]; then
# We need a private version of diff for linux compatibility
diff()
{
args=()
for i in "$@"; do
if [ ${i:0:1} != '-' ]; then
i="$(cygpath -aw $i)"
fi
args+=($i)
done
"$here/../msvc/diff$exe" ${args[@]}
}
fi
##
# figure out arguments for diff
diffargs="--strip-trailing-cr"
good="$here/data/${this}.out"
results="$here/tmp/${this}.out"
tmpfile=$here/tmp/$this
touch $tmpfile
diff -q $diffargs $tmpfile $tmpfile 2>/dev/null
@@ -403,7 +414,6 @@ prepareTest()
da2=""
fi
diffargs="$da1 $da2"
}
prepareTest
+3 -5
View File
@@ -1,8 +1,6 @@
#!/bin/bash
# Test driver for previews
# ----------------------------------------------------------------------
# Setup
source ./functions.source
( cd "$testdir"
@@ -128,14 +126,14 @@ source ./functions.source
done
done
) 3>&1 > "preview-test.out" 2>&1
) 3>&1 > "$testdir/preview-test.out" 2>&1
echo "."
# ----------------------------------------------------------------------
# Result
if ! diff -q $diffargs "../data/preview/preview-test.out" "preview-test.out" ; then
diff -u $diffargs "../data/preview/preview-test.out" "preview-test.out"
if ! diff -q $diffargs "$testdir/$datadir/preview/preview-test.out" "$testdir/preview-test.out" ; then
diff -u $diffargs "$testdir/$datadir/preview/preview-test.out" "$testdir/preview-test.out"
exit 1
fi
echo "All testcases passed."
+1 -4
View File
@@ -6,12 +6,8 @@
# video-matroska.mkv http://www.bunkus.org/videotools/mkvtoolnix/samples/vsshort-vorbis-subs.mkv
# video-quicktime.mp4 http://dev.exiv2.org/attachments/362/20100709_002.mp4
# ----------------------------------------------------------------------
# Setup
source ./functions.source
# ----------------------------------------------------------------------
# Tests
( cd "$testdir"
for file in ../data/video/video-*; do
@@ -36,6 +32,7 @@ source ./functions.source
fi
fi
done
) 3>&1 > "$testdir/video-test.out" 2>&1
echo "."