Skip to content

Commit 8f78d95

Browse files
committed
Make test more explicit on failure.
Patch: https://reviews.llvm.org/D146812
1 parent 6d5845c commit 8f78d95

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

openmp/libomptarget/test/mapping/private_mapping.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdio.h>
55

66
int main() {
7-
int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
7+
int data1[3] = {1}, data2[3] = {2}, data3[3] = {5};
88
int sum[16] = {0};
99
#pragma omp target teams distribute parallel for map(tofrom : sum) \
1010
firstprivate(data1, data2, data3)
@@ -16,9 +16,18 @@ int main() {
1616
}
1717
}
1818

19+
int correct = 1;
1920
for (int i = 0; i < 16; ++i) {
20-
assert(sum[i] == 6);
21+
if (sum[i] != 8) {
22+
correct = 0;
23+
printf("ERROR: The sum for index %d is %d\n", i, sum[i]);
24+
printf("ERROR: data1 = {%d, %d, %d}\n", data1[0], data1[1], data1[2]);
25+
printf("ERROR: data2 = {%d, %d, %d}\n", data2[0], data2[1], data2[2]);
26+
printf("ERROR: data3 = {%d, %d, %d}\n", data3[0], data3[1], data3[2]);
27+
break;
28+
}
2129
}
30+
assert(correct);
2231

2332
printf("PASS\n");
2433

0 commit comments

Comments
 (0)