Add a testcase for bind-mounted cachedir

This commit is contained in:
Akira TAGOH 2017-11-15 23:30:26 +09:00
parent 2f486f6584
commit 5af21201e1
1 changed files with 30 additions and 0 deletions

View File

@ -36,6 +36,11 @@ ECHO=true
FCLIST=../fc-list/fc-list$EXEEXT FCLIST=../fc-list/fc-list$EXEEXT
FCCACHE=../fc-cache/fc-cache$EXEEXT FCCACHE=../fc-cache/fc-cache$EXEEXT
which bwrap > /dev/null 2>&1
if [ $? -eq 0 ]; then
BWRAP=`which bwrap`
fi
FONT1=$TESTDIR/4x6.pcf FONT1=$TESTDIR/4x6.pcf
FONT2=$TESTDIR/8x16.pcf FONT2=$TESTDIR/8x16.pcf
@ -116,4 +121,29 @@ mkdir $FONTDIR/a
cp $FONT2 $FONTDIR/a cp $FONT2 $FONTDIR/a
check check
if [ x"$BWRAP" != "x" ]; then
dotest "Basic functionality with the bind-mounted cache dir"
prep
cp $FONT1 $FONT2 $FONTDIR
$FCCACHE $FONTDIR
sleep 1
ls -l $CACHEDIR > out1
TESTTMPDIR=`mktemp -d /tmp/fontconfig.XXXXXXXX`
sed "s!@FONTDIR@!$TESTTMPDIR/fonts!
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 "%{file}\n" "Misc Fixed" > xxx
ls -l $CACHEDIR > out2
if cmp out1 out2 > /dev/null ; then : ; else
echo "*** Test failed: $TEST"
echo "cache was updated."
exit 1
fi
if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then
echo "*** Test failed: $TEST"
echo "file property doesn't points to the new place"
exit 1
fi
rm -rf $TESTTMPDIR out1 out2 xxx bind-fonts.conf
fi
rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out