tests/regression/tools/wildcard/Makefile
tests/regression/tools/crash/Makefile
tests/regression/tools/regen-metadata/Makefile
+ tests/regression/tools/regen-statedump/Makefile
tests/regression/ust/Makefile
tests/regression/ust/nprocesses/Makefile
tests/regression/ust/high-throughput/Makefile
regression/tools/wildcard/test_event_wildcard
regression/tools/crash/test_crash
regression/tools/regen-metadata/test_ust
+regression/tools/regen-statedump/test_ust
regression/ust/before-after/test_before_after
regression/ust/buffers-pid/test_buffers_pid
regression/ust/multi-session/test_multi_session
tools/mi/test_mi \
tools/wildcard/test_event_wildcard \
tools/crash/test_crash \
- tools/regen-metadata/test_ust
+ tools/regen-metadata/test_ust \
+ tools/regen-statedump/test_ust
if HAVE_LIBLTTNG_UST_CTL
SUBDIRS += ust
SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \
- wildcard crash regen-metadata
+ wildcard crash regen-metadata regen-statedump
--- /dev/null
+noinst_SCRIPTS = test_ust test_kernel
+EXTRA_DIST = test_ust test_kernel
+
+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
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <jdesfossez@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="Regenerate the statedump - Kernel tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+EVENT_NAME="lttng_test_filter_event"
+PID_RELAYD=0
+SESSION_NAME=""
+EVENT_NAME="lttng_statedump_start,lttng_statedump_end"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=11
+
+source $TESTDIR/utils/utils.sh
+
+# LTTng kernel modules check
+out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
+if [ -z "$out" ]; then
+ BAIL_OUT "LTTng modules not detected."
+fi
+
+function test_kernel_local ()
+{
+ diag "Test kernel local with statedump regeneration"
+ create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
+ start_lttng_tracing_ok $SESSION_NAME
+ echo -n "100" > /proc/lttng-test-filter-event
+ regenerate_statedump_ok $SESSION_NAME
+ stop_lttng_tracing_ok $SESSION_NAME
+ validate_trace_count $EVENT_NAME $TRACE_PATH 4
+ if [ $? -eq 0 ]; then
+ # Only delete if successful
+ rm -rf $TRACE_PATH
+ fi
+ destroy_lttng_session_ok $SESSION_NAME
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+if [ "$(id -u)" == "0" ]; then
+ isroot=1
+else
+ isroot=0
+fi
+
+skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+{
+ start_lttng_sessiond
+ modprobe lttng-test
+
+ tests=( test_kernel_local )
+
+ for fct_test in ${tests[@]};
+ do
+ SESSION_NAME=$(randstring 16 0)
+ ${fct_test}
+ done
+
+ rmmod lttng-test
+ stop_lttng_sessiond
+}
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <jdesfossez@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="Regenerate the statedump - User-space tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+NR_ITER=10
+NR_USEC_WAIT=0
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+SESSION_NAME="stream"
+EVENT_NAME="lttng_ust_statedump:start,lttng_ust_statedump:end"
+PID_RELAYD=0
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=11
+
+source $TESTDIR/utils/utils.sh
+
+if [ ! -x "$TESTAPP_BIN" ]; then
+ BAIL_OUT "No UST events binary detected."
+fi
+
+function test_ust_local ()
+{
+ local file_sync_after_first=$(mktemp -u)
+ local file_sync_before_last=$(mktemp -u)
+
+ diag "Test UST local with statedump regeneration"
+ create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
+
+ $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 &
+
+ start_lttng_tracing_ok $SESSION_NAME
+
+ while [ ! -f "${file_sync_after_first}" ]; do
+ sleep 0.5
+ done
+
+ regenerate_statedump_ok $SESSION_NAME
+
+ touch ${file_sync_before_last}
+
+ stop_lttng_tracing_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
+ # Validate test
+ validate_trace_count $EVENT_NAME $TRACE_PATH 4
+ if [ $? -eq 0 ]; then
+ # Only delete if successful
+ rm -rf $TRACE_PATH
+ fi
+ rm -f ${file_sync_after_first}
+ rm -f ${file_sync_before_last}
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_sessiond
+
+tests=( test_ust_local )
+
+for fct_test in ${tests[@]};
+do
+ SESSION_NAME=$(randstring 16 0)
+ ${fct_test}
+done
+
+stop_lttng_sessiond
+
+exit $out
regression/tools/filtering/test_valid_filter
regression/tools/wildcard/test_event_wildcard
regression/tools/regen-metadata/test_kernel
+regression/tools/regen-statedump/test_kernel
regression/ust/test_event_perf
return $ret
}
+function validate_trace_count
+{
+ local event_name=$1
+ local trace_path=$2
+ local expected_count=$3
+
+ which $BABELTRACE_BIN >/dev/null
+ if [ $? -ne 0 ]; then
+ skip 0 "Babeltrace binary not found. Skipping trace validation"
+ fi
+
+ cnt=0
+ OLDIFS=$IFS
+ IFS=","
+ for i in $event_name; do
+ traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep $i | wc -l)
+ if [ "$traced" -ne 0 ]; then
+ pass "Validate trace for event $i, $traced events"
+ else
+ fail "Validate trace for event $i"
+ diag "Found $traced occurences of $i"
+ fi
+ cnt=$(($cnt + $traced))
+ done
+ IFS=$OLDIFS
+ test $cnt -eq $expected_count
+ ok $? "Read a total of $cnt events, expected $expected_count"
+}
+
function trace_first_line
{
local trace_path=$1
regenerate_metadata 1 "$@"
}
+function regenerate_statedump ()
+{
+ local expected_to_fail=$1
+ local sess_name=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN regenerate statedump -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ ret=$?
+ if [[ $expected_to_fail -eq "1" ]]; then
+ test "$ret" -ne "0"
+ ok $? "Expected fail on regenerate statedump $sess_name"
+ else
+ ok $ret "Metadata regenerate $sess_name"
+ fi
+}
+
+function regenerate_statedump_ok ()
+{
+ regenerate_statedump 0 "$@"
+}
+
+function regenerate_statedump_fail ()
+{
+ regenerate_statedump 1 "$@"
+}
+
function destructive_tests_enabled ()
{
if [ ${LTTNG_ENABLE_DESTRUCTIVE_TESTS} = "will-break-my-system" ]; then