From: Michael Jeanson Date: Mon, 13 Jul 2020 18:56:57 +0000 (-0400) Subject: tests: return the proper TAP exit code X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=refs%2Fheads%2Fstable-2.0 tests: return the proper TAP exit code 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 (cherry picked from commit d6641c890cd38d0c43a84fd54ccf3c10de88a56b) Reviewed-on: https://review.lttng.org/c/babeltrace/+/12475 Reviewed-by: Philippe Proulx CI-Build: Simon Marchi Tested-by: jenkins --- diff --git a/tests/ctf-writer/ctf_writer.c b/tests/ctf-writer/ctf_writer.c index af51363b..cbb0353a 100644 --- a/tests/ctf-writer/ctf_writer.c +++ b/tests/ctf-writer/ctf_writer.c @@ -2078,5 +2078,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 776e5f56..beb858a3 100644 --- a/tests/lib/test_bt_values.c +++ b/tests/lib/test_bt_values.c @@ -1177,5 +1177,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 90698d80..05208cc8 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 @@ -417,6 +417,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)) { @@ -438,8 +440,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"); @@ -448,7 +448,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 bfdbb4cf..3b3405f8 100644 --- a/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c +++ b/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c @@ -162,5 +162,5 @@ int main(int argc, char **argv) test_bt_no_dwarf(data_dir); test_bt_dwarf(data_dir); - return EXIT_SUCCESS; + return exit_status(); }