summaryrefslogtreecommitdiff
path: root/check/common
blob: 57aa8066eb27b1923951ae45d754f9b54ff3e162 (plain)
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
# -*- sh -*-
#
# This file is sourced by the different test scripts.  It needs to be
# valid POSIX sh.
#

pkgconfig=../pkg-config

. ./config.sh

PKG_CONFIG_PATH=$srcdir
export PKG_CONFIG_PATH
export LC_ALL=C

run_test () {
    set +e
    ${pkgconfig} $ARGS >/dev/null 2>&1
    R=$?
    if [ "$R" -ne "${EXPECT_RETURN:-0}" ]; then
	${pkgconfig} --print-errors $ARGS
	echo "${pkgconfig} $ARGS exited with $R (expected ${EXPECT_RETURN:-0})" 1>&2
        exit 1
    fi

    R=$(${pkgconfig} $ARGS 2>&1 | sed -e 's,^[[:space:]]*,,' -e 's,[[:space:]]*$,,')
    if [ "$R" != "$RESULT" ]; then
	echo "${pkgconfig} $ARGS :"
	echo "'$R' != '$RESULT'"
	exit 1
    fi
    return
}