tests: return the proper TAP exit code
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 13 Jul 2020 18:56:57 +0000 (14:56 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 16 Jul 2020 22:38:13 +0000 (18:38 -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

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 c8fab1b7ce48695c8a68abe5788b4ccda3e8653e..f45d5eb042926b054485b03435e639acad0943ed 100644 (file)
@@ -2058,5 +2058,5 @@ int main(int argc, char **argv)
        g_free(trace_path);
        g_free(metadata_path);
 
-       return 0;
+       return exit_status();
 }
index 0a7aeb1ccb6b5330a37b91d5cef6c6e14980406e..cc3cbd9f00cfba26e1c297b0e0b5dda64eae207e 100644 (file)
@@ -1164,5 +1164,5 @@ int main(void)
        test_is_equal();
        test_copy();
        test_extend();
-       return 0;
+       return exit_status();
 }
index bd160d852d96eb506713674e0e915c2e52a65e46..a398faeb21f5c71f9588872cc5234771cdbf2f15 100644 (file)
@@ -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);
index b394a10f972aef65b8cb697f054b07f7ce94022c..99c584fbf1f21c2333c8daa9932a146bfc3e24ce 100644 (file)
@@ -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();
 }
This page took 0.027233 seconds and 4 git commands to generate.