From: Christian Babeux Date: Fri, 22 Feb 2013 03:10:54 +0000 (-0500) Subject: Tests: Convert the ust_global_event_wildcard test to an equivalent shell test X-Git-Tag: v2.2.0-rc1~60^2~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3de31d0bd714d6ce7495f93f35485d2e3e11a833;p=lttng-tools.git Tests: Convert the ust_global_event_wildcard test to an equivalent shell test The test_event_wildcard shell script test has the same behavior has the ust_global_event_wildcard test. In addition, the test output format has been converted to TAP. Signed-off-by: Christian Babeux --- diff --git a/tests/regression/ust/Makefile.am b/tests/regression/ust/Makefile.am index a11a65946..d8904bb78 100644 --- a/tests/regression/ust/Makefile.am +++ b/tests/regression/ust/Makefile.am @@ -2,23 +2,6 @@ if HAVE_LIBLTTNG_UST_CTL SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session \ overlap -AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/tests/utils -I$(top_srcdir)/src -g -Wall -AM_LDFLAGS = -lurcu -lurcu-cds - -EXTRA_DIST = runall.sh run-ust-global-tests.sh test_event_basic - -noinst_PROGRAMS = ust_global_event_wildcard - -UTILS=$(top_srcdir)/tests/utils/utils.h -LIBLTTNG=$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la - -SESSIONDSRC=$(top_srcdir)/src/common/sessiond-comm/sessiond-comm.c \ - $(top_srcdir)/src/common/sessiond-comm/unix.c \ - $(top_srcdir)/src/common/sessiond-comm/inet.c \ - $(top_srcdir)/src/common/sessiond-comm/inet6.c - -ust_global_event_wildcard_SOURCES = ust_global_event_wildcard.c $(UTILS) \ - $(SESSIONDSRC) -ust_global_event_wildcard_LDADD = $(LIBLTTNG) +EXTRA_DIST = runall.sh run-ust-global-tests.sh test_event_basic test_event_wildcard endif diff --git a/tests/regression/ust/test_event_wildcard b/tests/regression/ust/test_event_wildcard new file mode 100755 index 000000000..88c02b08a --- /dev/null +++ b/tests/regression/ust/test_event_wildcard @@ -0,0 +1,66 @@ +#!/bin/bash +# +# Copyright (C) - 2013 Christian Babeux +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# 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. + +TEST_DESC="UST tracer - Event wildcard" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +LTTNG_BIN="lttng" +BIN_NAME="gen-ust-events" +SESSION_NAME="valid_filter" +EVENT_NAME="tp:tptest" +NUM_TESTS=9 + +source $TESTDIR/utils/utils.sh + +print_test_banner "$TEST_DESC" + +function test_event_wildcard() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="ust_event_basic" + SESSION_NAME2="ust_event_basic2" + CHAN_NAME="mychan" + CHAN_NAME2="mychan2" + EVENT_NAME="*" + EVENT_NAME2="abc*" + + create_lttng_session $SESSION_NAME $TRACE_PATH + + enable_ust_lttng_event $SESSION_NAME "$EVENT_NAME" + enable_ust_lttng_event $SESSION_NAME "$EVENT_NAME2" + + start_lttng_tracing + stop_lttng_tracing + + TODO="Validate trace output is coherent" + ok 0 "Validate trace" + unset TODO + + destroy_lttng_session $SESSION_NAME + + rm -rf $TRACE_PATH +} + +# MUST set TESTDIR before calling those functions +plan_tests $NUM_TESTS + +start_lttng_sessiond + +test_event_wildcard + +stop_lttng_sessiond diff --git a/tests/regression/ust/ust_global_event_wildcard.c b/tests/regression/ust/ust_global_event_wildcard.c deleted file mode 100644 index 198a54168..000000000 --- a/tests/regression/ust/ust_global_event_wildcard.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2011 David Goulet - * - * 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 -#include -#include -#include -#include -#include -#include - -#include - -#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; -}