Fix: handle leak in abi tests
[lttng-ust.git] / tests / utils / utils.sh
CommitLineData
8a36ff81
MJ
1#!/bin/bash
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5# Copyright (c) 2019 Michael Jeanson <mjeanson@efficios.com>
6# Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
7#
8
9# This file is meant to be sourced at the start of shell script-based tests.
10
11
12# Error out when encountering an undefined variable
13set -u
14
15# If "readlink -f" is available, get a resolved absolute path to the
16# tests source dir, otherwise make do with a relative path.
17scriptdir="$(dirname "${BASH_SOURCE[0]}")"
18if readlink -f "." >/dev/null 2>&1; then
19 testsdir=$(readlink -f "$scriptdir/..")
20else
21 testsdir="$scriptdir/.."
22fi
23
24# Allow overriding the source and build directories
25if [ "x${UST_TESTS_SRCDIR:-}" = "x" ]; then
26 UST_TESTS_SRCDIR="$testsdir"
27fi
28export UST_TESTS_SRCDIR
29
30if [ "x${UST_TESTS_BUILDDIR:-}" = "x" ]; then
31 UST_TESTS_BUILDDIR="$testsdir"
32fi
33export UST_TESTS_BUILDDIR
This page took 0.023882 seconds and 4 git commands to generate.