X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Flttng%2Fkernel_all_events_basic.c;fp=tests%2Flttng%2Fkernel_all_events_basic.c;h=0000000000000000000000000000000000000000;hp=6964a6f97035a81495a0591527e151ef27fc6a90;hb=355f483d1713d1e047ad6256bea039cb693ae38e;hpb=0e4cbe7e2c4c6a8343e710a3b050af8c33f95e21 diff --git a/tests/lttng/kernel_all_events_basic.c b/tests/lttng/kernel_all_events_basic.c deleted file mode 100644 index 6964a6f97..000000000 --- a/tests/lttng/kernel_all_events_basic.c +++ /dev/null @@ -1,119 +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; - char *channel_name = "channel0"; - char *session_name = "kernel_all_events_basic"; - int ret = 0; - - memset(&dom, 0, sizeof(dom)); - memset(&event, 0, sizeof(event)); - dom.type = LTTNG_DOMAIN_KERNEL; - event.type = LTTNG_EVENT_TRACEPOINT; - event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; - - printf("\nTesting tracing all kernel events:\n"); - printf("-----------\n"); - /* Check if root */ - if (getuid() != 0) { - printf("Root access is needed.\nPlease run 'sudo make check' -- Aborting!\n"); - return 0; - } - - 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 kernel 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; -}