File: functions

package info (click to toggle)
fontconfig 2.17.1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,104 kB
  • sloc: ansic: 26,595; makefile: 1,281; sh: 1,206; python: 1,010
file content (55 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /bin/sh
# -*- sh -*-
# Copyright (C) 2023 fontconfig Authors
# SPDX-License-Identifier: MIT

set -e

: "${TMPDIR=/tmp}"

case "$OSTYPE" in
    msys ) MyPWD=$(pwd -W) ;;  # On Msys/MinGW, returns a MS Windows style path.
    *    ) MyPWD=$(pwd)    ;;  # On any other platforms, returns a Unix style path.
esac

TESTDIR=${srcdir-"$MyPWD"}
BUILDTESTDIR=${builddir-"$MyPWD"}

BASEDIR=$(mktemp -d "$TMPDIR"/fontconfig.XXXXXXXX)
FONTDIR="$BASEDIR"/fonts
CACHEDIR="$BASEDIR"/cache.dir
EXPECTED=${EXPECTED-"out.expected"}

FCLIST="$LOG_COMPILER ../../fc-list/fc-list$EXEEXT"
FCCACHE="$LOG_COMPILER ../../fc-cache/fc-cache$EXEEXT"
FCMATCH="$LOG_COMPILER ../../fc-match/fc-match$EXEEXT"

if [ -x "$(command -v bwrap)" ]; then
    BWRAP="$(command -v bwrap)"
fi

FONT1=$TESTDIR/../4x6.pcf
FONT2=$TESTDIR/../8x16.pcf
TEST=""

clean_exit() {
    rc=$?
    trap - INT TERM ABRT EXIT
    if [ "x$TEST" != "x" ]; then
        echo "Aborting from '$TEST' with the exit code $rc"
    fi
    rm -rf $BASEDIR
    exit $rc
}
trap clean_exit INT TERM ABRT EXIT

prep() {
    rm -rf "$CACHEDIR"
    rm -rf "$FONTDIR"
    mkdir "$FONTDIR"
}

dotest () {
    TEST=$1
    test x"$VERBOSE" = x || echo "Running: $TEST"
}