]> git.liburcu.org Git - lttng-tools.git/commitdiff
Tests: Bail out of shell-based tests if bash version is not supported
authorKienan Stewart <kstewart@efficios.com>
Wed, 11 Dec 2024 15:09:21 +0000 (10:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Dec 2024 15:56:50 +0000 (15:56 +0000)
Change-Id: Ibb3b6d3b6069dae522a00273dd5b2f7990c095f3
Signed-off-by: Kienan Stewart <kstewart@effiicios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/utils.sh

index d291f5986360d98bb5f831cd33b035c02bc41ba6..a6412ceab2f426e60ffc0be503d531200edc0e19 100644 (file)
@@ -68,6 +68,12 @@ if [ -z ${LTTNG_TEST_TEARDOWN_TIMEOUT+x} ]; then
        LTTNG_TEST_TEARDOWN_TIMEOUT=60
 fi
 
+# Some tests use recent bash syntax, e.g. `array_var[-1]` which was introduced
+# in version 4.2. Bailout with a clear error if the bash version isn't supported.
+if [[ "${BASH_VERSINFO[0]}" -lt "4" ]] || [[ "${BASH_VERSINFO[0]}" == "4" && "${BASH_VERSINFO[1]}" -lt "2" ]]; then
+       BAIL_OUT "Bash version '${BASH_VERSION}' is not supported by the test suite"
+fi
+
 # Enable job monitor mode.
 # Here we are mostly interested in the following from the monitor mode:
 #    All processes run in a separate process group.
This page took 0.029459 seconds and 4 git commands to generate.