Merge pull request #1221 from Exiv2/fix_1219_msvc_test_0.27
fix_1219_msvc_test_0.27
This commit is contained in:
commit
406da658f3
@ -148,7 +148,8 @@ python_tests:
|
|||||||
@echo
|
@echo
|
||||||
@echo ---- Running python_tests ----
|
@echo ---- Running python_tests ----
|
||||||
@echo
|
@echo
|
||||||
-( . functions.source ; cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose )
|
@echo bash -c " . functions.source ; cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose "
|
||||||
|
@bash -c " . functions.source ; cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose "
|
||||||
|
|
||||||
mostlyclean clean:
|
mostlyclean clean:
|
||||||
rm -rf $(top_srcdir)/test/tmp/*
|
rm -rf $(top_srcdir)/test/tmp/*
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
# Test driver for CRW file operations
|
# Test driver for CRW file operations
|
||||||
|
|
||||||
source ./functions.source
|
source ./functions.source
|
||||||
( cd "$testdir"
|
(
|
||||||
|
cd "$testdir"
|
||||||
crwfile=exiv2-canon-powershot-s40.crw
|
crwfile=exiv2-canon-powershot-s40.crw
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Testcases: Add and modify tags
|
# Testcases: Add and modify tags
|
||||||
@ -31,7 +31,7 @@ source ./functions.source
|
|||||||
runTest exiv2 -v -M'del Exif.Canon.OwnerName' $crwfile
|
runTest exiv2 -v -M'del Exif.Canon.OwnerName' $crwfile
|
||||||
runTest exiv2 -v -pt $crwfile
|
runTest exiv2 -v -pt $crwfile
|
||||||
|
|
||||||
) 3>&1 > $results
|
) 2>&1 | sed -e 's#19:54#18:54#g' > $results # sed evades TZ issue on MSVC builds #1221
|
||||||
|
|
||||||
reportTest
|
reportTest
|
||||||
|
|
||||||
|
|||||||
@ -8,66 +8,66 @@
|
|||||||
# run a test
|
# run a test
|
||||||
runTest()
|
runTest()
|
||||||
{
|
{
|
||||||
local prog=$1
|
local prog=$1
|
||||||
shift
|
shift
|
||||||
(
|
(
|
||||||
mkdir -p $here/tmp
|
mkdir -p $here/tmp
|
||||||
cd $here/tmp
|
cd $here/tmp
|
||||||
if [ ! -z $EXIV2_ECHO ]; then
|
if [ ! -z $EXIV2_ECHO ]; then
|
||||||
echoTest $VALGRIND $bin$prog$exe "$@"
|
echoTest $VALGRIND $bin$prog$exe "$@"
|
||||||
fi
|
fi
|
||||||
$VALGRIND $bin$prog$exe "$@"
|
$VALGRIND $bin$prog$exe "$@"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# echo commands and arguments
|
# echo commands and arguments
|
||||||
echoTest()
|
echoTest()
|
||||||
{
|
{
|
||||||
local count=1
|
local count=1
|
||||||
for i in $@ ; do
|
for i in $@ ; do
|
||||||
echo $((count++)): $i
|
echo $((count++)): $i
|
||||||
done
|
done
|
||||||
echo -----------------------
|
echo -----------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# predictate
|
# predictate
|
||||||
existsTest()
|
existsTest()
|
||||||
{
|
{
|
||||||
local prog=$1
|
local prog=$1
|
||||||
result=0
|
result=0
|
||||||
if [ -z "$bin" ]; then
|
if [ -z "$bin" ]; then
|
||||||
if [ ! -z $(which $prog) ]; then
|
if [ ! -z $(which $prog) ]; then
|
||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -e $bin$prog -o -e $bin$prog$exe ]; then
|
if [ -e $bin$prog -o -e $bin$prog$exe ]; then
|
||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo $result
|
echo $result
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# copy file (used by conversions.sh)
|
# copy file (used by conversions.sh)
|
||||||
copy()
|
copy()
|
||||||
{
|
{
|
||||||
\cp "$1" "$2"
|
\cp "$1" "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# copy file from data to tmp (copyTestFile from to)
|
# copy file from data to tmp (copyTestFile from to)
|
||||||
copyTestFile()
|
copyTestFile()
|
||||||
{
|
{
|
||||||
if [ $# == 2 ]; then
|
if [ $# == 2 ]; then
|
||||||
cp -f "$here/data/$1" "$here/tmp/$2"
|
cp -f "$here/data/$1" "$here/tmp/$2"
|
||||||
elif [ $# == 1 ]; then
|
elif [ $# == 1 ]; then
|
||||||
stub=$(basename $1)
|
stub=$(basename $1)
|
||||||
cp -f "$here/data/$1" "$here/tmp/$stub"
|
cp -f "$here/data/$1" "$here/tmp/$stub"
|
||||||
else
|
else
|
||||||
echo "*** error copyTestFile: illegal number of inputs = $# ***"
|
echo "*** error copyTestFile: illegal number of inputs = $# ***"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,196 +75,196 @@ copyTestFile()
|
|||||||
# copy 1 or more files from data to tmp
|
# copy 1 or more files from data to tmp
|
||||||
copyTestFiles()
|
copyTestFiles()
|
||||||
{
|
{
|
||||||
for i in "$@" ; do
|
for i in "$@" ; do
|
||||||
copyTestFile "$i" "$i"
|
copyTestFile "$i" "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# result analysis
|
# result analysis
|
||||||
reportTest()
|
reportTest()
|
||||||
{
|
{
|
||||||
cat $results | tr '\\' '/' > ${results}-new
|
cat $results | tr '\\' '/' > ${results}-new
|
||||||
mv -f ${results}-new $results
|
mv -f ${results}-new $results
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
lhs=$results
|
lhs=$results
|
||||||
rhs=$good
|
rhs=$good
|
||||||
else
|
else
|
||||||
if [ $# -eq 3 ] ; then
|
if [ $# -eq 3 ] ; then
|
||||||
diffargs=$1
|
diffargs=$1
|
||||||
lhs=$2
|
lhs=$2
|
||||||
rhs=$3
|
rhs=$3
|
||||||
else
|
else
|
||||||
lhs=$1
|
lhs=$1
|
||||||
rhs=$2
|
rhs=$2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
diff $diffargs $lhs $rhs
|
diff $diffargs $lhs $rhs
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -eq 0 ] ; then
|
if [ $rc -eq 0 ] ; then
|
||||||
echo "all testcases passed."
|
echo "all testcases passed."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# moved here from write-test.sh
|
# moved here from write-test.sh
|
||||||
# Function:
|
# Function:
|
||||||
# runTestCase number file
|
# runTestCase number file
|
||||||
# Params:
|
# Params:
|
||||||
# number: Test case number
|
# number: Test case number
|
||||||
# file : Input file
|
# file : Input file
|
||||||
# Abstract:
|
# Abstract:
|
||||||
# Run the requested test case number with the given file
|
# Run the requested test case number with the given file
|
||||||
runTestCase()
|
runTestCase()
|
||||||
{
|
{
|
||||||
rtc_number=$1
|
rtc_number=$1
|
||||||
rtc_infile=$2
|
rtc_infile=$2
|
||||||
|
|
||||||
rtc_outfile=test${rtc_number}.jpg
|
rtc_outfile=test${rtc_number}.jpg
|
||||||
rtc_jpgthumb=thumb${rtc_number}.jpg
|
rtc_jpgthumb=thumb${rtc_number}.jpg
|
||||||
rtc_tifthumb=thumb${rtc_number}.tif
|
rtc_tifthumb=thumb${rtc_number}.tif
|
||||||
|
|
||||||
rm -f $rtc_outfile $rtc_jpgthumb $rtc_tifthumb
|
rm -f $rtc_outfile $rtc_jpgthumb $rtc_tifthumb
|
||||||
rm -f iii ttt;
|
rm -f iii ttt;
|
||||||
|
|
||||||
echo "------------------------------------------------------------"
|
echo "------------------------------------------------------------"
|
||||||
runTest exifprint $rtc_infile > iii;
|
runTest exifprint $rtc_infile > iii;
|
||||||
cp $rtc_infile $rtc_outfile;
|
cp $rtc_infile $rtc_outfile;
|
||||||
runTest write-test $rtc_infile $rtc_number > ttt;
|
runTest write-test $rtc_infile $rtc_number > ttt;
|
||||||
diff $diffargs iii ttt
|
diff $diffargs iii ttt
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# moved here from imagetest.sh
|
# moved here from imagetest.sh
|
||||||
eraseTest()
|
eraseTest()
|
||||||
{
|
{
|
||||||
src=$1
|
src=$1
|
||||||
test=${src}.etst
|
test=${src}.etst
|
||||||
good=$datapath/${src}.egd
|
good=$datapath/${src}.egd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$src $test
|
cp $datapath/$src $test
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
${bin}metacopy $test $test
|
${bin}metacopy $test $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
}
|
}
|
||||||
|
|
||||||
copyTest()
|
copyTest()
|
||||||
{
|
{
|
||||||
num=$1 # case number
|
num=$1 # case number
|
||||||
src=$2 # input file
|
src=$2 # input file
|
||||||
dst=$3 # copy to hear
|
dst=$3 # copy to hear
|
||||||
test=${dst}.c${num}tst
|
test=${dst}.c${num}tst
|
||||||
good=$datapath/${dst}.c${num}gd
|
good=$datapath/${dst}.c${num}gd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$dst $test
|
cp $datapath/$dst $test
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
${bin}metacopy -a $datapath/$src $test
|
${bin}metacopy -a $datapath/$src $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
}
|
}
|
||||||
|
|
||||||
iptcTest()
|
iptcTest()
|
||||||
{
|
{
|
||||||
num=$1 # case number
|
num=$1 # case number
|
||||||
src=$2 # input file
|
src=$2 # input file
|
||||||
dst=$3 # copy to hear
|
dst=$3 # copy to hear
|
||||||
test=${dst}.i${num}tst
|
test=${dst}.i${num}tst
|
||||||
good=$datapath/${dst}.i${num}gd
|
good=$datapath/${dst}.i${num}gd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$dst $test
|
cp $datapath/$dst $test
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest metacopy -ip $datapath/$src $test
|
runTest metacopy -ip $datapath/$src $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# Make sure to pass the test file first and the known good file second
|
# Make sure to pass the test file first and the known good file second
|
||||||
diffCheck()
|
diffCheck()
|
||||||
{
|
{
|
||||||
test=$(real_path $1)
|
test=$(real_path $1)
|
||||||
good=$(real_path $2)
|
good=$(real_path $2)
|
||||||
if [ -z "$errors" ]; then let -a errors=0; fi
|
if [ -z "$errors" ]; then let -a errors=0; fi
|
||||||
|
|
||||||
#run diff and check results
|
#run diff and check results
|
||||||
if [ $PLATFORM == SunOS ]; then
|
if [ $PLATFORM == SunOS ]; then
|
||||||
bdiff $diffargs "$test" "$good"
|
bdiff $diffargs "$test" "$good"
|
||||||
elif [ $PLATFORM == FreeBSD -o $PLATFORM == NetBSD ]; then
|
elif [ $PLATFORM == FreeBSD -o $PLATFORM == NetBSD ]; then
|
||||||
diff $diffargs "$test" "$good"
|
diff $diffargs "$test" "$good"
|
||||||
else
|
else
|
||||||
diff --binary $diffargs "$test" "$good"
|
diff --binary $diffargs "$test" "$good"
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
errors=$(expr $errors + 1)
|
errors=$(expr $errors + 1)
|
||||||
else
|
else
|
||||||
rm $test
|
rm $test
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# moved here from iotest.sh
|
# moved here from iotest.sh
|
||||||
ioTest()
|
ioTest()
|
||||||
{
|
{
|
||||||
src=$datapath/$1
|
src=$datapath/$1
|
||||||
out1=${1}.1
|
out1=${1}.1
|
||||||
out2=${1}.2
|
out2=${1}.2
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest iotest $src $out1 $out2
|
runTest iotest $src $out1 $out2
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
errors=`expr $errors + 1`
|
errors=`expr $errors + 1`
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $out1 $src
|
diffCheck $out1 $src
|
||||||
diffCheck $out2 $src
|
diffCheck $out2 $src
|
||||||
printf "."
|
printf "."
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# moved here from iptctest.sh
|
# moved here from iptctest.sh
|
||||||
printTest()
|
printTest()
|
||||||
{
|
{
|
||||||
src=$1
|
src=$1
|
||||||
test=${src}.iptst
|
test=${src}.iptst
|
||||||
good=$datapath/${src}.ipgd
|
good=$datapath/${src}.ipgd
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest iptcprint $datapath/$src > $test
|
runTest iptcprint $datapath/$src > $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTest()
|
removeTest()
|
||||||
{
|
{
|
||||||
src=$1
|
src=$1
|
||||||
tmp="temp"
|
tmp="temp"
|
||||||
test=${src}.irtst
|
test=${src}.irtst
|
||||||
good=$datapath/${src}.irgd
|
good=$datapath/${src}.irgd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$src $tmp
|
cp $datapath/$src $tmp
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest iptctest $tmp <<-eoc
|
runTest iptctest $tmp <<-eoc
|
||||||
r Iptc.Application2.Byline
|
r Iptc.Application2.Byline
|
||||||
r Iptc.Application2.Caption
|
r Iptc.Application2.Caption
|
||||||
r Iptc.Application2.Keywords
|
r Iptc.Application2.Keywords
|
||||||
@ -272,26 +272,26 @@ removeTest()
|
|||||||
r Iptc.Application2.Keywords
|
r Iptc.Application2.Keywords
|
||||||
r Iptc.Application2.CountryName
|
r Iptc.Application2.CountryName
|
||||||
eoc
|
eoc
|
||||||
runTest iptcprint $tmp > $test
|
runTest iptcprint $tmp > $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
rm $tmp
|
rm $tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
addModTest()
|
addModTest()
|
||||||
{
|
{
|
||||||
src=$1
|
src=$1
|
||||||
tmp="temp"
|
tmp="temp"
|
||||||
test=${src}.iatst
|
test=${src}.iatst
|
||||||
good=$datapath/${src}.iagd
|
good=$datapath/${src}.iagd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$src $tmp
|
cp $datapath/$src $tmp
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest iptctest $tmp <<-eoc
|
runTest iptctest $tmp <<-eoc
|
||||||
a Iptc.Application2.Headline The headline I am
|
a Iptc.Application2.Headline The headline I am
|
||||||
a Iptc.Application2.Keywords Yet another keyword
|
a Iptc.Application2.Keywords Yet another keyword
|
||||||
m Iptc.Application2.DateCreated 2004-8-3
|
m Iptc.Application2.DateCreated 2004-8-3
|
||||||
@ -301,205 +301,209 @@ addModTest()
|
|||||||
a Iptc.Envelope.TimeSent 14:41:0-05:00
|
a Iptc.Envelope.TimeSent 14:41:0-05:00
|
||||||
a Iptc.Application2.RasterizedCaption 230 42 34 2 90 84 23 146
|
a Iptc.Application2.RasterizedCaption 230 42 34 2 90 84 23 146
|
||||||
eoc
|
eoc
|
||||||
runTest iptcprint $tmp > $test
|
runTest iptcprint $tmp > $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
rm $tmp
|
rm $tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
extendedTest()
|
extendedTest()
|
||||||
{
|
{
|
||||||
src=$1
|
src=$1
|
||||||
tmp="temp"
|
tmp="temp"
|
||||||
test=${src}.ixtst
|
test=${src}.ixtst
|
||||||
good=$datapath/${src}.ixgd
|
good=$datapath/${src}.ixgd
|
||||||
|
|
||||||
#setup
|
#setup
|
||||||
cp $datapath/$src $tmp
|
cp $datapath/$src $tmp
|
||||||
|
|
||||||
#run tests
|
#run tests
|
||||||
runTest iptctest $tmp < $datapath/ext.dat
|
runTest iptctest $tmp < $datapath/ext.dat
|
||||||
runTest iptcprint $tmp > $test
|
runTest iptcprint $tmp > $test
|
||||||
|
|
||||||
#check results
|
#check results
|
||||||
diffCheck $test $good
|
diffCheck $test $good
|
||||||
printf "."
|
printf "."
|
||||||
rm $tmp
|
rm $tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
hardLinkFiles()
|
hardLinkFiles()
|
||||||
{
|
{
|
||||||
target="$1"
|
target="$1"
|
||||||
shift
|
shift
|
||||||
for var; do
|
for var; do
|
||||||
if [ -e $var ]; then rm -rf $var ; fi
|
if [ -e $var ]; then rm -rf $var ; fi
|
||||||
ln $target $var
|
ln $target $var
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# real_path - report the absolute path to a file
|
# real_path - report the absolute path to a file
|
||||||
real_path ()
|
real_path ()
|
||||||
{
|
{
|
||||||
if [ "$PLATFORM" == "Darwin" -o "$PLATFORM" == "mingw" ]; then
|
if [ "$PLATFORM" == "Darwin" -o "$PLATFORM" == "mingw" ]; then
|
||||||
if [ -d "$1" ]; then
|
if [ -d "$1" ]; then
|
||||||
cd "$1"
|
cd "$1"
|
||||||
echo $PWD
|
echo $PWD
|
||||||
else
|
else
|
||||||
cd $(dirname $1)
|
cd $(dirname $1)
|
||||||
echo "$PWD"/$(basename "$1")
|
echo "$PWD"/$(basename "$1")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
which realpath 2>/dev/null >/dev/null
|
which realpath 2>/dev/null >/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
realpath "$1"
|
realpath "$1"
|
||||||
else
|
else
|
||||||
readlink -f "$1"
|
readlink -f "$1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# print checksum for one file
|
# print checksum for one file
|
||||||
checkSum()
|
checkSum()
|
||||||
{
|
{
|
||||||
if [ "$PLATFORM" == 'NetBSD' -o "$PLATFORM" == 'FreeBSD' -o "$PLATFORM" == 'Darwin' ]; then
|
if [ "$PLATFORM" == 'NetBSD' -o "$PLATFORM" == 'FreeBSD' -o "$PLATFORM" == 'Darwin' ]; then
|
||||||
md5 -q $1
|
md5 -q $1
|
||||||
else
|
else
|
||||||
md5sum $1 | cut -d' ' -f 1
|
md5sum $1 | cut -d' ' -f 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# startHttpServer - power up the python web server
|
# startHttpServer - power up the python web server
|
||||||
startHttpServer() {
|
startHttpServer() {
|
||||||
cd "${testdir}/.." # testdir is the tmp output directory
|
cd "${testdir}/.." # testdir is the tmp output directory
|
||||||
|
|
||||||
# PLATFORM = the scripting host (eg mingw)
|
if [ "$platform" == "cygwin" ]; then dport=12762
|
||||||
# host = the build host (eg windows for msvc)
|
elif [ "$platform" == "mingw" ]; then dport=12761
|
||||||
if [ $PLATFORM == 'cygwin' -o $PLATFORM == 'mingw' ]; then
|
else dport=12760
|
||||||
host=$(runTest exiv2 -vVg platform | tail -1 | cut -d= -f 2) # windows
|
fi
|
||||||
fi
|
|
||||||
if [ "$host" != windows ]; then host="$PLATFORM" ; fi
|
|
||||||
|
|
||||||
if [ "$host" == "cygwin" ]; then dport=12762
|
if [ ! -z $EXIV2_PORT ]; then port=$EXIV2_PORT ; else port=$dport ; fi
|
||||||
elif [ "$host" == "mingw" ]; then dport=12761
|
if [ ! -z $EXIV2_HTTP ]; then http=$EXIV2_HTTP ; else http=http://localhost; fi
|
||||||
else dport=12760
|
exiv2_url=$http:$port
|
||||||
fi
|
python3 -m http.server $port & # start a background local HTTP server in the "real" test directory
|
||||||
|
sleep 2 # wait for it to init or die!
|
||||||
if [ ! -z $EXIV2_PORT ]; then port=$EXIV2_PORT ; else port=$dport ; fi
|
exiv2_httpServer=$!
|
||||||
if [ ! -z $EXIV2_HTTP ]; then http=$EXIV2_HTTP ; else http=http://localhost; fi
|
# ask the server to reply
|
||||||
exiv2_url=$http:$port
|
echo $exiv2_url status = $(python3 -c "import urllib.request;print(urllib.request.urlopen('$exiv2_url/').status)")
|
||||||
python3 -m http.server $port & # start a background local HTTP server in the "real" test directory
|
|
||||||
sleep 2 # wait for it to init or die!
|
|
||||||
exiv2_httpServer=$!
|
|
||||||
# ask the server to reply
|
|
||||||
echo $exiv2_url status = $(python3 -c "import urllib.request;print(urllib.request.urlopen('$exiv2_url/').status)")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# closeHttpServer - power down the python web server
|
# closeHttpServer - power down the python web server
|
||||||
closeHttpServer() {
|
closeHttpServer() {
|
||||||
if [ ! -z $exiv2_httpServer ]; then
|
if [ ! -z $exiv2_httpServer ]; then
|
||||||
echo kill exiv2_httpServer $exiv2_httpServer
|
echo kill exiv2_httpServer $exiv2_httpServer
|
||||||
kill $exiv2_httpServer # kill the server
|
kill $exiv2_httpServer # kill the server
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# prepare tmp directory and variables
|
# prepare tmp directory and variables
|
||||||
prepareTest()
|
prepareTest()
|
||||||
{
|
{
|
||||||
##
|
##
|
||||||
# locale and timezone setting
|
# locale and timezone setting
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export TZ=BST-1
|
export TZ=BST-1
|
||||||
|
|
||||||
os=$(uname)
|
os=$(uname)
|
||||||
if [ "${os:0:4}" == "CYGW" ]; then
|
export PLATFORM=$os
|
||||||
export PLATFORM=cygwin
|
if [ $os != FreeBSD -a $os != NetBSD -a $os != SunOS -a $os != Darwin -a $os != Linux ]; then
|
||||||
elif [ "${os:0:4}" == "MING" -o "${os:0:4}" == "MSYS" ]; then
|
os=$(uname -o)
|
||||||
export PLATFORM=mingw
|
if [ $os == Cygwin ]; then
|
||||||
else
|
PLATFORM=cygwin
|
||||||
export PLATFORM=$os
|
elif [ os == Msys ]; then
|
||||||
fi
|
PLATFORM=mingw
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$PLATFORM" == cygwin -o "$PLATFORM" == mingw ]; then
|
if [ "$PLATFORM" == cygwin -o "$PLATFORM" == mingw ]; then
|
||||||
exe=.exe
|
exe=.exe
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z $EXIV2_EXT ]; then
|
if [ ! -z $EXIV2_EXT ]; then
|
||||||
exe=$EXIV2_EXT
|
exe=$EXIV2_EXT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
# initialize globals
|
# initialize globals
|
||||||
this=$(basename $0 .sh)
|
this=$(basename $0 .sh)
|
||||||
here=$PWD
|
here=$PWD
|
||||||
datapath="../data"
|
datapath="../data"
|
||||||
testdir="$here/tmp"
|
testdir="$here/tmp"
|
||||||
datadir="../data"
|
datadir="../data"
|
||||||
|
|
||||||
if [ -z "$EXIV2_BINDIR" ] ; then
|
if [ -z "$EXIV2_BINDIR" ] ; then
|
||||||
bin="$here/../build/bin/"
|
bin="$here/../build/bin/"
|
||||||
else
|
else
|
||||||
bin="$EXIV2_BINDIR/"
|
bin="$EXIV2_BINDIR/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update PATHs to ensure we load the the correct dynamlic library
|
# update PATHs to ensure we load the the correct dynamlic library
|
||||||
if [ $PLATFORM == 'mingw' -a $PLATFORM == 'cygwin' ]; then
|
if [ $PLATFORM == 'mingw' -a $PLATFORM == 'cygwin' ]; then
|
||||||
export PATH="$bin:$PATH"
|
export PATH="$bin:$PATH"
|
||||||
elif [ 'PLATFORM' == 'Darwin' ]; then
|
elif [ 'PLATFORM' == 'Darwin' ]; then
|
||||||
export DYLD_LIBRARY_PATH="$bin/../lib:$DYLD_LIBRARY_PATH"
|
export DYLD_LIBRARY_PATH="$bin/../lib:$DYLD_LIBRARY_PATH"
|
||||||
else
|
else
|
||||||
export LD_LIBRARY_PATH="$bin/../lib:$LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$bin/../lib:$LD_LIBRARY_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
# figure out arguments for diff
|
# figure out arguments for diff
|
||||||
good="$here/data/${this}.out"
|
good="$here/data/${this}.out"
|
||||||
results="$here/tmp/${this}.out"
|
results="$here/tmp/${this}.out"
|
||||||
mkdir -p $here/tmp
|
mkdir -p $here/tmp
|
||||||
tmpfile=$here/tmp/$this
|
tmpfile=$here/tmp/$this
|
||||||
echo '' >> $tmpfile
|
echo '' >> $tmpfile
|
||||||
|
|
||||||
if [ "$PLATFORM" == SunOS -o "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ] ; then
|
if [ "$PLATFORM" == SunOS -o "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ] ; then
|
||||||
da1=""
|
da1=""
|
||||||
da2=""
|
da2=""
|
||||||
else
|
else
|
||||||
diffargs="--strip-trailing-cr"
|
diffargs="--strip-trailing-cr"
|
||||||
diff -q $diffargs $tmpfile $tmpfile 2>/dev/null
|
diff -q $diffargs $tmpfile $tmpfile 2>/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
diffargs=""
|
diffargs=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmpfile=tmp/ttt
|
tmpfile=tmp/ttt
|
||||||
echo '' >> $tmpfile
|
echo '' >> $tmpfile
|
||||||
da1="--strip-trailing-cr"
|
da1="--strip-trailing-cr"
|
||||||
diff -q $da1 $tmpfile $tmpfile 2>/dev/null
|
diff -q $da1 $tmpfile $tmpfile 2>/dev/null
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
da1=""
|
da1=""
|
||||||
fi
|
fi
|
||||||
da2="--ignore-matching-lines=^Usage:.*exiv2"
|
da2="--ignore-matching-lines=^Usage:.*exiv2"
|
||||||
diff -q $da2 $tmpfile $tmpfile 2>/dev/null
|
diff -q $da2 $tmpfile $tmpfile 2>/dev/null
|
||||||
fi
|
fi
|
||||||
diffargs="$da1 $da2"
|
diffargs="$da1 $da2"
|
||||||
|
|
||||||
##
|
##
|
||||||
# test that exiv2 and some sample apps are in the bin!
|
# test that exiv2 and some sample apps are in the bin!
|
||||||
for e in exiv2 exifprint easyaccess-test metacopy ; do
|
for e in exiv2 exifprint easyaccess-test metacopy ; do
|
||||||
e="${bin}${e}${exe}"
|
e="${bin}${e}${exe}"
|
||||||
if [ ! -e "$e" ]; then
|
if [ ! -e "$e" ]; then
|
||||||
echo '******************************************'
|
echo '******************************************'
|
||||||
echo '***' $(real_path "$e") does not exist
|
echo '***' $(real_path "$e") does not exist
|
||||||
echo '******************************************'
|
echo '******************************************'
|
||||||
exit 42
|
exit 42
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# set platform for msvc builds
|
||||||
|
platform=$PLATFORM
|
||||||
|
if [ $PLATFORM == mingw -o $PLATFORM == cygwin ]; then
|
||||||
|
platform=$(runTest exiv2 -vV 2>/dev/null | grep platform=)
|
||||||
|
if [ "$platform" == "platform=windows" ]; then
|
||||||
|
platform="windows"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareTest
|
prepareTest
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user