Import a stripped down shell tests script framework from babeltrace2.
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I41ea4b186fe744fd6841d866daa87a802c96b692
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/unit/libringbuffer/test_shm
tests/unit/pthread_name/test_pthread_name
tests/unit/snprintf/test_snprintf
-tests/unit/ust-elf/test_ust_elf
tests/unit/ust-elf/ust-elf
# Java agent library
lttng-ust-ctl.pc
])
-AC_CONFIG_FILES([tests/unit/ust-elf/test_ust_elf],[chmod +x tests/unit/ust-elf/test_ust_elf])
-
AC_OUTPUT
SUBDIRS = utils unit compile benchmark
-LOG_DRIVER_FLAGS='--merge'
-LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
- $(srcdir)/utils/tap-driver.sh
+LOG_DRIVER_FLAGS = --merge --comments
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \
+ UST_TESTS_SRCDIR='$(abs_top_srcdir)/tests' \
+ UST_TESTS_BUILDDIR='$(abs_top_builddir)/tests' \
+ $(SHELL) $(srcdir)/utils/tap-driver.sh
TESTS = \
unit/libringbuffer/test_shm \
ust_elf_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la \
$(top_builddir)/tests/utils/libtap.a
+dist_check_SCRIPTS = test_ust_elf
+
# Directories added to EXTRA_DIST will be recursively copied to the distribution.
EXTRA_DIST = \
$(srcdir)/data \
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-only
+
+if [ "x${UST_TESTS_SRCDIR:-}" != "x" ]; then
+ UTILSSH="$UST_TESTS_SRCDIR/utils/utils.sh"
+else
+ UTILSSH="$(dirname "$0")/../../utils/utils.sh"
+fi
+
+# shellcheck source=../utils/utils.sh
+source "$UTILSSH"
+
+"${UST_TESTS_BUILDDIR}/unit/ust-elf/ust-elf" "${UST_TESTS_SRCDIR}/unit/ust-elf"
+++ /dev/null
-#!/bin/sh
-# SPDX-License-Identifier: LGPL-2.1-only
-
-TEST_DIR=$(dirname "$0")
-"${TEST_DIR}/ust-elf" "@abs_top_srcdir@/tests/unit/ust-elf"
libtap_a_SOURCES = tap.c tap.h
dist_check_SCRIPTS = \
tap-driver.sh \
- tap.sh
+ tap.sh \
+ utils.sh
--- /dev/null
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (c) 2019 Michael Jeanson <mjeanson@efficios.com>
+# Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
+#
+
+# This file is meant to be sourced at the start of shell script-based tests.
+
+
+# Error out when encountering an undefined variable
+set -u
+
+# If "readlink -f" is available, get a resolved absolute path to the
+# tests source dir, otherwise make do with a relative path.
+scriptdir="$(dirname "${BASH_SOURCE[0]}")"
+if readlink -f "." >/dev/null 2>&1; then
+ testsdir=$(readlink -f "$scriptdir/..")
+else
+ testsdir="$scriptdir/.."
+fi
+
+# Allow overriding the source and build directories
+if [ "x${UST_TESTS_SRCDIR:-}" = "x" ]; then
+ UST_TESTS_SRCDIR="$testsdir"
+fi
+export UST_TESTS_SRCDIR
+
+if [ "x${UST_TESTS_BUILDDIR:-}" = "x" ]; then
+ UST_TESTS_BUILDDIR="$testsdir"
+fi
+export UST_TESTS_BUILDDIR