Commit | Line | Data |
---|---|---|
e46cbefe MJ |
1 | #!/bin/bash |
2 | # | |
2b9b078c | 3 | # SPDX-FileCopyrightText: 2021-2022 EfficiOS, Inc. |
e46cbefe | 4 | # SPDX-License-Identifier: GPL-2.0-only |
e46cbefe | 5 | |
2a656b4a PP |
6 | # Sets the variable named `$1` to `$2` if it's not set, and exports it. |
7 | _set_var_def() { | |
8 | local -r varname=$1 | |
9 | local -r val=$2 | |
10 | ||
11 | if [[ -z ${!varname:-} ]]; then | |
12 | eval "$varname='$val'" | |
13 | fi | |
14 | ||
15 | export "${varname?}" | |
16 | } | |
17 | ||
18 | # Base source directory of tests, if not set | |
19 | _set_var_def BT_TESTS_SRCDIR '@abs_top_srcdir@/tests' | |
20 | ||
21 | # Base build directory of tests, if not set | |
22 | _set_var_def BT_TESTS_BUILDDIR '@abs_top_builddir@/tests' | |
23 | ||
24 | # Name of the `awk` command to use when testing, if not set | |
25 | _set_var_def BT_TESTS_AWK_BIN '@AWK@' | |
26 | ||
27 | # Name of the `grep` command to use when testing, if not set | |
28 | _set_var_def BT_TESTS_GREP_BIN '@GREP@' | |
29 | ||
30 | # Name of the `python3` command to use when testing, if not set | |
31 | _set_var_def BT_TESTS_PYTHON_BIN '@PYTHON@' | |
32 | ||
33 | # Name of the `python3-config` command to use when testing, if not set | |
34 | _set_var_def BT_TESTS_PYTHON_CONFIG_BIN '@PYTHON_CONFIG@' | |
35 | ||
36 | # Name of the `sed` command to use when testing, if not set | |
37 | _set_var_def BT_TESTS_SED_BIN '@SED@' | |
38 | ||
39 | # Name of the `cc` command to use when testing, if not set | |
40 | _set_var_def BT_TESTS_CC_BIN '@CC@' | |
41 | ||
42 | # `1` if AddressSanitizer is used, if not set | |
43 | _set_var_def BT_TESTS_ENABLE_ASAN '@ENABLE_ASAN@' | |
44 | ||
45 | # `1` to run tests which depend on Python plugin support, if not set | |
46 | _set_var_def BT_TESTS_ENABLE_PYTHON_PLUGINS '@ENABLE_PYTHON_PLUGINS@' | |
47 | ||
48 | # No more | |
49 | unset -f _set_var_def |