Update testcase

This commit is contained in:
Akira TAGOH 2019-01-29 07:03:58 +00:00
parent 2e09c62ba1
commit 916cf6caa3
5 changed files with 15 additions and 4 deletions

View File

@ -1,4 +1,4 @@
check_SCRIPTS=run-test.sh run-test-map.sh check_SCRIPTS=run-test.sh
TEST_EXTENSIONS = \ TEST_EXTENSIONS = \
.sh \ .sh \
$(NULL) $(NULL)

View File

@ -1,4 +1,5 @@
<fontconfig> <fontconfig>
<dir @MAP@>@FONTDIR@</dir> @REMAPDIR@
<dir>@FONTDIR@</dir>
<cachedir>@CACHEDIR@</cachedir> <cachedir>@CACHEDIR@</cachedir>
</fontconfig> </fontconfig>

View File

@ -73,7 +73,7 @@ dotest () {
} }
sed "s!@FONTDIR@!$FONTDIR! sed "s!@FONTDIR@!$FONTDIR!
s!@MAP@!! s!@REMAPDIR@!!
s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf s!@CACHEDIR@!$CACHEDIR!" < $TESTDIR/fonts.conf.in > fonts.conf
FONTCONFIG_FILE="$MyPWD"/fonts.conf FONTCONFIG_FILE="$MyPWD"/fonts.conf
@ -146,11 +146,17 @@ sleep 1
ls -l $CACHEDIR > out1 ls -l $CACHEDIR > out1
TESTTMPDIR=`mktemp -d /tmp/fontconfig.XXXXXXXX` TESTTMPDIR=`mktemp -d /tmp/fontconfig.XXXXXXXX`
sed "s!@FONTDIR@!$TESTTMPDIR/fonts! sed "s!@FONTDIR@!$TESTTMPDIR/fonts!
s!@MAP@!map="'"'"$FONTDIR"'"'"! s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>!
s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < $TESTDIR/fonts.conf.in > bind-fonts.conf 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" ":foundry=Misc" > xxx $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" ":foundry=Misc" > xxx
$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/test/test-bz106618$EXEEXT | sort > flist1 $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/test/test-bz106618$EXEEXT | sort > flist1
$BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev find $TESTTMPDIR/fonts/ -type f -name '*.pcf' | sort > flist2 $BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev find $TESTTMPDIR/fonts/ -type f -name '*.pcf' | sort > flist2
ls -l $CACHEDIR > out2
if cmp out1 out2 > /dev/null ; then : ; else
echo "*** Test failed: $TEST"
echo "cache was created/updated."
exit 1
fi
if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then
echo "*** Test failed: $TEST" echo "*** Test failed: $TEST"
echo "file property doesn't point to the new place: $TESTTMPDIR/fonts/4x6.pcf" echo "file property doesn't point to the new place: $TESTTMPDIR/fonts/4x6.pcf"

View File

@ -268,7 +268,9 @@ main (void)
} }
free (d); free (d);
FcConfigDestroy (cfg);
setenv ("FONTCONFIG_SYSROOT", sysroot, 1); setenv ("FONTCONFIG_SYSROOT", sysroot, 1);
cfg = FcConfigCreate ();
dsa = FcStrBuildFilename (sysroot, da, NULL); dsa = FcStrBuildFilename (sysroot, da, NULL);
dsac = FcStrCanonFilename (dsa); dsac = FcStrCanonFilename (dsa);
d = FcConfigRealFilename (cfg, dc); d = FcConfigRealFilename (cfg, dc);

View File

@ -224,7 +224,9 @@ main(void)
goto bail; goto bail;
free (ret); free (ret);
free (s); free (s);
FcConfigDestroy (cfg);
setenv ("FONTCONFIG_SYSROOT", sysroot, 1); setenv ("FONTCONFIG_SYSROOT", sysroot, 1);
cfg = FcConfigCreate ();
fprintf (stderr, "D: Creating %s\n", sysroot); fprintf (stderr, "D: Creating %s\n", sysroot);
mkdir_p (sysroot); mkdir_p (sysroot);
retval++; retval++;