Add wildcard test to UST
authorDavid Goulet <dgoulet@efficios.com>
Thu, 5 Apr 2012 19:46:52 +0000 (15:46 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 5 Apr 2012 19:50:15 +0000 (15:50 -0400)
Rename test file and add two event wildcard type to the test.

Signed-off-by: David Goulet <dgoulet@efficios.com>
.gitignore
tests/ust/Makefile.am
tests/ust/run-ust-global-tests.sh
tests/ust/ust_global_all_events_basic.c [deleted file]
tests/ust/ust_global_event_wildcard.c [new file with mode: 0644]

index b63da96a36a43e2818f0a9d1e468947055c1516e..8a0d08796aeacd90c8a73bdc47ceb2f79f8410b2 100644 (file)
@@ -41,7 +41,7 @@ test_kernel_data_trace
 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
index 9eda72c5d447370a21ff34a18725a171b3bdd2f8..7c7bcba41a813c99189e8336e924830248f05fbe 100644 (file)
@@ -6,13 +6,13 @@ AM_LDFLAGS = -lurcu -lurcu-cds
 
 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
index 96c1f9e54d759e071e1a43e59d9dcd19c394916f..969e217332fe2eafd2b27e51ea754870dafe8c2c 100755 (executable)
@@ -7,7 +7,7 @@ TESTDIR=$CURDIR/..
 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 ()
diff --git a/tests/ust/ust_global_all_events_basic.c b/tests/ust/ust_global_all_events_basic.c
deleted file mode 100644 (file)
index 3ae786e..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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;
-}
diff --git a/tests/ust/ust_global_event_wildcard.c b/tests/ust/ust_global_event_wildcard.c
new file mode 100644 (file)
index 0000000..1e4420f
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * 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;
+
+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;
+}
This page took 0.040569 seconds and 4 git commands to generate.