[lttng-dev] [PATCH lttng-tools] Tests: Added autoloading session test cases
Anders Wallin
wallinux at gmail.com
Mon May 14 11:30:53 EDT 2018
Signed-off-by: Anders Wallin <wallinux at gmail.com>
---
tests/fast_regression | 1 +
.../regression/tools/save-load/test_autoload | 101 ++++++++++++++++++
2 files changed, 102 insertions(+)
create mode 100755 tests/regression/tools/save-load/test_autoload
diff --git a/tests/fast_regression b/tests/fast_regression
index bbce068f..2f02f872 100644
--- a/tests/fast_regression
+++ b/tests/fast_regression
@@ -13,6 +13,7 @@ regression/tools/snapshots/test_ust_fast
regression/tools/snapshots/test_ust_streaming
regression/tools/save-load/test_save
regression/tools/save-load/test_load
+regression/tools/save-load/test_autoload
regression/tools/mi/test_mi
regression/tools/wildcard/test_event_wildcard
regression/tools/crash/test_crash
diff --git a/tests/regression/tools/save-load/test_autoload b/tests/regression/tools/save-load/test_autoload
new file mode 100755
index 00000000..ea1210de
--- /dev/null
+++ b/tests/regression/tools/save-load/test_autoload
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# Copyright (C) - 2014 David Goulet <dgoulet at efficios.com>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library 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 Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+TEST_DESC="Load session(s)"
+
+CURDIR=$(dirname $0)/
+CONFIG_DIR="${CURDIR}/configuration"
+TESTDIR=$CURDIR/../../../
+SESSIOND_BIN="lttng-sessiond"
+RELAYD_BIN="lttng-relayd"
+LTTNG_BIN="lttng"
+export LTTNG_SESSION_CONFIG_XSD_PATH=$(readlink -m ${TESTDIR}../src/common/config/)
+
+DIR=$(readlink -f $TESTDIR)
+
+NUM_TESTS=10
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+function test_auto_load_file()
+{
+ diag "Test auto load file"
+
+ stop_lttng_sessiond
+ export LTTNG_HOME=
+
+ start_lttng_sessiond $CURDIR/load-42.lttng
+ list_lttng_with_opts load-42
+}
+
+function test_auto_load_dir()
+{
+ diag "Test auto load directory"
+
+ stop_lttng_sessiond
+
+ export LTTNG_HOME=
+ export LTTNG_DIR=/tmp/lttng_home
+ mkdir -p $LTTNG_DIR
+ cp -f $CURDIR/load-42.lttng $LTTNG_DIR/
+
+ start_lttng_sessiond $LTTNG_DIR
+ list_lttng_with_opts load-42
+
+ rm -rf $LTTNG_DIR
+}
+
+function test_auto_load_lttng_home()
+{
+ diag "Test auto load by setting LTTNG_HOME"
+
+ stop_lttng_sessiond
+
+ export LTTNG_HOME=/tmp/lttng_home
+ mkdir -p $LTTNG_HOME/.lttng/sessions/auto
+ cp -f $CURDIR/load-42.lttng $LTTNG_HOME/.lttng/sessions/auto
+
+ start_lttng_sessiond
+ list_lttng_with_opts load-42
+
+ rm -rf $LTTNG_HOME/.lttng/sessions/auto
+}
+
+TESTS=(
+ test_auto_load_file
+ test_auto_load_dir
+ test_auto_load_lttng_home
+)
+
+for fct_test in ${TESTS[@]};
+do
+ TRACE_PATH=$(mktemp -d)
+
+ ${fct_test}
+ if [ $? -ne 0 ]; then
+ break;
+ fi
+ # Only delete if successful
+ rm -rf $TRACE_PATH
+done
+
+stop_lttng_sessiond
--
2.17.0
More information about the lttng-dev
mailing list