From: Michael Jeanson Date: Thu, 16 Feb 2023 16:37:10 +0000 (-0500) Subject: Fix: tests: add shellcheck test to distribution X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=6785c08c87af6432e966348bc4c91110ad66e91b Fix: tests: add shellcheck test to distribution Add the shellcheck test to the distribution, also copy it to the build dir for oot builds and while where are here, rename it with the 'test_' prefix to match the rest of the test suite. Change-Id: Iaeff191022d16ea666c2145aa7e907aeebb6c5ff Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/tests/meta/Makefile.am b/tests/meta/Makefile.am index 044fc83c9..becce8137 100644 --- a/tests/meta/Makefile.am +++ b/tests/meta/Makefile.am @@ -4,4 +4,20 @@ LOG_DRIVER_FLAGS = --merge LOG_DRIVER = env PGREP='$(PGREP)' AM_TAP_AWK='$(AWK)' $(SHELL) \ $(top_srcdir)/tests/utils/tap-driver.sh -TESTS = shellcheck-tests +TESTS = test_shellcheck + +EXTRA_DIST = $(TESTS) + +all-local: + @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ + for script in $(EXTRA_DIST); do \ + cp -f $(srcdir)/$$script $(builddir); \ + done; \ + fi + +clean-local: + @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ + for script in $(EXTRA_DIST); do \ + rm -f $(builddir)/$$script; \ + done; \ + fi diff --git a/tests/meta/shellcheck-tests b/tests/meta/shellcheck-tests deleted file mode 100755 index 49c8e73d1..000000000 --- a/tests/meta/shellcheck-tests +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (c) 2023 Olivier Dion - -# Augment this list incrementally when a shell script passes shellcheck. -# -# All file must be relative to the test directory. -files=( - meta/shellcheck-tests - run.sh -) - -TESTDIR=$(dirname "$0")/.. - -# shellcheck source=../utils/tap/tap.sh -source "$TESTDIR/utils/tap/tap.sh" - -function shellcheck_ok() { - shellcheck --external-sources "$1" - ok $? "Checking $1" -} - -plan_tests "${#files[@]}" - -for f in "${files[@]}"; -do - shellcheck_ok "$TESTDIR/$f" -done diff --git a/tests/meta/test_shellcheck b/tests/meta/test_shellcheck new file mode 100755 index 000000000..3806dada1 --- /dev/null +++ b/tests/meta/test_shellcheck @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (c) 2023 Olivier Dion + +# Augment this list incrementally when a shell script passes shellcheck. +# +# All file must be relative to the test directory. +files=( + meta/test_shellcheck + run.sh +) + +TESTDIR=$(dirname "$0")/.. + +# shellcheck source=../utils/tap/tap.sh +source "$TESTDIR/utils/tap/tap.sh" + +function shellcheck_ok() { + shellcheck --external-sources "$1" + ok $? "Checking $1" +} + +plan_tests "${#files[@]}" + +for f in "${files[@]}"; +do + shellcheck_ok "$TESTDIR/$f" +done