X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fplugins%2Fflt.lttng-utils.debug-info%2Ftest_bin_info.c;h=a398faeb21f5c71f9588872cc5234771cdbf2f15;hb=d6641c890cd38d0c43a84fd54ccf3c10de88a56b;hp=b9ee32e0b3a0d8849e65a7f80d40515dfc9c6cbf;hpb=5084732e40a7925d22f741e4ed08f19d36078fbe;p=babeltrace.git 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 b9ee32e0..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 @@ -1,24 +1,11 @@ /* - * test_bin_info.c + * SPDX-License-Identifier: GPL-2.0-only * - * Babeltrace SO info tests - * - * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation - * Copyright (c) 2015 Antoine Busque - * Copyright (c) 2019 Michael Jeanson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright (C) 2015 EfficiOS Inc. and Linux Foundation + * Copyright (C) 2015 Antoine Busque + * Copyright (C) 2019 Michael Jeanson * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Babeltrace SO info tests */ #define BT_LOG_OUTPUT_LEVEL BT_LOG_WARNING @@ -90,7 +77,7 @@ static GOptionEntry entries[] = { "XXXXXXXXXXXXXXX"}, {"debug-info-dir", 0, 0, G_OPTION_ARG_STRING, &opt_debug_info_dir, "Debug info directory", NULL}, - {NULL}}; + {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}}; static int build_id_to_bin(void) @@ -151,7 +138,7 @@ void subtest_lookup_function_name(struct bin_info *bin, uint64_t addr, char *_func_name = NULL; ret = bin_info_lookup_function_name(bin, addr, &_func_name); - ok(ret == 0, "bin_info_lookup_function_name successful at 0x%x", addr); + ok(ret == 0, "bin_info_lookup_function_name successful at 0x%" PRIx64, addr); if (_func_name) { ok(strcmp(_func_name, func_name) == 0, "bin_info_lookup_function_name - correct function name (%s == %s)", @@ -172,17 +159,17 @@ void subtest_lookup_function_name(struct bin_info *bin, uint64_t addr, static void subtest_lookup_source_location(struct bin_info *bin, uint64_t addr, - uint64_t line_no, char *filename) + uint64_t line_no, const char *filename) { int ret; struct source_location *src_loc = NULL; ret = bin_info_lookup_source_location(bin, addr, &src_loc); - ok(ret == 0, "bin_info_lookup_source_location successful at 0x%x", + ok(ret == 0, "bin_info_lookup_source_location successful at 0x%" PRIx64, addr); if (src_loc) { ok(src_loc->line_no == line_no, - "bin_info_lookup_source_location - correct line_no (%d == %d)", + "bin_info_lookup_source_location - correct line_no (%" PRIu64 " == %" PRIu64 ")", line_no, src_loc->line_no); ok(strcmp(src_loc->filename, filename) == 0, "bin_info_lookup_source_location - correct filename (%s == %s)", @@ -415,12 +402,16 @@ int main(int argc, char **argv) int ret; GError *error = NULL; 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)) { fprintf(stderr, "option parsing failed: %s\n", error->message); - exit(EXIT_FAILURE); + status = EXIT_FAILURE; + goto end; } g_snprintf(func_foo_printf_name, FUNC_FOO_NAME_LEN, @@ -432,11 +423,10 @@ int main(int argc, char **argv) if (build_id_to_bin()) { fprintf(stderr, "Failed to parse / missing build id\n"); - exit(EXIT_FAILURE); + status = EXIT_FAILURE; + goto end; } - plan_tests(NR_TESTS); - ret = bin_info_init(BT_LOG_OUTPUT_LEVEL, NULL); ok(ret == 0, "bin_info_init successful"); @@ -445,5 +435,10 @@ int main(int argc, char **argv) test_bin_info_build_id(opt_debug_info_dir); test_bin_info_debug_link(opt_debug_info_dir); - return EXIT_SUCCESS; + status = exit_status(); + +end: + g_option_context_free(context); + + return status; }