Skip to content

Commit 2cf3617

Browse files
shijin-awsj-xiong
authored andcommitted
[v2.3.x] fabtests/cq_data: Fix the error propagation
The current run_test() has a bug, that the cq data check and cq data size check are setting the same return code. That means when a cq data check failed but cq data size check succeeds, the return code will be still 0. This patch fixes this issue by making the test return error directly when any check failed. Signed-off-by: Shi Jin <[email protected]> (cherry picked from commit 0682ba4)
1 parent 10ba75a commit 2cf3617

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fabtests/functional/cq_data.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,28 @@ static int run_test()
9090
return ret;
9191
}
9292

93+
/* Here we have a successful cq read */
94+
ret = FI_SUCCESS;
9395
if (comp.flags & FI_REMOTE_CQ_DATA) {
9496
if ((comp.data & mask) == (remote_cq_data & mask)) {
9597
fprintf(stdout, "remote_cq_data: success\n");
96-
ret = 0;
9798
} else {
9899
fprintf(stdout, "error, Expected data:0x%" PRIx64
99100
", Received data:0x%" PRIx64 "\n",
100101
remote_cq_data, comp.data);
101-
ret = -FI_EIO;
102+
return -FI_EIO;
102103
}
103104

104105
if (comp.len == size) {
105106
fprintf(stdout, "fi_cq_data_entry.len verify: success\n");
106-
ret = 0;
107107
} else {
108108
fprintf(stdout, "error, Expected len:%zu, Received len:%zu\n",
109109
size, comp.len);
110-
ret = -FI_EIO;
110+
return -FI_EIO;
111111
}
112112
} else {
113113
fprintf(stdout, "error, CQ data flag not set\n");
114-
ret = -FI_EBADFLAGS;
114+
return -FI_EBADFLAGS;
115115
}
116116
}
117117

0 commit comments

Comments
 (0)