From 7ed34c821a1b9941c0dffe8698967aeb5e375f00 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Thu, 21 Feb 2013 23:26:52 -0500 Subject: [PATCH] Tests: Add runner script for tools regression tests Also remove old the old runner scripts. Signed-off-by: Christian Babeux --- tests/regression/tools/Makefile.am | 5 +-- tests/regression/tools/filtering/Makefile.am | 4 +- tests/regression/tools/filtering/runall | 28 -------------- tests/regression/tools/health/Makefile.am | 3 -- tests/regression/tools/health/runall | 33 ---------------- tests/regression/tools/run.sh | 40 ++++++++++++++++++++ tests/regression/tools/runall.sh | 29 -------------- tests/regression/tools/streaming/Makefile.am | 4 +- tests/regression/tools/streaming/runall | 28 -------------- 9 files changed, 45 insertions(+), 129 deletions(-) delete mode 100755 tests/regression/tools/filtering/runall delete mode 100755 tests/regression/tools/health/runall create mode 100755 tests/regression/tools/run.sh delete mode 100755 tests/regression/tools/runall.sh delete mode 100755 tests/regression/tools/streaming/runall diff --git a/tests/regression/tools/Makefile.am b/tests/regression/tools/Makefile.am index ccfbd34ac..9065a3764 100644 --- a/tests/regression/tools/Makefile.am +++ b/tests/regression/tools/Makefile.am @@ -1,6 +1,3 @@ SUBDIRS = streaming filtering health -AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils -g -Wall -AM_LDFLAGS = -lurcu - -EXTRA_DIST = runall.sh +EXTRA_DIST = run.sh diff --git a/tests/regression/tools/filtering/Makefile.am b/tests/regression/tools/filtering/Makefile.am index 23bce0005..5629da244 100644 --- a/tests/regression/tools/filtering/Makefile.am +++ b/tests/regression/tools/filtering/Makefile.am @@ -14,5 +14,5 @@ gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h gen_ust_events_LDADD = -llttng-ust endif -noinst_SCRIPTS = runall test_unsupported_op test_invalid_filter test_valid_filter babelstats.pl -EXTRA_DIST = runall test_unsupported_op test_invalid_filter test_valid_filter babelstats.pl +noinst_SCRIPTS = test_unsupported_op test_invalid_filter test_valid_filter babelstats.pl +EXTRA_DIST = test_unsupported_op test_invalid_filter test_valid_filter babelstats.pl diff --git a/tests/regression/tools/filtering/runall b/tests/regression/tools/filtering/runall deleted file mode 100755 index cda9799ef..000000000 --- a/tests/regression/tools/filtering/runall +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -tests=( $DIR/test_unsupported_op $DIR/test_invalid_filter $DIR/test_valid_filter ) -exit_code=0 - -function start_tests () -{ - for bin in ${tests[@]}; - do - if [ ! -e $bin ]; then - echo -e "$bin not found, passing" - continue - fi - - ./$bin - # Test must return 0 to pass. - if [ $? -ne 0 ]; then - exit_code=1 - break - fi - done -} - -start_tests - -exit $exit_code diff --git a/tests/regression/tools/health/Makefile.am b/tests/regression/tools/health/Makefile.am index 1a0a8f6d1..94e54dfaf 100644 --- a/tests/regression/tools/health/Makefile.am +++ b/tests/regression/tools/health/Makefile.am @@ -36,6 +36,3 @@ health_check_SOURCES = health_check.c $(UTILS) health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ $(top_builddir)/src/common/libcommon.la endif - -noinst_SCRIPTS = runall -EXTRA_DIST = runall diff --git a/tests/regression/tools/health/runall b/tests/regression/tools/health/runall deleted file mode 100755 index 0ed0c8e83..000000000 --- a/tests/regression/tools/health/runall +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -tests=( $DIR/test_thread_exit $DIR/test_thread_stall $DIR/test_tp_fail) -exit_code=0 - -function start_tests () -{ - for bin in ${tests[@]}; - do - if [ ! -e $bin ]; then - echo -e "$bin not found, passing" - continue - fi - - ./$bin - # Test must return 0 to pass. - if [ $? -ne 0 ]; then - exit_code=1 - break - fi - done -} - -if [ "$(id -u)" != "0" ]; then - echo -e "Need root for health test." - exit 0 -fi - -start_tests - -exit $exit_code diff --git a/tests/regression/tools/run.sh b/tests/regression/tools/run.sh new file mode 100755 index 000000000..63154ac26 --- /dev/null +++ b/tests/regression/tools/run.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2013 - Christian Babeux +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; only version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +DIR=$(dirname $0) +TESTDIR=$DIR/../.. +source $TESTDIR/utils/runner.sh + +#### ADD TESTS HERE #### + +tests=( $DIR/filtering/test_invalid_filter + $DIR/filtering/test_unsupported_op + $DIR/filtering/test_valid_filter + $DIR/health/test_thread_exit + $DIR/health/test_thread_stall + $DIR/health/test_tp_fail + $DIR/streaming/test_kernel + $DIR/streaming/test_ust + $DIR/streaming/test_uri_switch + $DIR/streaming/test_high_throughput_limits ) + +#### END TESTS HERE #### + +opts=("$@") +run_tests tests[@] opts[@] diff --git a/tests/regression/tools/runall.sh b/tests/regression/tools/runall.sh deleted file mode 100755 index 5d505d9b8..000000000 --- a/tests/regression/tools/runall.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -tests=( $DIR/streaming/runall $DIR/health/runall $DIR/filtering/runall ) - -exit_code=0 - -function start_tests () -{ - for bin in ${tests[@]}; - do - if [ ! -e $bin ]; then - echo -e "$bin not found, passing" - continue - fi - - ./$bin - # Test must return 0 to pass. - if [ $? -ne 0 ]; then - exit_code=1 - break - fi - done -} - -start_tests - -exit $exit_code diff --git a/tests/regression/tools/streaming/Makefile.am b/tests/regression/tools/streaming/Makefile.am index 1949f669b..2dbb4d5ab 100644 --- a/tests/regression/tools/streaming/Makefile.am +++ b/tests/regression/tools/streaming/Makefile.am @@ -14,5 +14,5 @@ gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h gen_ust_events_LDADD = -llttng-ust endif -noinst_SCRIPTS = runall test_ust test_kernel test_uri_switch test_high_throughput_limits -EXTRA_DIST = runall test_ust test_kernel test_uri_switch test_high_throughput_limits +noinst_SCRIPTS = test_ust test_kernel test_uri_switch test_high_throughput_limits +EXTRA_DIST = test_ust test_kernel test_uri_switch test_high_throughput_limits diff --git a/tests/regression/tools/streaming/runall b/tests/regression/tools/streaming/runall deleted file mode 100755 index 809449bf3..000000000 --- a/tests/regression/tools/streaming/runall +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -tests=( $DIR/test_uri_switch $DIR/test_kernel $DIR/test_ust ) -exit_code=0 - -function start_tests () -{ - for bin in ${tests[@]}; - do - if [ ! -e $bin ]; then - echo -e "$bin not found, passing" - continue - fi - - ./$bin - # Test must return 0 to pass. - if [ $? -ne 0 ]; then - exit_code=1 - break - fi - done -} - -start_tests - -exit $exit_code -- 2.34.1