[Openmp-commits] [PATCH] D146812: [OpenMP][libomptarget][NFC] Make private mapping test more explicit on failure

Gheorghe-Teodor Bercea via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 24 07:24:16 PDT 2023


doru1004 created this revision.
doru1004 added reviewers: ronl, carlo.bertolli, jplehr, dhruvachak, jhuber6, jdoerfert.
doru1004 added a project: OpenMP.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a project: All.
doru1004 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.

The private_mapping.c test fails intermittently on the buildbot. To learn from these failures which cannot be reproduced locally we make the private mapping test more explicit on failure. This patch does not bring in any functional changes to the test itself.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146812

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


Index: openmp/libomptarget/test/mapping/private_mapping.c
===================================================================
--- openmp/libomptarget/test/mapping/private_mapping.c
+++ 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,15 @@
     }
   }
 
+  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]);
+      break;
+    }
   }
+  assert(correct);
 
   printf("PASS\n");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146812.508084.patch
Type: text/x-patch
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230324/cdfc3da9/attachment-0001.bin>


More information about the Openmp-commits mailing list