bt2c::Logger: remove unused cLevel() method
[babeltrace.git] / tests / utils / env.sh.in
index af34046b822ca250d0564e8e27109bcea5b725c9..77e0c443ec9f00b8e96f3d27e48eba5091efc226 100644 (file)
@@ -1,42 +1,50 @@
-#!/bin/bash
-#
+# SPDX-FileCopyrightText: 2021-2022 EfficiOS, Inc.
 # SPDX-License-Identifier: GPL-2.0-only
-#
-
-### Base paths to test suite ###
-if [ "x${BT_TESTS_SRCDIR:-}" = "x" ]; then
-       BT_TESTS_SRCDIR="@abs_top_srcdir@/tests"
-fi
-export BT_TESTS_SRCDIR
-
-if [ "x${BT_TESTS_BUILDDIR:-}" = "x" ]; then
-       BT_TESTS_BUILDDIR="@abs_top_builddir@/tests"
-fi
-export BT_TESTS_BUILDDIR
-
-
-### External Tools ###
-if [ "x${BT_TESTS_AWK_BIN:-}" = "x" ]; then
-       BT_TESTS_AWK_BIN="@AWK@"
-fi
-export BT_TESTS_AWK_BIN
-
-if [ "x${BT_TESTS_GREP_BIN:-}" = "x" ]; then
-       BT_TESTS_GREP_BIN="@GREP@"
-fi
-export BT_TESTS_GREP_BIN
-
-if [ "x${BT_TESTS_PYTHON_BIN:-}" = "x" ]; then
-       BT_TESTS_PYTHON_BIN="@PYTHON@"
-fi
-export BT_TESTS_PYTHON_BIN
-
-if [ "x${BT_TESTS_PYTHON_CONFIG_BIN:-}" = "x" ]; then
-       BT_TESTS_PYTHON_CONFIG_BIN="@PYTHON_CONFIG@"
-fi
-export BT_TESTS_PYTHON_CONFIG_BIN
-
-if [ "x${BT_TESTS_SED_BIN:-}" = "x" ]; then
-       BT_TESTS_SED_BIN="@SED@"
-fi
-export BT_TESTS_SED_BIN
+
+# shellcheck shell=bash
+
+# Sets the variable named `$1` to `$2` if it's not set (or empty), and
+# exports it.
+_set_var_def() {
+       local -r varname=$1
+       local -r val=$2
+
+       if [[ -z $(eval echo "\${$varname:-}") ]]; then
+               eval "$varname='$val'"
+       fi
+
+       export "${varname?}"
+}
+
+# Base source directory of tests, if not set
+_set_var_def BT_TESTS_SRCDIR '@abs_top_srcdir@/tests'
+
+# Base build directory of tests, if not set
+_set_var_def BT_TESTS_BUILDDIR '@abs_top_builddir@/tests'
+
+# Name of the `awk` command to use when testing, if not set
+_set_var_def BT_TESTS_AWK_BIN '@AWK@'
+
+# Name of the `grep` command to use when testing, if not set
+_set_var_def BT_TESTS_GREP_BIN '@GREP@'
+
+# Name of the `python3` command to use when testing, if not set
+_set_var_def BT_TESTS_PYTHON_BIN '@PYTHON@'
+
+# Name of the `python3-config` command to use when testing, if not set
+_set_var_def BT_TESTS_PYTHON_CONFIG_BIN '@PYTHON_CONFIG@'
+
+# Name of the `sed` command to use when testing, if not set
+_set_var_def BT_TESTS_SED_BIN '@SED@'
+
+# Name of the `cc` command to use when testing, if not set
+_set_var_def BT_TESTS_CC_BIN '@CC@'
+
+# `1` if AddressSanitizer is used, if not set
+_set_var_def BT_TESTS_ENABLE_ASAN '@ENABLE_ASAN@'
+
+# `1` to run tests which depend on Python plugin support, if not set
+_set_var_def BT_TESTS_ENABLE_PYTHON_PLUGINS '@ENABLE_PYTHON_PLUGINS@'
+
+# No more
+unset -f _set_var_def
This page took 0.024923 seconds and 4 git commands to generate.