summaryrefslogtreecommitdiffstats
path: root/openmp/tools
diff options
context:
space:
mode:
authorJoachim Protze <protze@itc.rwth-aachen.de>2020-01-13 21:44:06 -1000
committerJoachim Protze <protze@itc.rwth-aachen.de>2020-01-13 21:47:58 -1000
commit84637408f2e63821014974dac08dee50bb197c1b (patch)
tree634e058a748951b15bde4dc38eb5d215f1d2fbbf /openmp/tools
parent7cd429f27d4886bb841ed0e3702e970f5f6cccd1 (diff)
downloadbcm5719-llvm-84637408f2e63821014974dac08dee50bb197c1b.tar.gz
bcm5719-llvm-84637408f2e63821014974dac08dee50bb197c1b.zip
[OpenMP][Tool] Make tests for archer dependent on TSan
If the openmp project is built standalone, the test compiler is feature tested for an available -fsanitize=thread flag. If the openmp project is built as part of llvm, the target tsan is needed to test archer. An additional line (requires tsan) was introduced to the tests, this patch updates the line numbers for the race. Follow-up for 77ad98c Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D71914
Diffstat (limited to 'openmp/tools')
-rw-r--r--openmp/tools/archer/tests/CMakeLists.txt6
-rw-r--r--openmp/tools/archer/tests/lit.cfg6
-rw-r--r--openmp/tools/archer/tests/lit.site.cfg.in5
-rw-r--r--openmp/tools/archer/tests/races/critical-unrelated.c2
-rw-r--r--openmp/tools/archer/tests/races/lock-nested-unrelated.c2
-rw-r--r--openmp/tools/archer/tests/races/lock-unrelated.c2
-rw-r--r--openmp/tools/archer/tests/races/parallel-simple.c2
-rw-r--r--openmp/tools/archer/tests/races/task-dependency.c4
-rw-r--r--openmp/tools/archer/tests/races/task-taskgroup-unrelated.c7
-rw-r--r--openmp/tools/archer/tests/races/task-taskwait-nested.c4
-rw-r--r--openmp/tools/archer/tests/races/task-two.c6
11 files changed, 20 insertions, 26 deletions
diff --git a/openmp/tools/archer/tests/CMakeLists.txt b/openmp/tools/archer/tests/CMakeLists.txt
index 4f70b1a826d..baf832a8956 100644
--- a/openmp/tools/archer/tests/CMakeLists.txt
+++ b/openmp/tools/archer/tests/CMakeLists.txt
@@ -16,6 +16,9 @@ endif()
set(LIBARCHER_TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+set(LIBARCHER_TEST_FLAGS "" CACHE STRING
+ "Extra compiler flags to send to the test compiler.")
+
macro(pythonize_bool var)
if (${var})
set(${var} True)
@@ -25,8 +28,9 @@ macro(pythonize_bool var)
endmacro()
pythonize_bool(LIBARCHER_HAVE_LIBATOMIC)
+pythonize_bool(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS)
-add_openmp_testsuite(check-libarcher "Running libarcher tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS archer)
+add_openmp_testsuite(check-libarcher "Running libarcher tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS archer omp)
# Configure the lit.site.cfg.in file
set(AUTO_GEN_COMMENT "## Autogenerated by libarcher configuration.\n# Do not edit!")
diff --git a/openmp/tools/archer/tests/lit.cfg b/openmp/tools/archer/tests/lit.cfg
index 286e59322cd..3014c020bb9 100644
--- a/openmp/tools/archer/tests/lit.cfg
+++ b/openmp/tools/archer/tests/lit.cfg
@@ -46,7 +46,7 @@ config.test_flags = " -I " + config.test_source_root + \
" -I " + config.omp_header_dir + \
" -L " + config.omp_library_dir + \
" -Wl,-rpath," + config.omp_library_dir + \
- " " + config.test_extra_flags
+ " " + config.test_archer_flags
config.archer_flags = "-g -O1 -fsanitize=thread"
@@ -63,6 +63,7 @@ for feature in config.test_compiler_features:
# Setup environment to find dynamic library at runtime
append_dynamic_library_path(config.omp_library_dir)
+append_dynamic_library_path(config.libarcher_obj_root+"/..")
# Rpath modifications for Darwin
if config.operating_system == 'Darwin':
@@ -81,6 +82,9 @@ if config.operating_system == 'Darwin':
if 'Linux' in config.operating_system:
config.available_features.add("linux")
+if config.has_tsan == True:
+ config.available_features.add("tsan")
+
# to run with icc INTEL_LICENSE_FILE must be set
if 'INTEL_LICENSE_FILE' in os.environ:
config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
diff --git a/openmp/tools/archer/tests/lit.site.cfg.in b/openmp/tools/archer/tests/lit.site.cfg.in
index 8ab8821e4f5..cde10b2dd8d 100644
--- a/openmp/tools/archer/tests/lit.site.cfg.in
+++ b/openmp/tools/archer/tests/lit.site.cfg.in
@@ -10,9 +10,10 @@ config.libomp_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
config.omp_library_dir = "@LIBOMP_LIBRARY_DIR@"
config.omp_header_dir = "@LIBOMP_INCLUDE_DIR@"
config.operating_system = "@CMAKE_SYSTEM_NAME@"
-config.has_libatomic = "@LIBARCHER_HAVE_LIBATOMIC@"
+config.has_libatomic = @LIBARCHER_HAVE_LIBATOMIC@
+config.has_tsan = @OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS@
-config.test_archer_flags = "@OPENMP_TEST_ARCHER_FLAGS@"
+config.test_archer_flags = "@LIBARCHER_TEST_FLAGS@"
config.libarcher_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
# Let the main config do the real work.
diff --git a/openmp/tools/archer/tests/races/critical-unrelated.c b/openmp/tools/archer/tests/races/critical-unrelated.c
index 736d6f1dd68..58678a4831b 100644
--- a/openmp/tools/archer/tests/races/critical-unrelated.c
+++ b/openmp/tools/archer/tests/races/critical-unrelated.c
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
#include <omp.h>
@@ -40,4 +39,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}critical-unrelated.c:29
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/lock-nested-unrelated.c b/openmp/tools/archer/tests/races/lock-nested-unrelated.c
index cd8f515f342..cf6910dadc3 100644
--- a/openmp/tools/archer/tests/races/lock-nested-unrelated.c
+++ b/openmp/tools/archer/tests/races/lock-nested-unrelated.c
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
#include <omp.h>
@@ -46,4 +45,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}lock-nested-unrelated.c:33
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/lock-unrelated.c b/openmp/tools/archer/tests/races/lock-unrelated.c
index 358c58488d4..d1ac27af21f 100644
--- a/openmp/tools/archer/tests/races/lock-unrelated.c
+++ b/openmp/tools/archer/tests/races/lock-unrelated.c
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
#include <omp.h>
@@ -46,4 +45,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}lock-unrelated.c:31
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/parallel-simple.c b/openmp/tools/archer/tests/races/parallel-simple.c
index c77d18557fe..2dc87acfd16 100644
--- a/openmp/tools/archer/tests/races/parallel-simple.c
+++ b/openmp/tools/archer/tests/races/parallel-simple.c
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
#include <omp.h>
@@ -35,4 +34,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}parallel-simple.c:23
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/task-dependency.c b/openmp/tools/archer/tests/races/task-dependency.c
index ce418b8b5a6..0cbd3cf8ef3 100644
--- a/openmp/tools/archer/tests/races/task-dependency.c
+++ b/openmp/tools/archer/tests/races/task-dependency.c
@@ -11,13 +11,12 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
+#include "ompt/ompt-signal.h"
#include <omp.h>
#include <stdio.h>
#include <unistd.h>
-#include "ompt/ompt-signal.h"
int main(int argc, char *argv[]) {
int var = 0, a = 0;
@@ -59,4 +58,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}task-dependency.c:30
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c b/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
index 2f1228b7be2..244fdd30ac1 100644
--- a/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
+++ b/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
@@ -13,10 +13,10 @@
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
+#include "ompt/ompt-signal.h"
#include <omp.h>
#include <stdio.h>
#include <unistd.h>
-#include "ompt/ompt-signal.h"
int main(int argc, char *argv[]) {
int var = 0, a = 0;
@@ -54,9 +54,8 @@ int main(int argc, char *argv[]) {
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: {{(Write|Read)}} of size 4
-// CHECK-NEXT: #0 {{.*}}task-taskgroup-unrelated.c:46
+// CHECK-NEXT: #0 {{.*}}task-taskgroup-unrelated.c:47
// CHECK: Previous write of size 4
-// CHECK-NEXT: #0 {{.*}}task-taskgroup-unrelated.c:28
+// CHECK-NEXT: #0 {{.*}}task-taskgroup-unrelated.c:29
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/task-taskwait-nested.c b/openmp/tools/archer/tests/races/task-taskwait-nested.c
index d49b1d2a855..193ad417a62 100644
--- a/openmp/tools/archer/tests/races/task-taskwait-nested.c
+++ b/openmp/tools/archer/tests/races/task-taskwait-nested.c
@@ -11,13 +11,12 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
+#include "ompt/ompt-signal.h"
#include <omp.h>
#include <stdio.h>
#include <unistd.h>
-#include "ompt/ompt-signal.h"
int main(int argc, char *argv[]) {
int var = 0, a = 0;
@@ -57,4 +56,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}task-taskwait-nested.c:44
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
diff --git a/openmp/tools/archer/tests/races/task-two.c b/openmp/tools/archer/tests/races/task-two.c
index ad7b705837a..1af937e0341 100644
--- a/openmp/tools/archer/tests/races/task-two.c
+++ b/openmp/tools/archer/tests/races/task-two.c
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-
// RUN: %libarcher-compile-and-run-race | FileCheck %s
// REQUIRES: tsan
#include <omp.h>
@@ -24,8 +23,8 @@ int main(int argc, char *argv[]) {
int var = 0;
int i;
-#pragma omp parallel for num_threads(NUM_THREADS) shared(var) schedule(static, \
- 1)
+#pragma omp parallel for num_threads(NUM_THREADS) shared(var) \
+ schedule(static, 1)
for (i = 0; i < NUM_THREADS; i++) {
#pragma omp task shared(var) if (0) // the task is inlined an executed locally
{ var++; }
@@ -43,4 +42,3 @@ int main(int argc, char *argv[]) {
// CHECK-NEXT: #0 {{.*}}task-two.c:30
// CHECK: DONE
// CHECK: ThreadSanitizer: reported 1 warnings
-
OpenPOWER on IntegriCloud