summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2017-11-15 23:30:26 +0900
committerAkira TAGOH <akira@tagoh.org>2017-11-20 17:37:23 +0530
commit5af21201e1bf2daf2bae4b684243bc62dd2c7ee7 (patch)
treeb13093a38e826541430dc7c9d5b7ed03bc3044c8 /test
parent2f486f6584f3c0d6d1c7eadfbc56cd13a8f3122f (diff)
Add a testcase for bind-mounted cachedir
Diffstat (limited to 'test')
-rw-r--r--test/run-test.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/run-test.sh b/test/run-test.sh
index e5bc32c3..ece6feaf 100644
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -36,6 +36,11 @@ ECHO=true
FCLIST=../fc-list/fc-list$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
FONT2=$TESTDIR/8x16.pcf
@@ -116,4 +121,29 @@ mkdir $FONTDIR/a
cp $FONT2 $FONTDIR/a
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