aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2019-02-19 13:13:04 +0200
committerMatias Elo <matias.elo@nokia.com>2019-02-26 11:13:32 +0200
commitd9fb340f78366750b7b519a1e838f73672428870 (patch)
tree17786a0dc6de51beeb0afa27fa1ed7a47a57de7c /test
parent60d0a8cef06f7d5c2dcfceea69a6339613315654 (diff)
test: check odp_shm_reserve() return value
Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/performance/odp_cpu_bench.c10
-rw-r--r--test/performance/odp_l2fwd.c6
-rw-r--r--test/performance/odp_pktio_perf.c7
-rw-r--r--test/validation/api/scheduler/scheduler.c11
4 files changed, 34 insertions, 0 deletions
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c
index 852ed3087..4c36aca1e 100644
--- a/test/performance/odp_cpu_bench.c
+++ b/test/performance/odp_cpu_bench.c
@@ -578,6 +578,11 @@ int main(int argc, char *argv[])
shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE,
0);
+ if (shm == ODP_SHM_INVALID) {
+ LOG_ERR("Error: shared mem reserve failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) {
LOG_ERR("Error: shared mem alloc failed\n");
@@ -592,6 +597,11 @@ int main(int argc, char *argv[])
sizeof(lookup_entry_t) *
gbl_args->appl.lookup_tbl_size,
ODP_CACHE_LINE_SIZE, 0);
+ if (lookup_tbl_shm == ODP_SHM_INVALID) {
+ LOG_ERR("Error: shared mem reserve failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
gbl_args->lookup_tbl = odp_shm_addr(lookup_tbl_shm);
if (gbl_args->lookup_tbl == NULL) {
LOG_ERR("Error: lookup table mem alloc failed\n");
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 78e3920f7..15a0cb0e4 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -1484,6 +1484,12 @@ int main(int argc, char *argv[])
/* Reserve memory for args from shared mem */
shm = odp_shm_reserve("shm_args", sizeof(args_t),
ODP_CACHE_LINE_SIZE, 0);
+
+ if (shm == ODP_SHM_INVALID) {
+ LOG_ERR("Error: shared mem reserve failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) {
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 2ed2c3529..55e905664 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -1062,6 +1062,9 @@ int main(int argc, char **argv)
shm = odp_shm_reserve("test_globals",
sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID)
+ LOG_ABORT("Shared memory reserve failed.\n");
+
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL)
LOG_ABORT("Shared memory reserve failed.\n");
@@ -1076,6 +1079,8 @@ int main(int argc, char **argv)
shm = odp_shm_reserve("test_globals.rx_stats",
gbl_args->rx_stats_size,
ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID)
+ LOG_ABORT("Shared memory reserve failed.\n");
gbl_args->rx_stats = odp_shm_addr(shm);
@@ -1087,6 +1092,8 @@ int main(int argc, char **argv)
shm = odp_shm_reserve("test_globals.tx_stats",
gbl_args->tx_stats_size,
ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID)
+ LOG_ABORT("Shared memory reserve failed.\n");
gbl_args->tx_stats = odp_shm_addr(shm);
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c
index c128580d6..b7128c1f0 100644
--- a/test/validation/api/scheduler/scheduler.c
+++ b/test/validation/api/scheduler/scheduler.c
@@ -2010,6 +2010,11 @@ static int scheduler_suite_init(void)
shm = odp_shm_reserve(GLOBALS_SHM_NAME,
sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) {
+ printf("Shared memory reserve failed (globals).\n");
+ return -1;
+ }
+
globals = odp_shm_addr(shm);
if (!globals) {
@@ -2027,6 +2032,12 @@ static int scheduler_suite_init(void)
shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t),
ODP_CACHE_LINE_SIZE, 0);
+
+ if (shm == ODP_SHM_INVALID) {
+ printf("Shared memory reserve failed (args).\n");
+ return -1;
+ }
+
args = odp_shm_addr(shm);
if (!args) {