From: Jonathan Rajotte Date: Fri, 9 Apr 2021 14:58:34 +0000 (-0400) Subject: Move test_action to its own file X-Git-Tag: v2.13.0-rc1~100 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9cff59ec0a1724d7b2a3f38dfa7838357e150dba;p=lttng-tools.git Move test_action to its own file Further unit testing on action objects will be conducted in the test_action.c file. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Ib17aed9eb02592d5c13bc2875d4203b81ab04cf3 --- diff --git a/.gitignore b/.gitignore index 0fe7c4774..fb4c02062 100644 --- a/.gitignore +++ b/.gitignore @@ -92,6 +92,7 @@ compile_commands.json /tests/unit/test_payload /tests/unit/test_event_rule /tests/unit/test_condition +/tests/unit/test_action /tests/unit/test_unix_socket /tests/regression/ust/multi-session/gen-nevents /tests/regression/ust/low-throughput/gen-events diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 5cf4d31ca..10dbd3a60 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -10,6 +10,7 @@ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ TESTS = \ ini_config/test_ini_config \ + test_action \ test_buffer_view \ test_directory_handle \ test_event_expr_to_bytecode \ @@ -45,6 +46,7 @@ LIBLTTNG_CTL=$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la # Define test programs noinst_PROGRAMS = \ + test_action \ test_buffer_view \ test_condition \ test_directory_handle \ @@ -268,3 +270,7 @@ test_event_expr_to_bytecode_LDADD = $(LIBTAP) $(LIBLTTNG_CTL) $(LIBCOMMON) # Log level rule api test_log_level_rule_SOURCES = test_log_level_rule.c test_log_level_rule_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBLTTNG_CTL) $(DL_LIBS) + +# Action api +test_action_SOURCES = test_action.c +test_action_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBLTTNG_CTL) $(DL_LIBS) diff --git a/tests/unit/test_action.c b/tests/unit/test_action.c new file mode 100644 index 000000000..697f1a710 --- /dev/null +++ b/tests/unit/test_action.c @@ -0,0 +1,51 @@ +/* + * test_action.c + * + * Unit tests for the notification API. + * + * Copyright (C) 2017 Jonathan Rajotte + * + * SPDX-License-Identifier: MIT + * + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +/* For error.h */ +int lttng_opt_quiet = 1; +int lttng_opt_verbose; +int lttng_opt_mi; + +#define NUM_TESTS 2 + +static void test_action_notify(void) +{ + struct lttng_action *notify_action = NULL; + + notify_action = lttng_action_notify_create(); + ok(notify_action, "Create notify action"); + ok(lttng_action_get_type(notify_action) == LTTNG_ACTION_TYPE_NOTIFY, + "Action has type LTTNG_ACTION_TYPE_NOTIFY"); + lttng_action_destroy(notify_action); +} + +int main(int argc, const char *argv[]) +{ + plan_tests(NUM_TESTS); + test_action_notify(); + return exit_status(); +} diff --git a/tests/unit/test_notification.c b/tests/unit/test_notification.c index 5e50eaa4c..6c57c21df 100644 --- a/tests/unit/test_notification.c +++ b/tests/unit/test_notification.c @@ -30,7 +30,7 @@ int lttng_opt_quiet = 1; int lttng_opt_verbose; int lttng_opt_mi; -#define NUM_TESTS 182 +#define NUM_TESTS 180 static void test_condition_buffer_usage( struct lttng_condition *buffer_usage_condition) @@ -277,16 +277,6 @@ static void test_condition_buffer_usage_high(void) lttng_condition_destroy(buffer_usage_high); } -static void test_action(void) -{ - struct lttng_action *notify_action = NULL; - - notify_action = lttng_action_notify_create(); - ok(notify_action, "Create notify action"); - ok(lttng_action_get_type(notify_action) == LTTNG_ACTION_TYPE_NOTIFY, "Action has type LTTNG_ACTION_TYPE_NOTIFY"); - lttng_action_destroy(notify_action); -} - static void test_trigger(void) { struct lttng_action *notify_action = NULL; @@ -317,7 +307,6 @@ int main(int argc, const char *argv[]) plan_tests(NUM_TESTS); test_condition_buffer_usage_low(); test_condition_buffer_usage_high(); - test_action(); test_trigger(); return exit_status(); }