From 614c7ef81c7de51f61239e609edf9c6716b23ebc Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Mon, 21 Sep 2015 20:41:31 +0000 Subject: OpenMP Initial testsuite change to purely llvm-lit based testing This change introduces a check-libomp target which is based upon llvm's lit test infrastructure. Each test (generated from the University of Houston's OpenMP testsuite) is compiled and then run. For each test, an exit status of 0 indicates success and non-zero indicates failure. This way, FileCheck is not needed. I've added a bit of logic to generate symlinks (libiomp5 and libgomp) in the build tree so that gcc can be tested as well. When building out-of- tree builds, the user will have to provide llvm-lit either by specifying -DLIBOMP_LLVM_LIT_EXECUTABLE or having llvm-lit in their PATH. Differential Revision: http://reviews.llvm.org/D11821 llvm-svn: 248211 --- .../runtime/test/tasking/omp_task_firstprivate.c | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 openmp/runtime/test/tasking/omp_task_firstprivate.c (limited to 'openmp/runtime/test/tasking/omp_task_firstprivate.c') diff --git a/openmp/runtime/test/tasking/omp_task_firstprivate.c b/openmp/runtime/test/tasking/omp_task_firstprivate.c new file mode 100644 index 00000000000..b5f4d234bfb --- /dev/null +++ b/openmp/runtime/test/tasking/omp_task_firstprivate.c @@ -0,0 +1,51 @@ +// RUN: %libomp-compile-and-run +#include +#include +#include "omp_testsuite.h" + +int test_omp_task_firstprivate() +{ + int i; + int sum = 1234; + int known_sum; + int result = 0; /* counts the wrong sums from tasks */ + + known_sum = 1234 + (LOOPCOUNT * (LOOPCOUNT + 1)) / 2; + + #pragma omp parallel + { + #pragma omp single + { + for (i = 0; i < NUM_TASKS; i++) { + #pragma omp task firstprivate(sum) + { + int j; + for (j = 0; j <= LOOPCOUNT; j++) { + #pragma omp flush + sum += j; + } + + /* check if calculated sum was right */ + if (sum != known_sum) { + #pragma omp critical + { result++; } + } + } /* omp task */ + } /* for loop */ + } /* omp single */ + } /* omp parallel */ + return (result == 0); +} + +int main() +{ + int i; + int num_failed=0; + + for(i = 0; i < REPETITIONS; i++) { + if(!test_omp_task_firstprivate()) { + num_failed++; + } + } + return num_failed; +} -- cgit v1.2.3