test_ust_data_trace
kernel_all_events_basic
kernel_event_basic
-ust_global_all_events_basic
+ust_global_event_wildcard
ust_global_event_basic
gen-nevents
gen-events-time
if (kevent == NULL) {
ret = kernel_create_event(event, kchan);
if (ret < 0) {
- if (ret == -EEXIST) {
+ switch (-ret) {
+ case EEXIST:
ret = LTTCOMM_KERN_EVENT_EXIST;
- } else {
+ break;
+ case ENOSYS:
+ ret = LTTCOMM_KERN_EVENT_ENOSYS;
+ break;
+ default:
ret = LTTCOMM_KERN_ENABLE_FAIL;
+ break;
}
goto end;
}
int event_kernel_enable_all(struct ltt_kernel_session *ksession,
struct ltt_kernel_channel *kchan, int kernel_tracer_fd)
{
- int ret;
+ int tp_ret;
- ret = event_kernel_enable_all_tracepoints(ksession, kchan, kernel_tracer_fd);
- if (ret != LTTCOMM_OK) {
+ tp_ret = event_kernel_enable_all_tracepoints(ksession, kchan, kernel_tracer_fd);
+ if (tp_ret != LTTCOMM_OK) {
goto end;
}
- ret = event_kernel_enable_all_syscalls(ksession, kchan, kernel_tracer_fd);
+
+ /*
+ * Reaching this code path means that all tracepoints were enabled without
+ * errors so we ignore the error value of syscalls.
+ *
+ * At the moment, failing to enable syscalls on "lttng enable-event -a -k"
+ * is not considered an error that need to be returned to the client since
+ * tracepoints did not fail. Future work will allow us to send back
+ * multiple errors to the client in one API call.
+ */
+ (void) event_kernel_enable_all_syscalls(ksession, kchan, kernel_tracer_fd);
+
end:
- return ret;
+ return tp_ret;
}
/*
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
- if (errno != EEXIST) {
+ switch (errno) {
+ case EEXIST:
+ break;
+ case ENOSYS:
+ WARN("Event type not implemented");
+ break;
+ default:
PERROR("create event ioctl");
}
ret = -errno;
lttng_ht_node_init_str(&lue->node, lue->attr.name);
/* Alloc context hash tables */
lue->ctx = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
+ if (lue->ctx == NULL) {
+ ERR("Unable to create context hash table for event %s", ev->name);
+ goto error_free_event;
+ }
DBG2("Trace UST event %s, loglevel (%d,%d) created",
lue->attr.name, lue->attr.loglevel_type,
return lue;
error_free_event:
- lttng_ht_destroy(lue->ctx);
free(lue);
error:
return NULL;
goto error;
}
} else {
- traces_path = opt_output_path;
+ traces_path = expand_full_path(opt_output_path);
+ if (traces_path == NULL) {
+ ret = CMD_ERROR;
+ goto error;
+ }
}
ret = lttng_create_session(session_name, traces_path);
#define _GNU_SOURCE
#include <stdlib.h>
#include <ctype.h>
+#include <limits.h>
#include <common/error.h>
#include "conf.h"
#include "utils.h"
+/*
+ * Return the realpath(3) of the path even if the last directory token does not
+ * exist. For example, with /tmp/test1/test2, if test2/ does not exist but the
+ * /tmp/test1 does, the real path is returned. In normal time, realpath(3)
+ * fails if the end point directory does not exist.
+ */
+char *expand_full_path(const char *path)
+{
+ const char *end_path = path;
+ char *next, *cut_path, *expanded_path;
+
+ /* Find last token delimited by '/' */
+ while ((next = strpbrk(end_path + 1, "/"))) {
+ end_path = next;
+ }
+
+ /* Cut last token from original path */
+ cut_path = strndup(path, end_path - path);
+
+ expanded_path = malloc(PATH_MAX);
+ if (expanded_path == NULL) {
+ goto error;
+ }
+
+ expanded_path = realpath((char *)cut_path, expanded_path);
+ if (expanded_path == NULL) {
+ switch (errno) {
+ case ENOENT:
+ ERR("%s: No such file or directory", cut_path);
+ break;
+ default:
+ perror("realpath");
+ break;
+ }
+ goto error;
+ }
+
+ /* Add end part to expanded path */
+ strcat(expanded_path, end_path);
+
+ free(cut_path);
+ return expanded_path;
+
+error:
+ free(cut_path);
+ return NULL;
+}
+
/*
* get_session_name
*
#include <popt.h>
+char *expand_full_path(const char *path);
char *get_config_file_path(void);
char *get_session_name(void);
int set_session_name(char *name);
[ LTTCOMM_ERR_INDEX(LTTCOMM_NEED_ROOT_SESSIOND) ] = "Tracing the kernel requires a root lttng-sessiond daemon and \"tracing\" group user membership",
[ LTTCOMM_ERR_INDEX(LTTCOMM_TRACE_ALREADY_STARTED) ] = "Tracing already started",
[ LTTCOMM_ERR_INDEX(LTTCOMM_TRACE_ALREADY_STOPPED) ] = "Tracing already stopped",
+ [ LTTCOMM_ERR_INDEX(LTTCOMM_KERN_EVENT_ENOSYS) ] = "Kernel event type not supported",
[ LTTCOMM_ERR_INDEX(CONSUMERD_COMMAND_SOCK_READY) ] = "consumerd command socket ready",
[ LTTCOMM_ERR_INDEX(CONSUMERD_SUCCESS_RECV_FD) ] = "consumerd success on receiving fds",
LTTCOMM_NEED_ROOT_SESSIOND, /* root sessiond is needed */
LTTCOMM_TRACE_ALREADY_STARTED, /* Tracing already started */
LTTCOMM_TRACE_ALREADY_STOPPED, /* Tracing already stopped */
+ LTTCOMM_KERN_EVENT_ENOSYS, /* Kernel event type not supported */
CONSUMERD_COMMAND_SOCK_READY, /* when consumerd command socket ready */
CONSUMERD_SUCCESS_RECV_FD, /* success on receiving fds */
return 0;
-create_fail:
- assert(ret != 0);
handle_fail:
assert(handle != NULL);
+create_fail:
+ assert(ret != 0);
stop_fail:
start_fail:
return 0;
-create_fail:
- assert(ret != 0);
handle_fail:
assert(handle != NULL);
+create_fail:
+ assert(ret != 0);
stop_fail:
start_fail:
#!/bin/bash
SESSIOND_BIN="lttng-sessiond"
-TESTDIR=$(dirname $0)/..
+CURDIR=$(dirname $0)
+TESTDIR=$CURDIR/..
source $TESTDIR/utils.sh
tmpdir=`mktemp -d`
-tests=( kernel_event_basic kernel_all_events_basic )
+tests=( $CURDIR/kernel_event_basic $CURDIR/kernel_all_events_basic )
exit_code=0
function start_tests ()
{
for bin in ${tests[@]};
do
+ if [ ! -e $bin ]; then
+ echo -e "$bin not found, passing"
+ continue
+ fi
+
start_sessiond
./$bin $tmpdir
EXTRA_DIST = runall.sh utils.sh run-ust-global-tests.sh
-noinst_PROGRAMS = ust_global_event_basic ust_global_all_events_basic
+noinst_PROGRAMS = ust_global_event_basic ust_global_event_wildcard
UTILS=utils.h
LIBLTTNG=$(top_srcdir)/src/lib/lttng-ctl/lttng-ctl.c \
$(top_srcdir)/src/common/sessiond-comm/sessiond-comm.c
-ust_global_all_events_basic_SOURCES = ust_global_all_events_basic.c $(UTILS) $(LIBLTTNG)
+ust_global_event_wildcard_SOURCES = ust_global_event_wildcard.c $(UTILS) $(LIBLTTNG)
ust_global_event_basic_SOURCES = ust_global_event_basic.c $(UTILS) $(LIBLTTNG)
endif
./$CURDIR/$BIN_NAME & >/dev/null 2>&1
done
-echo "Waiting for all tracing to settle"
-sleep 5
+echo "Waiting for all tracing to settle (7 secs)"
+echo "Warning: this arbitrary time can make the test fail on slower system"
+sleep 7
stop_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
source $TESTDIR/utils.sh
tmpdir=`mktemp -d`
-tests=( $CURDIR/ust_global_event_basic $CURDIR/ust_global_all_events_basic )
+tests=( $CURDIR/ust_global_event_basic $CURDIR/ust_global_event_wildcard )
exit_code=0
function start_tests ()
+++ /dev/null
-/*
- * Copyright (c) 2011 David Goulet <david.goulet@polymtl.ca>
- *
- * 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
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define _GNU_SOURCE
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-
-#include <lttng/lttng.h>
-
-#include "utils.h"
-
-int lttng_opt_quiet;
-
-int main(int argc, char **argv)
-{
- struct lttng_handle *handle = NULL;
- struct lttng_domain dom;
- struct lttng_event event;
- char *channel_name = "channel0";
- char *session_name = "ust_global_all_events_basic";
- int ret = 0;
-
- memset(&dom, 0, sizeof(dom));
- memset(&event, 0, sizeof(event));
- dom.type = LTTNG_DOMAIN_UST;
- event.type = LTTNG_EVENT_TRACEPOINT;
- event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
-
- printf("\nTesting tracing all UST events:\n");
- printf("-----------\n");
-
- if (argc < 2) {
- printf("Missing session trace path\n");
- return 1;
- }
-
- printf("Creating tracing session (%s): ", argv[1]);
- if ((ret = lttng_create_session(session_name, argv[1])) < 0) {
- printf("error creating the session : %s\n", lttng_strerror(ret));
- goto create_fail;
- }
- PRINT_OK();
-
- printf("Creating session handle: ");
- if ((handle = lttng_create_handle(session_name, &dom)) == NULL) {
- printf("error creating handle: %s\n", lttng_strerror(ret));
- goto handle_fail;
- }
- PRINT_OK();
-
- printf("Enabling all UST events: ");
- if ((ret = lttng_enable_event(handle, &event, channel_name)) < 0) {
- printf("error enabling event: %s\n", lttng_strerror(ret));
- goto enable_fail;
- }
- PRINT_OK();
-
- printf("Start tracing: ");
- if ((ret = lttng_start_tracing(session_name)) < 0) {
- printf("error starting tracing: %s\n", lttng_strerror(ret));
- goto start_fail;
- }
- PRINT_OK();
-
- sleep(2);
-
- printf("Stop tracing: ");
- if ((ret = lttng_stop_tracing(session_name)) < 0) {
- printf("error stopping tracing: %s\n", lttng_strerror(ret));
- goto stop_fail;
- }
- PRINT_OK();
-
- printf("Destroy tracing session: ");
- if ((ret = lttng_destroy_session(session_name)) < 0) {
- printf("error destroying session: %s\n", lttng_strerror(ret));
- }
- PRINT_OK();
-
- return 0;
-
-create_fail:
- assert(ret != 0);
-handle_fail:
- assert(handle != NULL);
-
-stop_fail:
-start_fail:
-enable_fail:
- lttng_destroy_session(session_name);
- lttng_destroy_handle(handle);
-
- return 1;
-}
{
struct lttng_handle *handle = NULL;
struct lttng_domain dom;
- struct lttng_channel channel;
+ struct lttng_channel channel, channel2;
struct lttng_event ev1, ev2, ev3;
+ struct lttng_event_context context;
char *session_name = "ust_global_event_basic";
+ char *session_name2 = "ust_global_event_basic2";
int ret = 0;
memset(&dom, 0, sizeof(dom));
memset(&channel, 0, sizeof(channel));
+ memset(&channel2, 0, sizeof(channel2));
memset(&ev1, 0, sizeof(ev1));
memset(&ev2, 0, sizeof(ev2));
memset(&ev3, 0, sizeof(ev3));
+ memset(&context, 0, sizeof(context));
dom.type = LTTNG_DOMAIN_UST;
+
+ /* Setup channel 1 */
strcpy(channel.name, "mychan");
channel.attr.overwrite = 0;
channel.attr.subbuf_size = 4096;
channel.attr.read_timer_interval = 200;
channel.attr.output = LTTNG_EVENT_MMAP;
+ /* Setup channel 2 */
+ strcpy(channel2.name, "mychan2");
+ channel2.attr.overwrite = 0;
+ channel2.attr.subbuf_size = 8192;
+ channel2.attr.num_subbuf = 8;
+ channel2.attr.switch_timer_interval = 0;
+ channel2.attr.read_timer_interval = 500;
+ channel2.attr.output = LTTNG_EVENT_MMAP;
+
strcpy(ev1.name, "tp1");
ev1.type = LTTNG_EVENT_TRACEPOINT;
ev1.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
}
PRINT_OK();
+ printf("Creating tracing session 2 (%s): ", argv[1]);
+ if ((ret = lttng_create_session(session_name2, argv[1])) < 0) {
+ printf("error creating the session : %s\n", lttng_strerror(ret));
+ goto create_fail;
+ }
+ PRINT_OK();
+
printf("Creating session handle: ");
if ((handle = lttng_create_handle(session_name, &dom)) == NULL) {
printf("error creating handle: %s\n", lttng_strerror(ret));
}
PRINT_OK();
- printf("Enabling %s UST event: ", ev1.name);
+ printf("Enabling %s UST channel2: ", channel2.name);
+ if ((ret = lttng_enable_channel(handle, &channel2)) < 0) {
+ printf("error enable channel: %s\n", lttng_strerror(ret));
+ goto enable_fail;
+ }
+ PRINT_OK();
+
+ printf("Enabling %s UST event in channel %s: ", ev1.name, channel.name);
if ((ret = lttng_enable_event(handle, &ev1, channel.name)) < 0) {
printf("error enabling event: %s\n", lttng_strerror(ret));
goto enable_fail;
}
PRINT_OK();
- printf("Enabling %s UST event: ", ev2.name);
+ printf("Enabling %s UST event in channel %s: ", ev2.name, channel.name);
if ((ret = lttng_enable_event(handle, &ev2, channel.name)) < 0) {
printf("error enabling event: %s\n", lttng_strerror(ret));
goto enable_fail;
}
PRINT_OK();
- printf("Enabling %s UST event: ", ev3.name);
- if ((ret = lttng_enable_event(handle, &ev3, channel.name)) < 0) {
+ printf("Enabling %s UST event in channel %s: ", ev3.name, channel2.name);
+ if ((ret = lttng_enable_event(handle, &ev3, channel2.name)) < 0) {
printf("error enabling event: %s\n", lttng_strerror(ret));
goto enable_fail;
}
PRINT_OK();
+ context.ctx = LTTNG_EVENT_CONTEXT_VPID;
+
+ printf("Adding context VPID to UST event %s in channel %s: ", ev1.name,
+ channel.name);
+ if ((ret = lttng_add_context(handle, &context, ev1.name,
+ channel.name)) < 0) {
+ printf("error adding context VPID: %s\n", lttng_strerror(ret));
+ goto context_fail;
+ }
+ PRINT_OK();
+
+ context.ctx = LTTNG_EVENT_CONTEXT_VTID;
+
+ printf("Adding context VTID to UST event %s in channel %s: ", ev1.name,
+ channel.name);
+ if ((ret = lttng_add_context(handle, &context, ev1.name,
+ channel.name)) < 0) {
+ printf("error adding context VTID: %s\n", lttng_strerror(ret));
+ goto context_fail;
+ }
+ PRINT_OK();
+
+ context.ctx = LTTNG_EVENT_CONTEXT_PTHREAD_ID;
+
+ printf("Adding context PTHREAD_ID to UST event %s in channel %s: ",
+ ev1.name, channel.name);
+ if ((ret = lttng_add_context(handle, &context, ev1.name,
+ channel.name)) < 0) {
+ printf("error adding context PTHREAD_ID: %s\n", lttng_strerror(ret));
+ goto context_fail;
+ }
+ PRINT_OK();
+
+ context.ctx = LTTNG_EVENT_CONTEXT_PROCNAME;
+
+ printf("Adding context PROCNAME to UST event %s in channel %s: ",
+ ev1.name, channel.name);
+ if ((ret = lttng_add_context(handle, &context, ev1.name,
+ channel.name)) < 0) {
+ printf("error adding context PROCNAME: %s\n", lttng_strerror(ret));
+ goto context_fail;
+ }
+ PRINT_OK();
+
+ context.ctx = LTTNG_EVENT_CONTEXT_PROCNAME;
+
+ printf("Adding context PROCNAME to UST event %s in channel %s: ",
+ ev3.name, channel2.name);
+ if ((ret = lttng_add_context(handle, &context, ev3.name,
+ channel2.name)) < 0) {
+ printf("error adding context PROCNAME: %s\n", lttng_strerror(ret));
+ goto context_fail;
+ }
+ PRINT_OK();
+
printf("Disabling %s UST event: ", ev1.name);
if ((ret = lttng_disable_event(handle, ev1.name, channel.name)) < 0) {
printf("error enabling event: %s\n", lttng_strerror(ret));
PRINT_OK();
printf("Disabling %s UST event: ", ev3.name);
- if ((ret = lttng_disable_event(handle, ev3.name, channel.name)) < 0) {
+ if ((ret = lttng_disable_event(handle, ev3.name, channel2.name)) < 0) {
printf("error enabling event: %s\n", lttng_strerror(ret));
goto enable_fail;
}
}
PRINT_OK();
+ printf("Disabling channel %s: ", channel2.name);
+ if ((ret = lttng_disable_channel(handle, channel2.name)) < 0) {
+ printf("error disabling channel: %s\n", lttng_strerror(ret));
+ goto enable_fail;
+ }
+ PRINT_OK();
+
printf("Start tracing: ");
if ((ret = lttng_start_tracing(session_name)) < 0) {
printf("error starting tracing: %s\n", lttng_strerror(ret));
}
PRINT_OK();
+ printf("Destroy tracing session 2: ");
+ if ((ret = lttng_destroy_session(session_name2)) < 0) {
+ printf("error destroying session 2: %s\n", lttng_strerror(ret));
+ }
+ PRINT_OK();
+
printf("Destroy tracing session: ");
if ((ret = lttng_destroy_session(session_name)) < 0) {
printf("error destroying session: %s\n", lttng_strerror(ret));
return 0;
-create_fail:
- assert(ret != 0);
handle_fail:
assert(handle != NULL);
+create_fail:
+ assert(ret != 0);
stop_fail:
start_fail:
+context_fail:
enable_fail:
+ lttng_destroy_session(session_name2);
lttng_destroy_session(session_name);
lttng_destroy_handle(handle);
--- /dev/null
+/*
+ * Copyright (c) 2011 David Goulet <david.goulet@polymtl.ca>
+ *
+ * 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
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _GNU_SOURCE
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <lttng/lttng.h>
+
+#include "utils.h"
+
+int lttng_opt_quiet;
+
+int main(int argc, char **argv)
+{
+ struct lttng_handle *handle = NULL;
+ struct lttng_domain dom;
+ struct lttng_event event, ev2;
+ char *channel_name = "channel0";
+ char *channel_name2 = "channel2";
+ char *session_name = "ust_global_all_events_basic";
+ int ret = 0;
+
+ memset(&dom, 0, sizeof(dom));
+ memset(&event, 0, sizeof(event));
+ memset(&ev2, 0, sizeof(ev2));
+
+ dom.type = LTTNG_DOMAIN_UST;
+
+ event.type = LTTNG_EVENT_TRACEPOINT;
+ event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
+ strcpy(event.name, "*");
+
+ ev2.type = LTTNG_EVENT_TRACEPOINT;
+ ev2.loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
+ ev2.loglevel = LTTNG_LOGLEVEL_NOTICE;
+ strcpy(ev2.name, "abc*");
+
+ printf("\nTesting tracing all UST events:\n");
+ printf("-----------\n");
+
+ if (argc < 2) {
+ printf("Missing session trace path\n");
+ return 1;
+ }
+
+ printf("Creating tracing session (%s): ", argv[1]);
+ if ((ret = lttng_create_session(session_name, argv[1])) < 0) {
+ printf("error creating the session : %s\n", lttng_strerror(ret));
+ goto create_fail;
+ }
+ PRINT_OK();
+
+ printf("Creating session handle: ");
+ if ((handle = lttng_create_handle(session_name, &dom)) == NULL) {
+ printf("error creating handle: %s\n", lttng_strerror(ret));
+ goto handle_fail;
+ }
+ PRINT_OK();
+
+ printf("Enabling '*' UST events: ");
+ if ((ret = lttng_enable_event(handle, &event, channel_name)) < 0) {
+ printf("error enabling event: %s\n", lttng_strerror(ret));
+ goto enable_fail;
+ }
+ PRINT_OK();
+
+ printf("Enabling 'abc*' UST events: ");
+ if ((ret = lttng_enable_event(handle, &ev2, channel_name2)) < 0) {
+ printf("error enabling event: %s\n", lttng_strerror(ret));
+ goto enable_fail;
+ }
+ PRINT_OK();
+
+ printf("Start tracing: ");
+ if ((ret = lttng_start_tracing(session_name)) < 0) {
+ printf("error starting tracing: %s\n", lttng_strerror(ret));
+ goto start_fail;
+ }
+ PRINT_OK();
+
+ sleep(2);
+
+ printf("Stop tracing: ");
+ if ((ret = lttng_stop_tracing(session_name)) < 0) {
+ printf("error stopping tracing: %s\n", lttng_strerror(ret));
+ goto stop_fail;
+ }
+ PRINT_OK();
+
+ printf("Destroy tracing session: ");
+ if ((ret = lttng_destroy_session(session_name)) < 0) {
+ printf("error destroying session: %s\n", lttng_strerror(ret));
+ }
+ PRINT_OK();
+
+ return 0;
+
+handle_fail:
+ assert(handle != NULL);
+create_fail:
+ assert(ret != 0);
+
+stop_fail:
+start_fail:
+enable_fail:
+ lttng_destroy_session(session_name);
+ lttng_destroy_handle(handle);
+
+ return 1;
+}
KERNEL_MINOR_VERSION=6
KERNEL_PATCHLEVEL_VERSION=27
-alias realpath='readlink -f'
-
function validate_kernel_version ()
{
kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n'))
return 2
fi
- DIR=$(realpath $TESTDIR)
+ DIR=$(readlink -f $TESTDIR)
if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
echo -e "\e[1;31mFAILED\e[0m"
return 1
else
+ out=1
+ while [ -n "$out" ]; do
+ out=$(pidof lt-$SESSIOND_BIN)
+ sleep 0.5
+ done
echo -e "\e[1;32mOK\e[0m"
fi
}
sess_name=$1
trace_path=$2
- echo -n "Creating lttng session $SESSION_NAME in $TRACE_PATH "
+ echo -n "Creating lttng session $sess_name in $trace_path"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1
if [ $? -eq 1 ]; then
echo -e "\e[1;31mFAILED\e[0m"
return 1
else
echo -e "\e[1;32mOK\e[0m"
- #echo $out | grep "written in" | cut -d' ' -f6
+ fi
+}
+
+function enable_lttng_channel()
+{
+ sess_name=$1
+ channel_name=$2
+
+ echo -n "Enabling lttng channel $channel_name for session $sess_name"
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel $channel_name -s $sess_name >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo -e "\e[1;31mFAILED\e[0m"
+ return 1
+ else
+ echo -e "\e[1;32mOK\e[0m"
+ fi
+}
+
+function disable_lttng_channel()
+{
+ sess_name=$1
+ channel_name=$2
+
+ echo -n "Disabling lttng channel $channel_name for session $sess_name"
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel $channel_name -s $sess_name >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo -e "\e[1;31mFAILED\e[0m"
+ return 1
+ else
+ echo -e "\e[1;32mOK\e[0m"
fi
}