diff options
author | Matias Elo <matias.elo@nokia.com> | 2023-05-24 12:05:55 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-05-26 09:45:43 +0300 |
commit | f1b6c6d6878608da82659d496e4d78b5cd275b1a (patch) | |
tree | 611b6f4a5e1df2d1603d472a2161b92f69b61d01 /platform | |
parent | f65eaefd7eaf6d9917d20963adb0d7832aeb2175 (diff) |
validation: use ODPH_ERR() macro for error prints
Use ODPH_ERR() macro for all error prints in the validation tests and make
error messages more consistent. The helper macro adds additional debug
information (filename, line number, function name) to the error messages,
which can help debugging.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/test/validation/api/shmem/shmem_odp2.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c b/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c index 4b7af3736..1f2637a6a 100644 --- a/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c +++ b/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c @@ -5,6 +5,8 @@ */ #include <odp_api.h> +#include <odp/helper/odph_api.h> + #include <linux/limits.h> #include <sys/types.h> #include <unistd.h> @@ -33,11 +35,11 @@ int main(int argc, char *argv[]) /* odp init: */ if (0 != odp_init_global(&odp2, NULL, NULL)) { - fprintf(stderr, "error: odp_init_global() failed.\n"); + ODPH_ERR("odp_init_global() failed\n"); return 1; } if (0 != odp_init_local(odp2, ODP_THREAD_CONTROL)) { - fprintf(stderr, "error: odp_init_local() failed.\n"); + ODPH_ERR("odp_init_local() failed\n"); return 1; } @@ -46,8 +48,7 @@ int main(int argc, char *argv[]) * is given as first arg. In linux-generic ODP, this pid is actually * the ODP instance */ if (argc != 2) { - fprintf(stderr, "One single parameter expected, %d found.\n", - argc); + ODPH_ERR("One single parameter expected, %d found\n", argc); return 1; } odp1 = (odp_instance_t)atoi(argv[1]); @@ -56,46 +57,46 @@ int main(int argc, char *argv[]) SHM_NAME, (int)odp1); shm = odp_shm_import(SHM_NAME, odp1, SHM_NAME); if (shm == ODP_SHM_INVALID) { - fprintf(stderr, "error: odp_shm_lookup_external failed.\n"); + ODPH_ERR("odp_shm_import() failed\n"); return 1; } /* check that the read size matches the allocated size (in other ODP):*/ if ((odp_shm_info(shm, &info)) || (info.size != sizeof(*test_shared_data))) { - fprintf(stderr, "error: odp_shm_info failed.\n"); + ODPH_ERR("odp_shm_info() failed\n"); return 1; } test_shared_data = odp_shm_addr(shm); if (test_shared_data == NULL) { - fprintf(stderr, "error: odp_shm_addr failed.\n"); + ODPH_ERR("odp_shm_addr() failed\n"); return 1; } if (test_shared_data->foo != TEST_SHARE_FOO) { - fprintf(stderr, "error: Invalid data TEST_SHARE_FOO.\n"); + ODPH_ERR("Invalid data TEST_SHARE_FOO\n"); return 1; } if (test_shared_data->bar != TEST_SHARE_BAR) { - fprintf(stderr, "error: Invalid data TEST_SHARE_BAR.\n"); + ODPH_ERR("Invalid data TEST_SHARE_BAR\n"); return 1; } if (odp_shm_free(shm) != 0) { - fprintf(stderr, "error: odp_shm_free() failed.\n"); + ODPH_ERR("odp_shm_free() failed\n"); return 1; } /* odp term: */ if (0 != odp_term_local()) { - fprintf(stderr, "error: odp_term_local() failed.\n"); + ODPH_ERR("odp_term_local() failed\n"); return 1; } if (0 != odp_term_global(odp2)) { - fprintf(stderr, "error: odp_term_global() failed.\n"); + ODPH_ERR("odp_term_global() failed\n"); return 1; } |