projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean-up: kernel_consumer_add_stream() does not need to be public
[lttng-tools.git]
/
tests
/
unit
/
test_kernel_data.c
diff --git
a/tests/unit/test_kernel_data.c
b/tests/unit/test_kernel_data.c
index f3687456424cd8af8ff88a99bf317b06c58c429a..ff1b75df4f3025f934398b6b9218dd4d34fda6cc 100644
(file)
--- a/
tests/unit/test_kernel_data.c
+++ b/
tests/unit/test_kernel_data.c
@@
-16,7
+16,6
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
@@
-30,17
+29,16
@@
#include <tap/tap.h>
#include <tap/tap.h>
-/* This path will NEVER be created in this test */
-#define PATH1 "/tmp/.test-junk-lttng"
-
#define RANDOM_STRING_LEN 11
/* Number of TAP tests in this file */
#define RANDOM_STRING_LEN 11
/* Number of TAP tests in this file */
-#define NUM_TESTS 1
0
+#define NUM_TESTS 1
1
-/* For
lttnger
r.h */
+/* For
erro
r.h */
int lttng_opt_quiet = 1;
int lttng_opt_verbose;
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;
int ust_consumerd32_fd;
int ust_consumerd64_fd;
@@
-72,9
+70,13
@@
static char *get_random_string(void)
static void test_create_one_kernel_session(void)
{
static void test_create_one_kernel_session(void)
{
- kern = trace_kernel_create_session(
PATH1
);
+ kern = trace_kernel_create_session();
ok(kern != NULL, "Create kernel session");
ok(kern != NULL, "Create kernel session");
+ if (!kern) {
+ skip(1, "Kernel session is null");
+ return;
+ }
ok(kern->fd == -1 &&
kern->metadata_stream_fd == -1 &&
kern->consumer_fds_sent == 0 &&
ok(kern->fd == -1 &&
kern->metadata_stream_fd == -1 &&
kern->consumer_fds_sent == 0 &&
@@
-82,9
+84,6
@@
static void test_create_one_kernel_session(void)
kern->stream_count_global == 0 &&
kern->metadata == NULL,
"Validate kernel session");
kern->stream_count_global == 0 &&
kern->metadata == NULL,
"Validate kernel session");
-
- /* Init list in order to avoid sefaults from cds_list_del */
- trace_kernel_destroy_session(kern);
}
static void test_create_kernel_metadata(void)
}
static void test_create_kernel_metadata(void)
@@
-117,16
+116,23
@@
static void test_create_kernel_channel(void)
{
struct ltt_kernel_channel *chan;
struct lttng_channel attr;
{
struct ltt_kernel_channel *chan;
struct lttng_channel attr;
+ struct lttng_channel_extended extended;
memset(&attr, 0, sizeof(attr));
memset(&attr, 0, sizeof(attr));
+ memset(&extended, 0, sizeof(extended));
+ attr.attr.extended.ptr = &extended;
chan = trace_kernel_create_channel(&attr);
ok(chan != NULL, "Create kernel channel");
chan = trace_kernel_create_channel(&attr);
ok(chan != NULL, "Create kernel channel");
+ if (!chan) {
+ skip(1, "Channel is null");
+ return;
+ }
+
ok(chan->fd == -1 &&
chan->enabled == 1 &&
chan->stream_count == 0 &&
ok(chan->fd == -1 &&
chan->enabled == 1 &&
chan->stream_count == 0 &&
- chan->ctx == NULL &&
chan->channel->attr.overwrite == attr.attr.overwrite,
"Validate kernel channel");
chan->channel->attr.overwrite == attr.attr.overwrite,
"Validate kernel channel");
@@
-141,13
+147,20
@@
static void test_create_kernel_event(void)
struct lttng_event ev;
memset(&ev, 0, sizeof(ev));
struct lttng_event ev;
memset(&ev, 0, sizeof(ev));
- strncpy(ev.name, get_random_string(), LTTNG_KERNEL_SYM_NAME_LEN);
+ ok(!lttng_strncpy(ev.name, get_random_string(),
+ LTTNG_KERNEL_SYM_NAME_LEN),
+ "Validate string length");
ev.type = LTTNG_EVENT_TRACEPOINT;
ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
ev.type = LTTNG_EVENT_TRACEPOINT;
ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
- event = trace_kernel_create_event(&ev);
+ event = trace_kernel_create_event(&ev
, NULL, NULL
);
ok(event != NULL, "Create kernel event");
ok(event != NULL, "Create kernel event");
+ if (!event) {
+ skip(1, "Event is null");
+ return;
+ }
+
ok(event->fd == -1 &&
event->enabled == 1 &&
event->event->instrumentation == LTTNG_KERNEL_TRACEPOINT &&
ok(event->fd == -1 &&
event->enabled == 1 &&
event->event->instrumentation == LTTNG_KERNEL_TRACEPOINT &&
@@
-166,6
+179,11
@@
static void test_create_kernel_stream(void)
stream = trace_kernel_create_stream("stream1", 0);
ok(stream != NULL, "Create kernel stream");
stream = trace_kernel_create_stream("stream1", 0);
ok(stream != NULL, "Create kernel stream");
+ if (!stream) {
+ skip(1, "Stream is null");
+ return;
+ }
+
ok(stream->fd == -1 &&
stream->state == 0,
"Validate kernel stream");
ok(stream->fd == -1 &&
stream->state == 0,
"Validate kernel stream");
This page took
0.042058 seconds
and
4
git commands to generate.