X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Funit%2Ftest_utils_expand_path.cpp;h=d11c2d9198d46605f54bab9073c1a8c7bdd03d42;hb=2d7da3031c65c4569ff2428a7c2cad30007f3b50;hp=428acad2285191827a65232ce6bf1bc6e7e94bf7;hpb=740da7d5000ca1ffdcf14bda5096bf7ccfb86bdd;p=lttng-tools.git diff --git a/tests/unit/test_utils_expand_path.cpp b/tests/unit/test_utils_expand_path.cpp index 428acad22..d11c2d919 100644 --- a/tests/unit/test_utils_expand_path.cpp +++ b/tests/unit/test_utils_expand_path.cpp @@ -15,8 +15,9 @@ #include -#include -#include +#include +#include +#include /* For error.h */ int lttng_opt_quiet = 1; @@ -131,14 +132,14 @@ static int prepare_valid_results(void) } /* allocate memory for the expected results */ - valid_tests_expected_results = (char **) zmalloc(sizeof(char *) * num_valid_tests); + valid_tests_expected_results = calloc(num_valid_tests); if (!valid_tests_expected_results) { PRINT_ERR("out of memory"); ret = -1; goto end; } for (i = 0; i < num_valid_tests; i++) { - valid_tests_expected_results[i] = (char *) malloc(PATH_MAX); + valid_tests_expected_results[i] = calloc(PATH_MAX); if (valid_tests_expected_results[i] == NULL) { PRINT_ERR("malloc expected results"); ret = -1; @@ -271,7 +272,7 @@ static void test_utils_expand_path(void) result = utils_expand_path(valid_tests_inputs[i].input); ok(result != NULL && - strcmp(result, valid_tests_expected_results[i]) == 0, name); + strcmp(result, valid_tests_expected_results[i]) == 0, "%s", name); free(result); } @@ -301,12 +302,12 @@ static void test_utils_expand_path(void) PRINT_ERR("truncation occurred while concatenating paths \"%s\" and \"%s\"", real_tree_origin, symlink_tests_inputs[i].input); - fail(name); + fail("%s", name); continue; } result = utils_expand_path(tmppath); ok(result != NULL && strcmp(result + treelen, - symlink_tests_inputs[i].expected_result) == 0, name); + symlink_tests_inputs[i].expected_result) == 0, "%s", name); free(result); } @@ -322,11 +323,11 @@ static void test_utils_expand_path(void) if (result != NULL) { free(result); } - ok(result == NULL, name); + ok(result == NULL, "%s", name); } } -int main(int argc, char **argv) +int main(void) { if (prepare_symlink_tree() != 0) { goto error_mkdir;