Rename C++ header files to .hpp
[lttng-tools.git] / tests / unit / test_ust_data.cpp
index a6dfba4293a4c2192f13c070d6672aab7eb592cb..9cfdac4f31c08473d82ae10ad206dc2c28577191 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
  *
  * SPDX-License-Identifier: GPL-2.0-only
  *
 #include <urcu.h>
 
 #include <lttng/lttng.h>
-#include <bin/lttng-sessiond/lttng-ust-abi.h>
-#include <common/defaults.h>
-#include <common/compat/errno.h>
-#include <bin/lttng-sessiond/trace-ust.h>
-#include <bin/lttng-sessiond/ust-app.h>
-#include <bin/lttng-sessiond/notification-thread.h>
+#include <bin/lttng-sessiond/lttng-ust-abi.hpp>
+#include <common/defaults.hpp>
+#include <common/compat/errno.hpp>
+#include <bin/lttng-sessiond/trace-ust.hpp>
+#include <bin/lttng-sessiond/ust-app.hpp>
+#include <bin/lttng-sessiond/notification-thread.hpp>
 
 #include <lttng/ust-sigbus.h>
 
@@ -32,7 +32,7 @@
 /* Number of TAP tests in this file */
 #define NUM_TESTS 16
 
-DEFINE_LTTNG_UST_SIGBUS_STATE();
+LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE();
 
 static const char alphanum[] =
        "0123456789"
@@ -143,6 +143,7 @@ static void test_create_ust_event(void)
 
 static void test_create_ust_event_exclusion(void)
 {
+       int copy_ret;
        enum lttng_error_code ret;
        struct ltt_ust_event *event;
        struct lttng_event ev;
@@ -175,9 +176,9 @@ static void test_create_ust_event_exclusion(void)
        exclusion->count = exclusion_count;
        random_name = get_random_string();
        strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0), random_name,
-               LTTNG_SYMBOL_NAME_LEN);
+               LTTNG_SYMBOL_NAME_LEN - 1);
        strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1), random_name,
-               LTTNG_SYMBOL_NAME_LEN);
+               LTTNG_SYMBOL_NAME_LEN - 1);
 
        ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
        exclusion = NULL;
@@ -206,16 +207,24 @@ static void test_create_ust_event_exclusion(void)
         */
 
        exclusion->count = exclusion_count;
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
-               get_random_string(), LTTNG_SYMBOL_NAME_LEN);
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
-               get_random_string(), LTTNG_SYMBOL_NAME_LEN);
+       copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
+                       get_random_string(),
+                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0)));
+       LTTNG_ASSERT(copy_ret == 0);
+       copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
+                       get_random_string(),
+                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1)));
+       LTTNG_ASSERT(copy_ret == 0);
 
        exclusion_copy->count = exclusion_count;
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0),
-               LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0), LTTNG_SYMBOL_NAME_LEN);
-       strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1),
-               LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1), LTTNG_SYMBOL_NAME_LEN);
+       copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0),
+                       LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 0),
+                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 0)));
+       LTTNG_ASSERT(copy_ret == 0);
+       copy_ret = lttng_strncpy(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1),
+                       LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion, 1),
+                       sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusion_copy, 1)));
+       LTTNG_ASSERT(copy_ret == 0);
 
        ret = trace_ust_create_event(&ev, NULL, NULL, exclusion, false, &event);
        exclusion = NULL;
@@ -263,7 +272,7 @@ static void test_create_ust_context(void)
        free(uctx);
 }
 
-int main(int argc, char **argv)
+int main(void)
 {
        plan_tests(NUM_TESTS);
 
This page took 0.023951 seconds and 4 git commands to generate.