mempool_test: test rseq_mempool_percpu_malloc_init
[librseq.git] / tests / utils / utils.sh
CommitLineData
544cdc88
MJ
1#!/bin/bash
2#
3# SPDX-License-Identifier: MIT
4#
f2d7b530 5# SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
544cdc88
MJ
6#
7
8# This file is meant to be sourced at the start of shell script-based tests.
9
10
11# Error out when encountering an undefined variable
12set -u
13
14# If "readlink -f" is available, get a resolved absolute path to the
15# tests source dir, otherwise make do with a relative path.
16scriptdir="$(dirname "${BASH_SOURCE[0]}")"
17if readlink -f "." >/dev/null 2>&1; then
18 testsdir=$(readlink -f "$scriptdir/..")
19else
20 testsdir="$scriptdir/.."
21fi
22
23# Allow overriding the source and build directories
24if [ "x${RSEQ_TESTS_SRCDIR:-}" = "x" ]; then
25 RSEQ_TESTS_SRCDIR="$testsdir"
26fi
27export RSEQ_TESTS_SRCDIR
28
29if [ "x${RSEQ_TESTS_BUILDDIR:-}" = "x" ]; then
30 RSEQ_TESTS_BUILDDIR="$testsdir"
31fi
32export RSEQ_TESTS_BUILDDIR
33
34# By default, it will not source tap.sh. If you to tap output directly from
35# the test script, define the 'SH_TAP' variable to '1' before sourcing this
36# script.
37if [ "x${SH_TAP:-}" = x1 ]; then
38 # shellcheck source=./tap.sh
39 . "${RSEQ_TESTS_SRCDIR}/utils/tap.sh"
40fi
This page took 0.042209 seconds and 4 git commands to generate.