aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-03-20 10:54:44 +0200
committerMatias Elo <matias.elo@nokia.com>2023-04-12 11:27:12 +0300
commitd02d969c1a7f478f5b7c06f14160ff040851c7b8 (patch)
tree8e4888dbea4652feb9c062b8371e2613f51934a3 /test
parentbb6bf11d6251f9b7c1d190837455219cc4ed3b1d (diff)
validation: stash: test putting objects into a full stash
Test that implementation handles properly a case where application tries to store more handles into a stash than was configured in odp_stash_param_t.num_obj. The test is only ran when 'strict_size' mode is disabled. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/validation/api/stash/stash.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/test/validation/api/stash/stash.c b/test/validation/api/stash/stash.c
index 29ce8e31e..b5f498b82 100644
--- a/test/validation/api/stash/stash.c
+++ b/test/validation/api/stash/stash.c
@@ -456,7 +456,7 @@ static void stash_default_put(uint32_t size, int32_t burst, stash_op_t op, int b
odp_stash_t stash;
odp_stash_param_t param;
int32_t i, ret, retry, num_left;
- int32_t num, max_burst;
+ int32_t num, max_burst, num_stashed;
void *input, *output;
if (batch) {
@@ -519,6 +519,12 @@ static void stash_default_put(uint32_t size, int32_t burst, stash_op_t op, int b
retry = MAX_RETRY;
num_left = num;
max_burst = burst;
+ num_stashed = 0;
+
+ /* Try to store extra objects if strict mode is not enabled */
+ if (!strict_size)
+ num_left += burst;
+
while (num_left > 0) {
if (op == STASH_GEN) {
if (batch)
@@ -545,6 +551,9 @@ static void stash_default_put(uint32_t size, int32_t burst, stash_op_t op, int b
}
CU_ASSERT_FATAL(ret >= 0);
CU_ASSERT_FATAL(ret <= burst);
+
+ num_stashed += ret;
+
if (batch) {
CU_ASSERT(ret == 0 || ret == burst);
if (num_left - ret < burst)
@@ -555,6 +564,9 @@ static void stash_default_put(uint32_t size, int32_t burst, stash_op_t op, int b
num_left -= ret;
retry = MAX_RETRY;
} else {
+ /* Stash full */
+ if (num_stashed >= num)
+ break;
retry--;
CU_ASSERT_FATAL(retry > 0);
}
@@ -562,7 +574,7 @@ static void stash_default_put(uint32_t size, int32_t burst, stash_op_t op, int b
burst = max_burst;
retry = MAX_RETRY;
- num_left = num;
+ num_left = num_stashed;
while (num_left > 0) {
memset(output, 0, burst * size);
@@ -661,7 +673,7 @@ static void stash_fifo_put(uint32_t size, int32_t burst, stash_op_t op, int batc
odp_stash_t stash;
odp_stash_param_t param;
int32_t i, ret, retry, num_left;
- int32_t num, max_burst;
+ int32_t num, max_burst, num_stashed;
void *input, *output;
if (batch) {
@@ -717,6 +729,12 @@ static void stash_fifo_put(uint32_t size, int32_t burst, stash_op_t op, int batc
retry = MAX_RETRY;
num_left = num;
max_burst = burst;
+ num_stashed = 0;
+
+ /* Try to store extra objects if strict mode is not enabled */
+ if (!strict_size)
+ num_left += burst;
+
while (num_left > 0) {
for (i = 0; i < burst; i++) {
if (size == sizeof(uint64_t))
@@ -755,6 +773,8 @@ static void stash_fifo_put(uint32_t size, int32_t burst, stash_op_t op, int batc
CU_ASSERT_FATAL(ret >= 0);
CU_ASSERT_FATAL(ret <= burst);
+ num_stashed += ret;
+
if (batch) {
CU_ASSERT(ret == 0 || ret == burst);
if (num_left - ret < burst)
@@ -765,6 +785,9 @@ static void stash_fifo_put(uint32_t size, int32_t burst, stash_op_t op, int batc
num_left -= ret;
retry = MAX_RETRY;
} else {
+ /* Stash full */
+ if (num_stashed >= num)
+ break;
retry--;
CU_ASSERT_FATAL(retry > 0);
}
@@ -772,7 +795,7 @@ static void stash_fifo_put(uint32_t size, int32_t burst, stash_op_t op, int batc
burst = max_burst;
retry = MAX_RETRY;
- num_left = num;
+ num_left = num_stashed;
while (num_left > 0) {
memset(output, 0, burst * size);