Update the test case that is looking for uuid based on host

This commit is contained in:
Akira TAGOH 2019-04-04 12:14:20 +00:00
parent 76e899700b
commit faa11fb642
1 changed files with 32 additions and 24 deletions

View File

@ -249,6 +249,38 @@ if cmp out1 out2 > /dev/null ; then : ; else
fi
rm -rf $TESTTMPDIR out1 out2 bind-fonts.conf
dotest "Fallback to uuid"
prep
cp $FONT1 $FONTDIR
touch -d @`stat -c %Y $FONTDIR` $FONTDIR
$FCCACHE $FONTDIR
sleep 1
_cache=`ls -1 --color=no $CACHEDIR/*cache*`
_mtime=`stat -c %Y $FONTDIR`
_uuid=`uuidgen`
_newcache=`echo $_cache | sed "s/\([0-9a-f]*\)\(\-.*\)/$_uuid\2/"`
mv $_cache $_newcache
echo $_uuid > $FONTDIR/.uuid
touch -d @$_mtime $FONTDIR
(cd $CACHEDIR; ls -1 --color=no *cache*) > out1
TESTTMPDIR=`mktemp -d /tmp/fontconfig.XXXXXXXX`
mkdir -p $TESTTMPDIR/cache.dir
sed "s!@FONTDIR@!$TESTTMPDIR/fonts!
s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>!
s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < $TESTDIR/fonts.conf.in > bind-fonts.conf
$BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE $TESTTMPDIR/build/test/bind-fonts.conf $TESTTMPDIR/build/fc-match/fc-match$EXEEXT -f ""
(cd $CACHEDIR; ls -1 --color=no *cache*) > out2
if cmp out1 out2 > /dev/null ; then : ; else
echo "*** Test failed: $TEST"
echo "cache was created unexpectedly."
echo "Before:"
cat out1
echo "After:"
cat out2
exit 1
fi
rm -rf $TESTTMPDIR out1 out2 bind-fonts.conf
else
echo "No bubblewrap installed. skipping..."
fi # if [ x"$BWRAP" != "x" -a "x$EXEEXT" = "x" ]
@ -276,30 +308,6 @@ fi
rm -rf $MyPWD/sysroot
dotest "Fallback to uuid"
prep
cp $FONT1 $FONTDIR
touch -d @`stat -c %Y $FONTDIR` $FONTDIR
$FCCACHE $FONTDIR
_cache=`ls -1 --color=no $CACHEDIR/*cache*`
_mtime=`stat -c %Y $FONTDIR`
_uuid=`uuidgen`
_newcache=`echo $_cache | sed "s/\([0-9a-f]*\)\(\-.*\)/$_uuid\2/"`
mv $_cache $_newcache
echo $_uuid > $FONTDIR/.uuid
touch -d @$_mtime $FONTDIR
$FCCACHE $FONTDIR
_cache2=`ls -1 --color=no $CACHEDIR/*cache*`
if [ "x$_cache2" != "x$_newcache" ]; then
echo "*** Test failed: $TEST"
echo "Cache wasn't fallen back."
echo "Expected result:"
echo $_newcache
echo "Actual result:"
echo $_cache2
exit 1
fi
fi # if [ "x$EXEEXT" = "x" ]
rm -rf $FONTDIR $CACHEFILE $CACHEDIR $BASEDIR $FONTCONFIG_FILE out