summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test/api/omp_in_parallel.c
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-09-21 20:41:31 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-09-21 20:41:31 +0000
commit614c7ef81c7de51f61239e609edf9c6716b23ebc (patch)
tree63c8efa48baad379ffc568c6355f5e6ee8b6e0d0 /openmp/runtime/test/api/omp_in_parallel.c
parent4003ed2da300c1c547c8ca96c211a2f8b0d24299 (diff)
downloadbcm5719-llvm-614c7ef81c7de51f61239e609edf9c6716b23ebc.tar.gz
bcm5719-llvm-614c7ef81c7de51f61239e609edf9c6716b23ebc.zip
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
Diffstat (limited to 'openmp/runtime/test/api/omp_in_parallel.c')
-rw-r--r--openmp/runtime/test/api/omp_in_parallel.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/openmp/runtime/test/api/omp_in_parallel.c b/openmp/runtime/test/api/omp_in_parallel.c
new file mode 100644
index 00000000000..40cc3859c50
--- /dev/null
+++ b/openmp/runtime/test/api/omp_in_parallel.c
@@ -0,0 +1,39 @@
+// RUN: %libomp-compile-and-run
+#include <stdio.h>
+#include "omp_testsuite.h"
+
+/*
+ * Checks that false is returned when called from serial region
+ * and true is returned when called within parallel region.
+ */
+int test_omp_in_parallel()
+{
+ int serial;
+ int isparallel;
+
+ serial = 1;
+ isparallel = 0;
+ serial = omp_in_parallel();
+
+ #pragma omp parallel
+ {
+ #pragma omp single
+ {
+ isparallel = omp_in_parallel();
+ }
+ }
+ return (!(serial) && isparallel);
+}
+
+int main()
+{
+ int i;
+ int num_failed=0;
+
+ for(i = 0; i < REPETITIONS; i++) {
+ if(!test_omp_in_parallel()) {
+ num_failed++;
+ }
+ }
+ return num_failed;
+}
OpenPOWER on IntegriCloud