/*
- * Copyright (c) 2011 David Goulet <david.goulet@polymtl.ca>
+ * 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.
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * 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.
*/
-#include <assert.h>
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
+#include <common/compat/errno.h>
#include <bin/lttng-sessiond/trace-kernel.h>
#include <common/defaults.h>
/* Number of TAP tests in this file */
#define NUM_TESTS 11
-/* For error.h */
-int lttng_opt_quiet = 1;
-int lttng_opt_verbose;
-int lttng_opt_mi;
-struct notification_thread_handle *notification_thread_handle;
-
-int ust_consumerd32_fd;
-int ust_consumerd64_fd;
+#ifdef HAVE_LIBLTTNG_UST_CTL
+#include <lttng/ust-sigbus.h>
+DEFINE_LTTNG_UST_SIGBUS_STATE();
+#endif
static const char alphanum[] =
"0123456789"
static void test_create_kernel_metadata(void)
{
- assert(kern != NULL);
+ LTTNG_ASSERT(kern != NULL);
kern->metadata = trace_kernel_create_metadata();
ok(kern->metadata != NULL, "Create kernel metadata");
ok(kern->metadata->fd == -1 &&
kern->metadata->conf != NULL &&
kern->metadata->conf->attr.overwrite
- == DEFAULT_CHANNEL_OVERWRITE &&
+ == DEFAULT_METADATA_OVERWRITE &&
kern->metadata->conf->attr.subbuf_size
== default_get_metadata_subbuf_size() &&
kern->metadata->conf->attr.num_subbuf
== DEFAULT_METADATA_SUBBUF_NUM &&
kern->metadata->conf->attr.switch_timer_interval
- == DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER &&
+ == DEFAULT_METADATA_SWITCH_TIMER &&
kern->metadata->conf->attr.read_timer_interval
- == DEFAULT_KERNEL_CHANNEL_READ_TIMER &&
+ == DEFAULT_METADATA_READ_TIMER &&
kern->metadata->conf->attr.output
- == DEFAULT_KERNEL_CHANNEL_OUTPUT,
+ == LTTNG_EVENT_MMAP,
"Validate kernel session metadata");
trace_kernel_destroy_metadata(kern->metadata);
static void test_create_kernel_event(void)
{
+ enum lttng_error_code ret;
struct ltt_kernel_event *event;
struct lttng_event ev;
memset(&ev, 0, sizeof(ev));
ok(!lttng_strncpy(ev.name, get_random_string(),
- LTTNG_KERNEL_SYM_NAME_LEN),
+ RANDOM_STRING_LEN),
"Validate string length");
ev.type = LTTNG_EVENT_TRACEPOINT;
ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
- event = trace_kernel_create_event(&ev, NULL, NULL);
- ok(event != NULL, "Create kernel event");
+ ret = trace_kernel_create_event(&ev, NULL, NULL, &event);
+ ok(ret == LTTNG_OK, "Create kernel event");
if (!event) {
skip(1, "Event is null");
ok(event->fd == -1 &&
event->enabled == 1 &&
- event->event->instrumentation == LTTNG_KERNEL_TRACEPOINT &&
+ event->event->instrumentation == LTTNG_KERNEL_ABI_TRACEPOINT &&
strlen(event->event->name),
"Validate kernel event");
test_create_kernel_event();
test_create_kernel_stream();
- /* Success */
- return 0;
+ return exit_status();
}