* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define BT_LOG_OUTPUT_LEVEL BT_LOG_WARN
+#define BT_LOG_OUTPUT_LEVEL BT_LOG_WARNING
#define BT_LOG_TAG "TEST/BIN-INFO"
#include "logging/log.h"
{
int ret, len, i;
- if (opt_build_id == NULL) {
+ if (!opt_build_id) {
goto error;
}
/* Test function name lookup - erroneous address */
ret = bin_info_lookup_function_name(bin, SO_INV_ADDR, &_func_name);
- ok(ret == -1 && _func_name == NULL,
+ ok(ret == -1 && !_func_name,
"bin_info_lookup_function_name - fail on invalid addr");
- if (_func_name) {
- free(_func_name);
- }
+ free(_func_name);
}
static
/* Test source location lookup - erroneous address */
ret = bin_info_lookup_source_location(bin, SO_INV_ADDR, &src_loc);
- ok(ret == -1 && src_loc == NULL,
+ ok(ret == -1 && !src_loc,
"bin_info_lookup_source_location - fail on invalid addr");
if (src_loc) {
source_location_destroy(src_loc);
bin_path =
g_build_filename(bin_info_dir, BUILDID_DIR_NAME, SO_NAME, NULL);
- if (data_dir == NULL || bin_path == NULL) {
+ if (!data_dir || !bin_path) {
exit(EXIT_FAILURE);
}
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
- ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL, NULL);
+ ok(bin, "bin_info_create successful (%s)", bin_path);
/* Test setting invalid build_id */
ret = bin_info_set_build_id(bin, invalid_build_id, BUILD_ID_HEX_LEN);
bin_path = g_build_filename(bin_info_dir, DEBUGLINK_DIR_NAME, SO_NAME,
NULL);
- if (data_dir == NULL || bin_path == NULL) {
+ if (!data_dir || !bin_path) {
exit(EXIT_FAILURE);
}
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
- ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL, NULL);
+ ok(bin, "bin_info_create successful (%s)", bin_path);
/* Test setting debug link */
ret = bin_info_set_debug_link(bin, DEBUG_NAME, opt_debug_link_crc);
data_dir = g_build_filename(bin_info_dir, ELF_DIR_NAME, NULL);
bin_path = g_build_filename(bin_info_dir, ELF_DIR_NAME, SO_NAME, NULL);
- if (data_dir == NULL || bin_path == NULL) {
+ if (!data_dir || !bin_path) {
exit(EXIT_FAILURE);
}
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
- ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL, NULL);
+ ok(bin, "bin_info_create successful (%s)", bin_path);
/* Test bin_info_has_address */
subtest_has_address(bin, func_foo_printf_addr);
bin_path =
g_build_filename(bin_info_dir, DWARF_DIR_NAME, SO_NAME, NULL);
- if (data_dir == NULL || bin_path == NULL) {
+ if (!data_dir || !bin_path) {
exit(EXIT_FAILURE);
}
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
- ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL, NULL);
+ ok(bin, "bin_info_create successful (%s)", bin_path);
/* Test bin_info_has_address */
subtest_has_address(bin, func_foo_printf_addr);
plan_tests(NR_TESTS);
- ret = bin_info_init();
+ ret = bin_info_init(BT_LOG_OUTPUT_LEVEL, NULL);
ok(ret == 0, "bin_info_init successful");
test_bin_info_elf(opt_debug_info_dir);