summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts/common.sh
blob: 2d7b2e292e5afa29bc40066b5100a3ebbcd8cf3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Hey Emacs, this is a -*- shell-script -*- !!!  :-)

# Common variables and functions for all CTDB tests.

# This expands the most probable problem cases like "." and "..".
TEST_SUBDIR=$(dirname "$0")
if [ $(dirname "$TEST_SUBDIR") = "." ] ; then
    TEST_SUBDIR=$(cd "$TEST_SUBDIR" ; pwd)
fi

CTDB_DIR=$(dirname $(dirname "$TEST_SUBDIR"))

# Print a message and exit.
die ()
{
    echo "$1" >&2 ; exit ${2:-1}
}