Skip to contentSkip to conversation

Tests: Added autoloading session test cases

PATCH Jonathan Rajotte-Julien 2 participants 2 messages May 14, 2018 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Anders

Thanks for proposing this patch.

We will need more context here. Are those currently failing and exposing a problem?

See comments inline.

Quoted 25 lines · Anders Wallin
---
 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
tests/fast_regression +1 -0
index bbce068f..2f02f872 100644
@@ -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
tests/regression/tools/save-load/test_autoload new file +0 -0
new file mode 100755
index 00000000..ea1210de

tests/regression/tools/save-load/test_autoload line 3

Quoted 3 lines
tests/regression/tools/save-load/test_autoload new file +3 -0
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# Copyright (C) - 2014 David Goulet <[email protected]>

I doubt dgoulet wrote this file :). Even if this was "copied" from another test plan the majority of the test plan was written/contributed by you. Your name and email should be there.

Quoted 5 lines
tests/regression/tools/save-load/test_autoload new file +5 -0
+#
+# 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.
+#

tests/regression/tools/save-load/test_autoload line 18

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+# 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)"

Should reflect the overall test: "Auto load session(s)"

Quoted 15 lines
tests/regression/tools/save-load/test_autoload new file +15 -0
+
+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
+

tests/regression/tools/save-load/test_autoload line 43

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+# 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

The stop_lttng_sessiond should be moved at the end of each sub test.

tests/regression/tools/save-load/test_autoload line 47

Quoted 4 lines
tests/regression/tools/save-load/test_autoload new file +4 -0
+	export LTTNG_HOME=
+
+	start_lttng_sessiond $CURDIR/load-42.lttng
+	list_lttng_with_opts load-42

Put stop_lttng_sessiond here.

tests/regression/tools/save-load/test_autoload line 57

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+}
+
+function test_auto_load_dir()
+{
+	diag "Test auto load directory"
+
+	stop_lttng_sessiond
+
+	export LTTNG_HOME=
+	export LTTNG_DIR=/tmp/lttng_home

Use "mktemp -d" here.

Quoted 6 lines
tests/regression/tools/save-load/test_autoload new file +6 -0
+	mkdir -p $LTTNG_DIR
+	cp -f $CURDIR/load-42.lttng $LTTNG_DIR/
+
+	start_lttng_sessiond $LTTNG_DIR
+	list_lttng_with_opts load-42
+

tests/regression/tools/save-load/test_autoload line 73

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+	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

Use "mktemp -d" here.

tests/regression/tools/save-load/test_autoload line 80

Quoted 7 lines
tests/regression/tools/save-load/test_autoload new file +7 -0
+	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

Make sure to remove the complete LTTNG_HOME directory.

Quoted 11 lines
tests/regression/tools/save-load/test_autoload new file +11 -0
+}
+
+TESTS=(
+	test_auto_load_file
+	test_auto_load_dir
+	test_auto_load_lttng_home
+)
+
+for fct_test in ${TESTS[@]};
+do
+	TRACE_PATH=$(mktemp -d)

tests/regression/tools/save-load/test_autoload line 101

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+
+	${fct_test}
+	if [ $? -ne 0 ]; then
+		break;
+	fi
+	# Only delete if successful
+	rm -rf $TRACE_PATH
+done
+
+stop_lttng_sessiond

Remove this.

Quoted 7 lines
Signature · 6 lines
2.17.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 6 lines
Jonathan Rajotte-Julien
EfficiOS
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): 20180514161658.GB9461@joraj-alpa

#3 lore raw

Hi,

I will update the patch and resend it tomorrow

Regards
Anders

mån 14 maj 2018 kl 18:17 skrev Jonathan Rajotte-Julien < [email protected]>:

Quoted 7 lines

Hi Anders

Thanks for proposing this patch.

We will need more context here. Are those currently failing and exposing a problem?

Yes, lttng-tools 2.10.4 is broken when having auto-load sessions, see
https://lists.lttng.org/pipermail/lttng-dev/2018-May/028014.html

I will add a longer commit message

Quoted 26 lines

See comments inline.

Review

Quoted 20 lines · Anders Wallin
---
 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
tests/fast_regression +1 -0
index bbce068f..2f02f872 100644
@@ -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
(quoted diff) +0 -0

b/tests/regression/tools/save-load/test_autoload

Quoted 14 lines

tests/regression/tools/save-load/test_autoload line 3

Quoted 8 lines

new file mode 100755
index 00000000..ea1210de

tests/regression/tools/save-load/test_autoload new file +3 -0
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# Copyright (C) - 2014 David Goulet <[email protected]>

I doubt dgoulet wrote this file :). Even if this was "copied" from another test
plan the majority of the test plan was written/contributed by you. Your name and email should be there.

Ok

Quoted 18 lines

tests/regression/tools/save-load/test_autoload line 5

Quoted 3 lines
tests/regression/tools/save-load/test_autoload new file +2 -0
+#
+# This library is free software; you can redistribute it and/or modify

it under

tests/regression/tools/save-load/test_autoload line 6

Quoted 1 line
tests/regression/tools/save-load/test_autoload new file +1 -0
+# the terms of the GNU Lesser General Public License as published by

the Free

tests/regression/tools/save-load/test_autoload line 9

Quoted 3 lines
tests/regression/tools/save-load/test_autoload new file +3 -0
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but

WITHOUT

tests/regression/tools/save-load/test_autoload line 10

Quoted 1 line
tests/regression/tools/save-load/test_autoload new file +1 -0
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

FITNESS

tests/regression/tools/save-load/test_autoload line 11

Quoted 1 line
tests/regression/tools/save-load/test_autoload new file +1 -0
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License

for more

tests/regression/tools/save-load/test_autoload line 14

Quoted 3 lines
tests/regression/tools/save-load/test_autoload new file +3 -0
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public

License

Quoted 8 lines

tests/regression/tools/save-load/test_autoload line 15

Quoted 1 line
tests/regression/tools/save-load/test_autoload new file +1 -0
+# along with this library; if not, write to the Free Software

Foundation, Inc.,

tests/regression/tools/save-load/test_autoload line 18

Quoted 3 lines
tests/regression/tools/save-load/test_autoload new file +3 -0
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+TEST_DESC="Load session(s)"

Should reflect the overall test: "Auto load session(s)"

OK

Quoted 21 lines

tests/regression/tools/save-load/test_autoload line 26

Quoted 9 lines
tests/regression/tools/save-load/test_autoload new file +8 -0
+
+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/)

Quoted 11 lines
tests/regression/tools/save-load/test_autoload new file +11 -0
+
+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"
Quoted 9 lines

tests/regression/tools/save-load/test_autoload line 43

Quoted 6 lines
tests/regression/tools/save-load/test_autoload new file +6 -0
+
+function test_auto_load_file()
+{
+     diag "Test auto load file"
+
+     stop_lttng_sessiond

The stop_lttng_sessiond should be moved at the end of each sub test.

Ok, but I need one stop_lttng_session before the test, since it can't be any lttng_sessiond
running when starting the tests.

Quoted 8 lines

tests/regression/tools/save-load/test_autoload line 47

Quoted 5 lines
tests/regression/tools/save-load/test_autoload new file +4 -0
+     export LTTNG_HOME=
+
+     start_lttng_sessiond $CURDIR/load-42.lttng
+     list_lttng_with_opts load-42

Put stop_lttng_sessiond here.

Quoted 13 lines

tests/regression/tools/save-load/test_autoload line 57

Quoted 10 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+}
+
+function test_auto_load_dir()
+{
+     diag "Test auto load directory"
+
+     stop_lttng_sessiond
+
+     export LTTNG_HOME=
+     export LTTNG_DIR=/tmp/lttng_home

Use "mktemp -d" here.

OK

Quoted 11 lines
Quoted 11 lines
tests/regression/tools/save-load/test_autoload new file +10 -0
+     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()
Quoted 9 lines

tests/regression/tools/save-load/test_autoload line 73

Quoted 6 lines
tests/regression/tools/save-load/test_autoload new file +6 -0
+{
+     diag "Test auto load by setting LTTNG_HOME"
+
+     stop_lttng_sessiond
+
+     export LTTNG_HOME=/tmp/lttng_home

Use "mktemp -d" here.

OK

Quoted 11 lines

tests/regression/tools/save-load/test_autoload line 80

Quoted 8 lines
tests/regression/tools/save-load/test_autoload new file +7 -0
+     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

Make sure to remove the complete LTTNG_HOME directory.

OK

Quoted 16 lines
Quoted 16 lines
tests/regression/tools/save-load/test_autoload new file +15 -0
+}
+
+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;
Quoted 9 lines

tests/regression/tools/save-load/test_autoload line 101

Quoted 6 lines
tests/regression/tools/save-load/test_autoload new file +6 -0
+     fi
+     # Only delete if successful
+     rm -rf $TRACE_PATH
+done
+
+stop_lttng_sessiond

Remove this.

OK

Quoted 4 lines
Quoted 4 lines

--
2.17.0

Quoted 9 lines
Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Jonathan Rajotte-Julien
EfficiOS

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev