1#!/bin/bash 2# fontconfig/test/run-test.sh 3# 4# Copyright © 2000 Keith Packard 5# 6# Permission to use, copy, modify, distribute, and sell this software and its 7# documentation for any purpose is hereby granted without fee, provided that 8# the above copyright notice appear in all copies and that both that 9# copyright notice and this permission notice appear in supporting 10# documentation, and that the name of the author(s) not be used in 11# advertising or publicity pertaining to distribution of the software without 12# specific, written prior permission. The authors make no 13# representations about the suitability of this software for any purpose. It 14# is provided "as is" without express or implied warranty. 15# 16# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 17# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 18# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR 19# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22# PERFORMANCE OF THIS SOFTWARE. 23set -e 24 25: "${TMPDIR=/tmp}" 26 27case "$OSTYPE" in 28 msys ) MyPWD=$(pwd -W) ;; # On Msys/MinGW, returns a MS Windows style path. 29 * ) MyPWD=$(pwd) ;; # On any other platforms, returns a Unix style path. 30esac 31 32TESTDIR=${srcdir-"$MyPWD"} 33BUILDTESTDIR=${builddir-"$MyPWD"} 34 35BASEDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 36FONTDIR="$BASEDIR"/fonts 37CACHEDIR="$BASEDIR"/cache.dir 38EXPECTED=${EXPECTED-"out.expected"} 39 40FCLIST="$LOG_COMPILER ../fc-list/fc-list$EXEEXT" 41FCCACHE="$LOG_COMPILER ../fc-cache/fc-cache$EXEEXT" 42 43if [ -x "$(command -v bwrap)" ]; then 44 BWRAP="$(command -v bwrap)" 45fi 46 47FONT1=$TESTDIR/4x6.pcf 48FONT2=$TESTDIR/8x16.pcf 49TEST="" 50 51clean_exit() { 52 rc=$? 53 trap - INT TERM ABRT EXIT 54 if [ "x$TEST" != "x" ]; then 55 echo "Aborting from '$TEST' with the exit code $rc" 56 fi 57 exit $rc 58} 59trap clean_exit INT TERM ABRT EXIT 60 61check () { 62 { 63 $FCLIST - family pixelsize | sort; 64 echo "="; 65 $FCLIST - family pixelsize | sort; 66 echo "="; 67 $FCLIST - family pixelsize | sort; 68 } > out 69 tr -d '\015' <out >out.tmp; mv out.tmp out 70 if cmp out "$BUILDTESTDIR"/"$EXPECTED" > /dev/null ; then : ; else 71 echo "*** Test failed: $TEST" 72 echo "*** output is in 'out', expected output in '$EXPECTED'" 73 exit 1 74 fi 75 rm -f out 76} 77 78prep() { 79 rm -rf "$CACHEDIR" 80 rm -rf "$FONTDIR" 81 mkdir "$FONTDIR" 82} 83 84dotest () { 85 TEST=$1 86 test x"$VERBOSE" = x || echo "Running: $TEST" 87} 88 89sed "s!@FONTDIR@!$FONTDIR! 90s!@REMAPDIR@!! 91s!@CACHEDIR@!$CACHEDIR!" < "$TESTDIR"/fonts.conf.in > fonts.conf 92 93FONTCONFIG_FILE="$MyPWD"/fonts.conf 94export FONTCONFIG_FILE 95 96dotest "Basic check" 97prep 98cp "$FONT1" "$FONT2" "$FONTDIR" 99if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 100 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 101fi 102check 103 104dotest "With a subdir" 105prep 106cp "$FONT1" "$FONT2" "$FONTDIR" 107if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 108 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 109fi 110$FCCACHE "$FONTDIR" 111check 112 113dotest "Subdir with a cache file" 114prep 115mkdir "$FONTDIR"/a 116cp "$FONT1" "$FONT2" "$FONTDIR"/a 117if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 118 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"/a 119fi 120$FCCACHE "$FONTDIR"/a 121check 122 123dotest "Complicated directory structure" 124prep 125mkdir "$FONTDIR"/a 126mkdir "$FONTDIR"/a/a 127mkdir "$FONTDIR"/b 128mkdir "$FONTDIR"/b/a 129cp "$FONT1" "$FONTDIR"/a 130if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 131 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"/a 132fi 133cp "$FONT2" "$FONTDIR"/b/a 134if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 135 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"/b/a 136fi 137check 138 139dotest "Subdir with an out-of-date cache file" 140prep 141mkdir "$FONTDIR"/a 142$FCCACHE "$FONTDIR"/a 143sleep 1 144cp "$FONT1" "$FONT2" "$FONTDIR"/a 145check 146 147dotest "Dir with an out-of-date cache file" 148prep 149cp "$FONT1" "$FONTDIR" 150$FCCACHE "$FONTDIR" 151sleep 1 152mkdir "$FONTDIR"/a 153cp "$FONT2" "$FONTDIR"/a 154check 155 156dotest "Keep mtime of the font directory" 157prep 158cp "$FONT1" "$FONTDIR" 159touch -d @0 "$FONTDIR" 160stat -c '%y' "$FONTDIR" > out1 161$FCCACHE "$FONTDIR" 162stat -c '%y' "$FONTDIR" > out2 163if cmp out1 out2 > /dev/null ; then : ; else 164 echo "*** Test failed: $TEST" 165 echo "mtime was modified" 166 exit 1 167fi 168 169if [ x"$BWRAP" != "x" ] && [ "x$EXEEXT" = "x" ]; then 170dotest "Basic functionality with the bind-mounted cache dir" 171prep 172cp "$FONT1" "$FONT2" "$FONTDIR" 173if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 174 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 175fi 176$FCCACHE "$FONTDIR" 177sleep 1 178ls -l "$CACHEDIR" > out1 179TESTTMPDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 180# Once font dir is remapped, we could use $FONTDIR as different one in theory. 181# but we don't use it here and to avoid duplicate entries, set the non-existing 182# directory here. 183sed "s!@FONTDIR@!$FONTDIR/a! 184s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>! 185s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < "$TESTDIR"/fonts.conf.in > bind-fonts.conf 186$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 187$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 188$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 189ls -l "$CACHEDIR" > out2 190if cmp out1 out2 > /dev/null ; then : ; else 191 echo "*** Test failed: $TEST" 192 echo "cache was created/updated." 193 echo "Before:" 194 cat out1 195 echo "After:" 196 cat out2 197 exit 1 198fi 199if [ x"$(cat xxx)" != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then 200 echo "*** Test failed: $TEST" 201 echo "file property doesn't point to the new place: $TESTTMPDIR/fonts/4x6.pcf" 202 exit 1 203fi 204if cmp flist1 flist2 > /dev/null ; then : ; else 205 echo "*** Test failed: $TEST" 206 echo "file properties doesn't point to the new places" 207 echo "Expected result:" 208 cat flist2 209 echo "Actual result:" 210 cat flist1 211 exit 1 212fi 213rm -rf "$TESTTMPDIR" out1 out2 xxx flist1 flist2 bind-fonts.conf 214 215dotest "Different directory content between host and sandbox" 216prep 217cp "$FONT1" "$FONTDIR" 218if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 219 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 220fi 221$FCCACHE "$FONTDIR" 222sleep 1 223ls -1 --color=no "$CACHEDIR"/*cache*> out1 224stat -c '%n %s %y %z' "$(cat out1)" > stat1 225TESTTMPDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 226TESTTMP2DIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 227cp "$FONT2" "$TESTTMP2DIR" 228if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 229 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$TESTTMP2DIR" 230fi 231sed "s!@FONTDIR@!$TESTTMPDIR/fonts</dir><dir salt="'"'"salt-to-make-different"'"'">$FONTDIR! 232s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>! 233s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < "$TESTDIR"/fonts.conf.in > bind-fonts.conf 234$BWRAP --bind / / --bind "$CACHEDIR" "$TESTTMPDIR"/cache.dir --bind "$FONTDIR" "$TESTTMPDIR"/fonts --bind "$TESTTMP2DIR" "$FONTDIR" --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 235$BWRAP --bind / / --bind "$CACHEDIR" "$TESTTMPDIR"/cache.dir --bind "$FONTDIR" "$TESTTMPDIR"/fonts --bind "$TESTTMP2DIR" "$FONTDIR" --bind .. "$TESTTMPDIR"/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE "$TESTTMPDIR"/build/test/bind-fonts.conf "$TESTTMPDIR"/build/test/test-bz106618"$EXEEXT" | sort > flist1 236$BWRAP --bind / / --bind "$CACHEDIR" "$TESTTMPDIR"/cache.dir --bind "$FONTDIR" "$TESTTMPDIR"/fonts --bind "$TESTTMP2DIR" "$FONTDIR" --bind .. "$TESTTMPDIR"/build --dev-bind /dev /dev find "$TESTTMPDIR"/fonts/ -type f -name '*.pcf' | sort > flist2 237ls -1 --color=no "$CACHEDIR"/*cache* > out2 238stat -c '%n %s %y %z' "$(cat out1)" > stat2 239if cmp stat1 stat2 > /dev/null ; then : ; else 240 echo "*** Test failed: $TEST" 241 echo "cache was created/updated." 242 cat stat1 stat2 243 exit 1 244fi 245if grep -v -- "$(cat out1)" out2 > /dev/null ; then : ; else 246 echo "*** Test failed: $TEST" 247 echo "cache wasn't created for dir inside sandbox." 248 cat out1 out2 249 exit 1 250fi 251if [ x"$(cat xxx)" != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then 252 echo "*** Test failed: $TEST" 253 echo "file property doesn't point to the new place: $TESTTMPDIR/fonts/4x6.pcf" 254 exit 1 255fi 256if cmp flist1 flist2 > /dev/null ; then 257 echo "*** Test failed: $TEST" 258 echo "Missing fonts should be available on sandbox" 259 echo "Expected result:" 260 cat flist2 261 echo "Actual result:" 262 cat flist1 263 exit 1 264fi 265rm -rf "$TESTTMPDIR" "$TESTTMP2DIR" out1 out2 xxx flist1 flist2 stat1 stat2 bind-fonts.conf 266 267dotest "Check consistency of MD5 in cache name" 268prep 269mkdir -p "$FONTDIR"/sub 270cp "$FONT1" "$FONTDIR"/sub 271if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 272 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"/sub 273fi 274$FCCACHE "$FONTDIR" 275sleep 1 276(cd "$CACHEDIR"; ls -1 --color=no ./*cache*) > out1 277TESTTMPDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 278mkdir -p "$TESTTMPDIR"/cache.dir 279# Once font dir is remapped, we could use $FONTDIR as different one in theory. 280# but we don't use it here and to avoid duplicate entries, set the non-existing 281# directory here. 282sed "s!@FONTDIR@!$FONTDIR/a! 283s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>! 284s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < "$TESTDIR"/fonts.conf.in > bind-fonts.conf 285$BWRAP --bind / / --bind "$FONTDIR" "$TESTTMPDIR"/fonts --bind .. "$TESTTMPDIR"/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE "$TESTTMPDIR"/build/test/bind-fonts.conf "$TESTTMPDIR"/build/fc-cache/fc-cache"$EXEEXT" "$TESTTMPDIR"/fonts 286(cd "$TESTTMPDIR"/cache.dir; ls -1 --color=no ./*cache*) > out2 287if cmp out1 out2 > /dev/null ; then : ; else 288 echo "*** Test failed: $TEST" 289 echo "cache was created unexpectedly." 290 echo "Before:" 291 cat out1 292 echo "After:" 293 cat out2 294 exit 1 295fi 296rm -rf "$TESTTMPDIR" out1 out2 bind-fonts.conf 297 298dotest "Fallback to uuid" 299prep 300cp "$FONT1" "$FONTDIR" 301if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 302 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 303fi 304touch -d @"$(stat -c %Y "$FONTDIR")" "$FONTDIR" 305$FCCACHE "$FONTDIR" 306sleep 1 307_cache=$(ls -1 --color=no "$CACHEDIR"/*cache*) 308_mtime=$(stat -c %Y "$FONTDIR") 309_uuid=$(uuidgen) 310_newcache=$(echo "$_cache" | sed "s/\([0-9a-f]*\)\(\-.*\)/$_uuid\2/") 311mv "$_cache" "$_newcache" 312echo "$_uuid" > "$FONTDIR"/.uuid 313touch -d @"$_mtime" "$FONTDIR" 314(cd "$CACHEDIR"; ls -1 --color=no ./*cache*) > out1 315TESTTMPDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 316mkdir -p "$TESTTMPDIR"/cache.dir 317sed "s!@FONTDIR@!$TESTTMPDIR/fonts! 318s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>! 319s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < "$TESTDIR"/fonts.conf.in > bind-fonts.conf 320$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 "" 321(cd "$CACHEDIR"; ls -1 --color=no ./*cache*) > out2 322if cmp out1 out2 > /dev/null ; then : ; else 323 echo "*** Test failed: $TEST" 324 echo "cache was created unexpectedly." 325 echo "Before:" 326 cat out1 327 echo "After:" 328 cat out2 329 exit 1 330fi 331rm -rf "$TESTTMPDIR" out1 out2 bind-fonts.conf 332 333else 334 echo "No bubblewrap installed. skipping..." 335fi # if [ x"$BWRAP" != "x" -a "x$EXEEXT" = "x" ] 336 337if [ "x$EXEEXT" = "x" ]; then 338dotest "sysroot option" 339prep 340mkdir -p "$MyPWD"/sysroot/"$FONTDIR" 341mkdir -p "$MyPWD"/sysroot/"$CACHEDIR" 342mkdir -p "$MyPWD"/sysroot/"$MyPWD" 343cp "$FONT1" "$MyPWD"/sysroot/"$FONTDIR" 344if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 345 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$MyPWD"/sysroot/"$FONTDIR" 346fi 347cp "$MyPWD"/fonts.conf "$MyPWD"/sysroot/"$MyPWD"/fonts.conf 348$FCCACHE -y "$MyPWD"/sysroot 349 350dotest "creating cache file on sysroot" 351md5=$(printf "%s" "$FONTDIR" | md5sum | sed 's/ .*$//') 352echo "checking for cache file $md5" 353if ! ls "$MyPWD/sysroot/$CACHEDIR/$md5"*; then 354 echo "*** Test failed: $TEST" 355 echo "No cache for $FONTDIR ($md5)" 356 ls "$MyPWD"/sysroot/"$CACHEDIR" 357 exit 1 358fi 359 360rm -rf "$MyPWD"/sysroot 361 362dotest "read newer caches when multiple places are allowed to store" 363prep 364cp "$FONT1" "$FONT2" "$FONTDIR" 365if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 366 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 367fi 368MYCACHEBASEDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 369MYCACHEDIR="$MYCACHEBASEDIR"/cache.dir 370MYOWNCACHEDIR="$MYCACHEBASEDIR"/owncache.dir 371MYCONFIG=$(mktemp "$TMPDIR"/fontconfig.XXXXXXXX) 372 373mkdir -p "$MYCACHEDIR" 374mkdir -p "$MYOWNCACHEDIR" 375 376sed "s!@FONTDIR@!$FONTDIR! 377s!@REMAPDIR@!! 378s!@CACHEDIR@!$MYCACHEDIR!" < "$TESTDIR"/fonts.conf.in > my-fonts.conf 379 380FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCCACHE "$FONTDIR" 381 382sleep 1 383cat<<EOF>"$MYCONFIG" 384<fontconfig> 385 <match target="scan"> 386 <test name="file"><string>$FONTDIR/4x6.pcf</string></test> 387 <edit name="pixelsize"><int>8</int></edit> 388 </match> 389</fontconfig> 390EOF 391sed "s!@FONTDIR@!$FONTDIR! 392s!@REMAPDIR@!<include ignore_missing=\"yes\">$MYCONFIG</include>! 393s!@CACHEDIR@!$MYOWNCACHEDIR!" < "$TESTDIR"/fonts.conf.in > my-fonts.conf 394 395if [ -n "${SOURCE_DATE_EPOCH:-}" ]; then 396 old_epoch=${SOURCE_DATE_EPOCH} 397 SOURCE_DATE_EPOCH=$(("$SOURCE_DATE_EPOCH" + 1)) 398fi 399FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCCACHE -f "$FONTDIR" 400if [ -n "${SOURCE_DATE_EPOCH:-}" ]; then 401 SOURCE_DATE_EPOCH=${old_epoch} 402fi 403 404sed "s!@FONTDIR@!$FONTDIR! 405s!@REMAPDIR@!<include ignore_missing=\"yes\">$MYCONFIG</include>! 406s!@CACHEDIR@!$MYCACHEDIR</cachedir><cachedir>$MYOWNCACHEDIR!" < "$TESTDIR"/fonts.conf.in > my-fonts.conf 407 408{ 409 FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCLIST - family pixelsize | sort; 410 echo "="; 411 FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCLIST - family pixelsize | sort; 412 echo "="; 413 FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCLIST - family pixelsize | sort; 414} > my-out 415tr -d '\015' <my-out >my-out.tmp; mv my-out.tmp my-out 416sed -e 's/pixelsize=6/pixelsize=8/g' "$BUILDTESTDIR"/"$EXPECTED" > my-out.expected 417 418if cmp my-out my-out.expected > /dev/null ; then : ; else 419 echo "*** Test failed: $TEST" 420 echo "*** output is in 'my-out', expected output in 'my-out.expected'" 421 echo "Actual Result" 422 cat my-out 423 echo "Expected Result" 424 cat my-out.expected 425 exit 1 426fi 427 428rm -rf "$MYCACHEBASEDIR" "$MYCONFIG" my-fonts.conf my-out my-out.expected 429 430fi # if [ "x$EXEEXT" = "x" ] 431 432if [ -x "$BUILDTESTDIR"/test-crbug1004254 ]; then 433 dotest "MT-safe global config" 434 prep 435 curl -s -o "$FONTDIR"/noto.zip https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip 436 (cd "$FONTDIR"; unzip noto.zip) 437 if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 438 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 439 fi 440 "$BUILDTESTDIR"/test-crbug1004254 441else 442 echo "No test-crbug1004254: skipped" 443fi 444 445if [ "x$EXEEXT" = "x" ]; then 446 447dotest "empty XDG_CACHE_HOME" 448prep 449export XDG_CACHE_HOME="" 450export old_HOME="$HOME" 451export temp_HOME=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX) 452export HOME="$temp_HOME" 453cp "$FONT1" "$FONT2" "$FONTDIR" 454if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then 455 touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR" 456fi 457echo "<fontconfig><dir>$FONTDIR</dir><cachedir prefix=\"xdg\">fontconfig</cachedir></fontconfig>" > my-fonts.conf 458FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCCACHE "$FONTDIR" || : 459if [ -d "$HOME"/.cache ] && [ -d "$HOME"/.cache/fontconfig ]; then : ; else 460 echo "*** Test failed: $TEST" 461 echo "No \$HOME/.cache/fontconfig directory" 462 ls -a "$HOME" 463 ls -a "$HOME"/.cache 464 exit 1 465fi 466 467export HOME="$old_HOME" 468rm -rf "$temp_HOME" my-fonts.conf 469unset XDG_CACHE_HOME 470unset old_HOME 471unset temp_HOME 472 473fi # if [ "x$EXEEXT" = "x" ] 474 475rm -rf "$FONTDIR" "$CACHEFILE" "$CACHEDIR" "$BASEDIR" "$FONTCONFIG_FILE" out 476 477TEST="" 478