This commit integrates the tests to the fast make check.
Fixes #757
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/regression/tools/snapshots/Makefile
tests/regression/tools/live/Makefile
tests/regression/tools/exclusion/Makefile
+ tests/regression/tools/save-load/Makefile
tests/regression/ust/Makefile
tests/regression/ust/nprocesses/Makefile
tests/regression/ust/high-throughput/Makefile
regression/tools/exclusion/test_exclusion
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/ust/before-after/test_before_after
regression/ust/buffers-pid/test_buffers_pid
regression/ust/multi-session/test_multi_session
-SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion
+SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<sessions>
+ <session>
+ <name>save-42</name>
+ <domains>
+ <domain>
+ <type>UST</type>
+ <buffer_type>PER_UID</buffer_type>
+ <channels>
+ <channel>
+ <name>chan1</name>
+ <enabled>true</enabled>
+ <overwrite_mode>DISCARD</overwrite_mode>
+ <subbuffer_size>131072</subbuffer_size>
+ <subbuffer_count>4</subbuffer_count>
+ <switch_timer_interval>0</switch_timer_interval>
+ <read_timer_interval>0</read_timer_interval>
+ <output_type>MMAP</output_type>
+ <tracefile_size>0</tracefile_size>
+ <tracefile_count>0</tracefile_count>
+ <live_timer_interval>0</live_timer_interval>
+ <events>
+ <event>
+ <name>tp:tptest</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>ALL</loglevel_type>
+ <loglevel>-1</loglevel>
+ </event>
+ </events>
+ <contexts/>
+ </channel>
+ </channels>
+ </domain>
+ </domains>
+ <started>false</started>
+ <output>
+ <consumer_output>
+ <enabled>true</enabled>
+ <destination>
+ <path>/tmp/tmp.eAJ1f0oCZE</path>
+ </destination>
+ </consumer_output>
+ </output>
+ </session>
+</sessions>
--- /dev/null
+noinst_SCRIPTS = test_save test_load
+EXTRA_DIST = $(noinst_SCRIPTS)
+
+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
+<?xml version="1.0" encoding="UTF-8"?>
+<sessions>
+ <session>
+ <name>load-42-complex</name>
+ <domains>
+ <domain>
+ <type>UST</type>
+ <buffer_type>PER_UID</buffer_type>
+ <channels>
+ <channel>
+ <name>chan3</name>
+ <enabled>true</enabled>
+ <overwrite_mode>DISCARD</overwrite_mode>
+ <subbuffer_size>262144</subbuffer_size>
+ <subbuffer_count>4</subbuffer_count>
+ <switch_timer_interval>0</switch_timer_interval>
+ <read_timer_interval>200000</read_timer_interval>
+ <output_type>MMAP</output_type>
+ <tracefile_size>0</tracefile_size>
+ <tracefile_count>0</tracefile_count>
+ <live_timer_interval>1000000</live_timer_interval>
+ <events>
+ <event>
+ <name>uevent3*</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>ALL</loglevel_type>
+ <loglevel>-1</loglevel>
+ <exclusions>
+ <exclusion>uevent3-42</exclusion>
+ </exclusions>
+ </event>
+ <event>
+ <name>uevent3*</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>ALL</loglevel_type>
+ <loglevel>-1</loglevel>
+ </event>
+ </events>
+ <contexts/>
+ </channel>
+ <channel>
+ <name>chan2</name>
+ <enabled>true</enabled>
+ <overwrite_mode>DISCARD</overwrite_mode>
+ <subbuffer_size>131072</subbuffer_size>
+ <subbuffer_count>4</subbuffer_count>
+ <switch_timer_interval>0</switch_timer_interval>
+ <read_timer_interval>0</read_timer_interval>
+ <output_type>MMAP</output_type>
+ <tracefile_size>131072</tracefile_size>
+ <tracefile_count>14</tracefile_count>
+ <live_timer_interval>1000000</live_timer_interval>
+ <events>
+ <event>
+ <name>uevent2</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>RANGE</loglevel_type>
+ <loglevel>6</loglevel>
+ </event>
+ </events>
+ <contexts/>
+ </channel>
+ <channel>
+ <name>chan1</name>
+ <enabled>true</enabled>
+ <overwrite_mode>DISCARD</overwrite_mode>
+ <subbuffer_size>131072</subbuffer_size>
+ <subbuffer_count>16</subbuffer_count>
+ <switch_timer_interval>0</switch_timer_interval>
+ <read_timer_interval>0</read_timer_interval>
+ <output_type>MMAP</output_type>
+ <tracefile_size>0</tracefile_size>
+ <tracefile_count>0</tracefile_count>
+ <live_timer_interval>1000000</live_timer_interval>
+ <events>
+ <event>
+ <name>uevent1</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>ALL</loglevel_type>
+ <loglevel>-1</loglevel>
+ <filter>$ctx.procname == "test"</filter>
+ </event>
+ </events>
+ <contexts/>
+ </channel>
+ </channels>
+ </domain>
+ </domains>
+ <started>false</started>
+ <attributes>
+ <live_timer_interval>1000000</live_timer_interval>
+ </attributes>
+ <output>
+ <consumer_output>
+ <enabled>true</enabled>
+ <destination>
+ <net_output>
+ <control_uri>tcp4://127.0.0.1:8172/</control_uri>
+ 
+ </net_output>
+ </destination>
+ </consumer_output>
+ </output>
+ </session>
+</sessions>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<sessions>
+ <session>
+ <name>load-42</name>
+ <domains>
+ <domain>
+ <type>UST</type>
+ <buffer_type>PER_UID</buffer_type>
+ <channels>
+ <channel>
+ <name>channel0</name>
+ <enabled>true</enabled>
+ <overwrite_mode>DISCARD</overwrite_mode>
+ <subbuffer_size>131072</subbuffer_size>
+ <subbuffer_count>4</subbuffer_count>
+ <switch_timer_interval>0</switch_timer_interval>
+ <read_timer_interval>0</read_timer_interval>
+ <output_type>MMAP</output_type>
+ <tracefile_size>0</tracefile_size>
+ <tracefile_count>0</tracefile_count>
+ <live_timer_interval>0</live_timer_interval>
+ <events>
+ <event>
+ <name>*</name>
+ <enabled>true</enabled>
+ <type>TRACEPOINT</type>
+ <loglevel_type>ALL</loglevel_type>
+ <loglevel>-1</loglevel>
+ </event>
+ </events>
+ <contexts/>
+ </channel>
+ </channels>
+ </domain>
+ </domains>
+ <started>false</started>
+ <output>
+ <consumer_output>
+ <enabled>true</enabled>
+ <destination>
+ <path>/tmp/lttng/load-42-1</path>
+ </destination>
+ </consumer_output>
+ </output>
+ </session>
+</sessions>
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2014 David Goulet <dgoulet@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)/
+TESTDIR=$CURDIR/../../../
+SESSIOND_BIN="lttng-sessiond"
+RELAYD_BIN="lttng-relayd"
+LTTNG_BIN="lttng"
+
+SESSION_NAME="load-42"
+EVENT_NAME="tp:tptest"
+
+DIR=$(readlink -f $TESTDIR)
+
+NUM_TESTS=20
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+function disable_event()
+{
+ local sess_name="$1"
+ local chan_name="$2"
+ local event_name="$3"
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -c $chan_name -u >/dev/null 2>&1
+ ok $? "Disable event $event_name for session $sess_name"
+}
+
+function test_basic_load()
+{
+ diag "Test basic load"
+
+ lttng_load "-s $SESSION_NAME -i $CURDIR"
+
+ destroy_lttng_session $SESSION_NAME
+}
+
+function test_complex_load()
+{
+ local sess="$SESSION_NAME-complex"
+ diag "Test complex load"
+
+ # Start relayd with localhost binding. The complex session uses those
+ # custom values.
+ start_lttng_relayd "-C tcp://localhost:8172 -D tcp://localhost:9817"
+
+ lttng_load "-s $sess -i $CURDIR"
+
+ # Once loaded, we are suppose to be able to disable certain events/channels
+ # thus having a confirmation that it's valid
+ disable_event $sess chan1 uevent1
+ disable_event $sess chan2 uevent2
+ disable_event $sess chan3 uevent3*
+
+ disable_ust_lttng_channel $sess chan1
+ disable_ust_lttng_channel $sess chan2
+ disable_ust_lttng_channel $sess chan3
+
+ destroy_lttng_session $sess
+
+ stop_lttng_relayd_nocheck
+}
+
+function test_all_load()
+{
+ diag "Test load all sessions"
+
+ # Start relayd with localhost binding. The complex session uses those
+ # custom values.
+ start_lttng_relayd "-C tcp://localhost:8172 -D tcp://localhost:9817"
+
+ lttng_load "-a -i $CURDIR"
+
+ destroy_lttng_session $SESSION_NAME
+ destroy_lttng_session "$SESSION_NAME-complex"
+
+ stop_lttng_relayd_nocheck
+}
+
+function test_overwrite()
+{
+ diag "Test load overwrite"
+
+ lttng_load "-s $SESSION_NAME -i $CURDIR"
+
+ # This one should succeed
+ lttng_load "-f -s $SESSION_NAME -i $CURDIR"
+
+ destroy_lttng_session $SESSION_NAME
+}
+
+start_lttng_sessiond
+
+TESTS=(
+ test_basic_load
+ test_complex_load
+ test_all_load
+ test_overwrite
+)
+
+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
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2014 David Goulet <dgoulet@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="Save session(s)"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../../
+SESSIOND_BIN="lttng-sessiond"
+RELAYD_BIN="lttng-relayd"
+LTTNG_BIN="lttng"
+
+SESSION_NAME="save-42"
+CHANNEL_NAME="chan-save"
+EVENT_NAME="tp:tptest"
+
+DIR=$(readlink -f $TESTDIR)
+
+NUM_TESTS=37
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+# Expected to fail
+function save_lttng_fail()
+{
+ local sess_name=$1
+ local opts=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ ok 0 "Session failed to be saved. Expected!"
+ else
+ ok 1 "Session has been saved. NOT expected!"
+ fi
+}
+
+function is_session_saved()
+{
+ local path=$1
+ local name=$2
+
+ [ -f "$path/$name.lttng" ];
+ ok $? "Session $name.lttng file found!"
+}
+
+function test_basic_save()
+{
+ diag "Test basic save"
+
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME
+ enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+
+ lttng_save $SESSION_NAME "-o $TRACE_PATH"
+
+ is_session_saved $TRACE_PATH $SESSION_NAME
+
+ destroy_lttng_session $SESSION_NAME
+}
+
+function test_basic_save_all()
+{
+ diag "Test basic save all"
+
+ create_lttng_session $SESSION_NAME-1 $TRACE_PATH
+ create_lttng_session $SESSION_NAME-2 $TRACE_PATH
+ create_lttng_session $SESSION_NAME-3 $TRACE_PATH
+
+ enable_ust_lttng_channel $SESSION_NAME-1 $CHANNEL_NAME
+ enable_ust_lttng_channel $SESSION_NAME-2 $CHANNEL_NAME
+ enable_ust_lttng_channel $SESSION_NAME-3 $CHANNEL_NAME
+
+ enable_ust_lttng_event $SESSION_NAME-1 $EVENT_NAME $CHANNEL_NAME
+ enable_ust_lttng_event $SESSION_NAME-2 $EVENT_NAME $CHANNEL_NAME
+ enable_ust_lttng_event $SESSION_NAME-3 $EVENT_NAME $CHANNEL_NAME
+
+ lttng_save "" "-a -o $TRACE_PATH"
+
+ is_session_saved $TRACE_PATH $SESSION_NAME-1
+ is_session_saved $TRACE_PATH $SESSION_NAME-2
+ is_session_saved $TRACE_PATH $SESSION_NAME-3
+
+ destroy_lttng_session $SESSION_NAME-1
+ destroy_lttng_session $SESSION_NAME-2
+ destroy_lttng_session $SESSION_NAME-3
+}
+
+function test_overwrite()
+{
+ diag "Test overwrite session file"
+
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME
+ enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+
+ lttng_save $SESSION_NAME "-o $TRACE_PATH"
+
+ is_session_saved $TRACE_PATH $SESSION_NAME
+
+ destroy_lttng_session $SESSION_NAME
+
+ # Create a new session with same name so we can force the overwrite
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_ust_lttng_channel $SESSION_NAME $CHANNEL_NAME
+ enable_ust_lttng_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+
+ # This one MUST fail
+ save_lttng_fail $SESSION_NAME "-o $TRACE_PATH"
+
+ # This one MUST succeed
+ lttng_save $SESSION_NAME "-f -o $TRACE_PATH"
+
+ is_session_saved $TRACE_PATH $SESSION_NAME
+
+ destroy_lttng_session $SESSION_NAME
+}
+
+start_lttng_sessiond
+
+TESTS=(
+ test_basic_save
+ test_basic_save_all
+ test_overwrite
+)
+
+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
ok $? "Snapshot recorded"
}
+function lttng_save()
+{
+ local sess_name=$1
+ local opts=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >/dev/null 2>&1
+ ok $? "Session successfully saved"
+}
+
+function lttng_load()
+{
+ local opts=$1
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN load $opts >/dev/null 2>&1
+ ok $? "Load command successful"
+}
+
function trace_matches ()
{
event_name=$1