From d6641c890cd38d0c43a84fd54ccf3c10de88a56b Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 13 Jul 2020 14:56:57 -0400 Subject: [PATCH] tests: return the proper TAP exit code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The C TAP library provides the 'exit_status()' function that will return the proper exit code according to the number of tests that succeeded or failed. Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau Change-Id: Ia76ed7d1510bb23bf3848f85ac9022c66e752311 --- tests/ctf-writer/ctf_writer.c | 2 +- tests/lib/test_bt_values.c | 2 +- tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c | 6 +++--- tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ctf-writer/ctf_writer.c b/tests/ctf-writer/ctf_writer.c index c8fab1b7..f45d5eb0 100644 --- a/tests/ctf-writer/ctf_writer.c +++ b/tests/ctf-writer/ctf_writer.c @@ -2058,5 +2058,5 @@ int main(int argc, char **argv) g_free(trace_path); g_free(metadata_path); - return 0; + return exit_status(); } diff --git a/tests/lib/test_bt_values.c b/tests/lib/test_bt_values.c index 0a7aeb1c..cc3cbd9f 100644 --- a/tests/lib/test_bt_values.c +++ b/tests/lib/test_bt_values.c @@ -1164,5 +1164,5 @@ int main(void) test_is_equal(); test_copy(); test_extend(); - return 0; + return exit_status(); } diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c b/tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c index bd160d85..a398faeb 100644 --- a/tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c +++ b/tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c @@ -404,6 +404,8 @@ int main(int argc, char **argv) GOptionContext *context; int status; + plan_tests(NR_TESTS); + context = g_option_context_new("- bin info test"); g_option_context_add_main_entries(context, entries, NULL); if (!g_option_context_parse(context, &argc, &argv, &error)) { @@ -425,8 +427,6 @@ int main(int argc, char **argv) goto end; } - plan_tests(NR_TESTS); - ret = bin_info_init(BT_LOG_OUTPUT_LEVEL, NULL); ok(ret == 0, "bin_info_init successful"); @@ -435,7 +435,7 @@ int main(int argc, char **argv) test_bin_info_build_id(opt_debug_info_dir); test_bin_info_debug_link(opt_debug_info_dir); - status = EXIT_SUCCESS; + status = exit_status(); end: g_option_context_free(context); diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c b/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c index b394a10f..99c584fb 100644 --- a/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c +++ b/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c @@ -149,5 +149,5 @@ int main(int argc, char **argv) test_bt_no_dwarf(data_dir); test_bt_dwarf(data_dir); - return EXIT_SUCCESS; + return exit_status(); } -- 2.34.1