[Openmp-commits] [openmp] 8f78d95 - Make test more explicit on failure.

Doru Bercea via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 24 09:49:08 PDT 2023


Author: Doru Bercea
Date: 2023-03-24T12:48:58-04:00
New Revision: 8f78d954c6e257aaf630f559bdd33b41e1985ffd

URL: https://github.com/llvm/llvm-project/commit/8f78d954c6e257aaf630f559bdd33b41e1985ffd
DIFF: https://github.com/llvm/llvm-project/commit/8f78d954c6e257aaf630f559bdd33b41e1985ffd.diff

LOG: Make test more explicit on failure.

Patch: https://reviews.llvm.org/D146812

Added: 
    

Modified: 
    openmp/libomptarget/test/mapping/private_mapping.c

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/test/mapping/private_mapping.c b/openmp/libomptarget/test/mapping/private_mapping.c
index 6ed8cbf9e488d..f537489cd08f4 100644
--- a/openmp/libomptarget/test/mapping/private_mapping.c
+++ b/openmp/libomptarget/test/mapping/private_mapping.c
@@ -4,7 +4,7 @@
 #include <stdio.h>
 
 int main() {
-  int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
+  int data1[3] = {1}, data2[3] = {2}, data3[3] = {5};
   int sum[16] = {0};
 #pragma omp target teams distribute parallel for map(tofrom : sum)             \
     firstprivate(data1, data2, data3)
@@ -16,9 +16,18 @@ int main() {
     }
   }
 
+  int correct = 1;
   for (int i = 0; i < 16; ++i) {
-    assert(sum[i] == 6);
+    if (sum[i] != 8) {
+      correct = 0;
+      printf("ERROR: The sum for index %d is %d\n", i, sum[i]);
+      printf("ERROR: data1 = {%d, %d, %d}\n", data1[0], data1[1], data1[2]);
+      printf("ERROR: data2 = {%d, %d, %d}\n", data2[0], data2[1], data2[2]);
+      printf("ERROR: data3 = {%d, %d, %d}\n", data3[0], data3[1], data3[2]);
+      break;
+    }
   }
+  assert(correct);
 
   printf("PASS\n");
 


        


More information about the Openmp-commits mailing list