From: Michael Jeanson Date: Wed, 5 Jun 2019 15:36:19 +0000 (-0400) Subject: tests: replace BT_ASSERT with exit in test_bin_info X-Git-Tag: v2.0.0-rc1~757 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=705cccf8136aeb755bd9ba96bf8989e2341aab3b tests: replace BT_ASSERT with exit in test_bin_info Since this is a test executable and not a library, it's cleaner to exit with an error code than use an assertion which could be disabled. Signed-off-by: Michael Jeanson Change-Id: I1684a21d510ea444106b84f5e06ece4a7ff96ef4 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1382 Tested-by: jenkins Reviewed-by: Philippe Proulx Reviewed-by: Francis Deslauriers --- diff --git a/tests/plugins/test_bin_info.c b/tests/plugins/test_bin_info.c index 2f9a09a0..339f91a4 100644 --- a/tests/plugins/test_bin_info.c +++ b/tests/plugins/test_bin_info.c @@ -224,7 +224,10 @@ void test_bin_info_build_id(const char *bin_info_dir) } ret = bt_fd_cache_init(&fdc); - BT_ASSERT(ret == 0); + if (ret != 0) { + diag("Failed to initialize FD cache"); + exit(EXIT_FAILURE); + } bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); @@ -275,7 +278,10 @@ void test_bin_info_debug_link(const char *bin_info_dir) } ret = bt_fd_cache_init(&fdc); - BT_ASSERT(ret == 0); + if (ret != 0) { + diag("Failed to initialize FD cache"); + exit(EXIT_FAILURE); + } bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); @@ -322,7 +328,10 @@ void test_bin_info_elf(const char *bin_info_dir) } ret = bt_fd_cache_init(&fdc); - BT_ASSERT(ret == 0); + if (ret != 0) { + diag("Failed to initialize FD cache"); + exit(EXIT_FAILURE); + } bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL); @@ -367,7 +376,10 @@ void test_bin_info_bundled(const char *bin_info_dir) } ret = bt_fd_cache_init(&fdc); - BT_ASSERT(ret == 0); + if (ret != 0) { + diag("Failed to initialize FD cache"); + exit(EXIT_FAILURE); + } bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true, data_dir, NULL);