tests: return the proper TAP exit code stable-2.0
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 13 Jul 2020 18:56:57 +0000 (14:56 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 Apr 2024 14:42:26 +0000 (10:42 -0400)
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 <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia76ed7d1510bb23bf3848f85ac9022c66e752311
(cherry picked from commit d6641c890cd38d0c43a84fd54ccf3c10de88a56b)
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12475
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
tests/ctf-writer/ctf_writer.c
tests/lib/test_bt_values.c
tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c
tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c

index af51363bf5a8e27682782601017f41bb175753df..cbb0353a9a9f6961ee189928f9e77b19f938a9d8 100644 (file)
@@ -2078,5 +2078,5 @@ int main(int argc, char **argv)
        g_free(trace_path);
        g_free(metadata_path);
 
-       return 0;
+       return exit_status();
 }
index 776e5f56e97de8b910c9f376818979c395953f95..beb858a36a896e7eec3b7d837af27eeecbe9795f 100644 (file)
@@ -1177,5 +1177,5 @@ int main(void)
        test_is_equal();
        test_copy();
        test_extend();
-       return 0;
+       return exit_status();
 }
index 90698d805e449a091770964de3790f9706136ca4..05208cc806ddb15d471b23a5947ae24ed0e4ca93 100644 (file)
@@ -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);
index bfdbb4cfe7818ff801d47c18daf49a75f66489cd..3b3405f844f3579d85d1b970995289e7e94287f9 100644 (file)
@@ -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();
 }
This page took 0.027588 seconds and 4 git commands to generate.