[compiler-rt] 3c1aa20 - [asan][test][win] Port trivial tests to not use clang-cl on MinGW

Alvin Wong via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 06:27:25 PDT 2023


Author: Alvin Wong
Date: 2023-04-21T21:25:49+08:00
New Revision: 3c1aa20c63548c77ddce3dabc7b25c7c7edccaac

URL: https://github.com/llvm/llvm-project/commit/3c1aa20c63548c77ddce3dabc7b25c7c7edccaac
DIFF: https://github.com/llvm/llvm-project/commit/3c1aa20c63548c77ddce3dabc7b25c7c7edccaac.diff

LOG: [asan][test][win] Port trivial tests to not use clang-cl on MinGW

Use clang driver on MinGW where clang-cl is not usable. MSVC target
still uses clang-cl to minimize changes to existing test runners.

Differential Revision: https://reviews.llvm.org/D147432

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp
    compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cpp
    compiler-rt/test/asan/TestCases/Windows/beginthreadex.cpp
    compiler-rt/test/asan/TestCases/Windows/bitfield.cpp
    compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cpp
    compiler-rt/test/asan/TestCases/Windows/breakpoint.cpp
    compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cpp
    compiler-rt/test/asan/TestCases/Windows/double_free.cpp
    compiler-rt/test/asan/TestCases/Windows/global_const_string.cpp
    compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cpp
    compiler-rt/test/asan/TestCases/Windows/hello_world.cpp
    compiler-rt/test/asan/TestCases/Windows/illegal_instruction.cpp
    compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp
    compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cpp
    compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cpp
    compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cpp
    compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp
    compiler-rt/test/asan/TestCases/Windows/oom.cpp
    compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cpp
    compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cpp
    compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cpp
    compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp
    compiler-rt/test/asan/TestCases/Windows/shadow_mapping_failure.cpp
    compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/stack_array_sanity.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_simple.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_stack_array_left_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_stack_array_right_oob.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_stack_reuse.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_stress.cpp
    compiler-rt/test/asan/TestCases/Windows/thread_suspended.cpp
    compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp
    compiler-rt/test/asan/TestCases/Windows/windows_h.cpp
    compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_heap.cpp
    compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cpp
    compiler-rt/test/asan/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp b/compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp
index cb36fbbe68cb4..ee6ec4495e7c8 100644
--- a/compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp
@@ -1,10 +1,14 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>
 
+#ifdef __MINGW32__
+// FIXME: remove after mingw-w64 adds this declaration.
+extern "C" size_t __cdecl _aligned_msize(void *_Memory, size_t _Alignment,
+                                         size_t _Offset);
+#endif
+
 #define CHECK_ALIGNED(ptr,alignment) \
   do { \
     if (((uintptr_t)(ptr) % (alignment)) != 0) \

diff  --git a/compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cpp b/compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cpp
index e39b7fb096214..fde5b3723f045 100644
--- a/compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/allocators_sanity.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/beginthreadex.cpp b/compiler-rt/test/asan/TestCases/Windows/beginthreadex.cpp
index eda43d3c70f25..39b9358178f28 100644
--- a/compiler-rt/test/asan/TestCases/Windows/beginthreadex.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/beginthreadex.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/bitfield.cpp b/compiler-rt/test/asan/TestCases/Windows/bitfield.cpp
index 02922f6800e33..1ed04768e9682 100644
--- a/compiler-rt/test/asan/TestCases/Windows/bitfield.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/bitfield.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cpp
index cc9a8dfa94230..8e1a2ae149148 100644
--- a/compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/bitfield_uaf.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/breakpoint.cpp b/compiler-rt/test/asan/TestCases/Windows/breakpoint.cpp
index 1ff8d0299735d..4b187a8178ddc 100644
--- a/compiler-rt/test/asan/TestCases/Windows/breakpoint.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/breakpoint.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %env_asan_opts=handle_sigill=1 not %run %t 2>&1 | FileCheck %s
 
 // Test the error output from a breakpoint. Assertion-like macros often end in

diff  --git a/compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cpp
index 4a8c6b687b601..b22c359b3dc42 100644
--- a/compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/calloc_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cpp
index 7baf3e1aa0319..9e12f9cf653e0 100644
--- a/compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/calloc_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cpp
index facc059861f7e..6c225d4c676d0 100644
--- a/compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/calloc_uaf.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/double_free.cpp b/compiler-rt/test/asan/TestCases/Windows/double_free.cpp
index 59a26418303de..45568e50d0c82 100644
--- a/compiler-rt/test/asan/TestCases/Windows/double_free.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/double_free.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/global_const_string.cpp b/compiler-rt/test/asan/TestCases/Windows/global_const_string.cpp
index 10437a6e6a60a..61252418b7f20 100644
--- a/compiler-rt/test/asan/TestCases/Windows/global_const_string.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/global_const_string.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cpp
index 3e5bd1d13630c..9788609773644 100644
--- a/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cpp b/compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cpp
index 434de5c8666a4..2f96bc443a43c 100644
--- a/compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/heapalloc_sanity.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t 2>&1 | FileCheck %s
 #include <stdio.h>
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/hello_world.cpp b/compiler-rt/test/asan/TestCases/Windows/hello_world.cpp
index 546c37e114799..507886e71acd3 100644
--- a/compiler-rt/test/asan/TestCases/Windows/hello_world.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/hello_world.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/illegal_instruction.cpp b/compiler-rt/test/asan/TestCases/Windows/illegal_instruction.cpp
index eb6c64a304a75..9b902c7536ca9 100644
--- a/compiler-rt/test/asan/TestCases/Windows/illegal_instruction.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/illegal_instruction.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %env_asan_opts=handle_sigill=1 not %run %t 2>&1 | FileCheck %s
 
 // Test the error output from an illegal instruction.

diff  --git a/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp b/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp
index d7728e38211df..3febcc48f80da 100644
--- a/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %env_asan_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck %s
 
 // Test the error output from dividing by zero.

diff  --git a/compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cpp b/compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cpp
index 401fc1227b3c1..eda82a4279dcf 100644
--- a/compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/intercept_memcpy.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cpp b/compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cpp
index 8e860f21635f3..244485ded36db 100644
--- a/compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/intercept_strdup.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cpp b/compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cpp
index 6853d12c396f8..a9f4abebfe74e 100644
--- a/compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/intercept_strlen.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp
index 0a97e66cdb320..2ee5fdc7abee2 100644
--- a/compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp
index cbdf9981a072d..dafca74b4812d 100644
--- a/compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp
index a64fdb7096be6..256582deefe46 100644
--- a/compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/oom.cpp b/compiler-rt/test/asan/TestCases/Windows/oom.cpp
index 52872c1f8aa44..5db37e8eea0e5 100644
--- a/compiler-rt/test/asan/TestCases/Windows/oom.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/oom.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 // REQUIRES: asan-32-bits
 

diff  --git a/compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cpp
index 8830faefde999..f5be333a8db18 100644
--- a/compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/operator_delete_wrong_argument.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cpp
index c9eceffcccbaf..ab104ba1a4cdd 100644
--- a/compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/operator_new_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cpp
index 85e4de83ab90c..75db1498bb1a5 100644
--- a/compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/operator_new_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cpp
index bf91b6c30112a..f9c3753f7f8bf 100644
--- a/compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/operator_new_uaf.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cpp b/compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cpp
index 2c180905b629a..d70060faf10fd 100644
--- a/compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/queue_user_work_item_report.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp
index 3adc6e68909b1..4a5a7ab8ecfdf 100644
--- a/compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp
index de83936bcd419..8f3109eed2d07 100644
--- a/compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp
index 6593e42c0ddfc..074ac270f13f5 100644
--- a/compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/shadow_mapping_failure.cpp b/compiler-rt/test/asan/TestCases/Windows/shadow_mapping_failure.cpp
index b3ee3dfe0a4b4..6e76163c3068d 100644
--- a/compiler-rt/test/asan/TestCases/Windows/shadow_mapping_failure.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/shadow_mapping_failure.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 // REQUIRES: asan-32-bits
 

diff  --git a/compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cpp
index abda43538b12d..905754e0616cc 100644
--- a/compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/stack_array_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp
index 78b38007b9ee7..b4b50daafcb7a 100644
--- a/compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/stack_array_sanity.cpp b/compiler-rt/test/asan/TestCases/Windows/stack_array_sanity.cpp
index 0f0b5450ec75b..dc98a9e6c81c5 100644
--- a/compiler-rt/test/asan/TestCases/Windows/stack_array_sanity.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/stack_array_sanity.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t | FileCheck %s
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_simple.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_simple.cpp
index 1cfc2ef3ca393..3f664bce5e006 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_simple.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_simple.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_left_oob.cpp
index 06bd43be98004..41938bcc3c8c3 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_left_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_left_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_right_oob.cpp
index 60505a335892a..529d6bb9c3b6d 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_right_oob.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_stack_array_right_oob.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_stack_reuse.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_stack_reuse.cpp
index 07635df8340cc..f727d43a3b1b3 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_stack_reuse.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_stack_reuse.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_stress.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_stress.cpp
index a4f75fef985f1..577e79eaa0036 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_stress.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_stress.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/thread_suspended.cpp b/compiler-rt/test/asan/TestCases/Windows/thread_suspended.cpp
index 00fc7f8823da0..7b832e1130378 100644
--- a/compiler-rt/test/asan/TestCases/Windows/thread_suspended.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/thread_suspended.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 #include <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp b/compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp
index e26af57cecc36..dfd25cebb6bfe 100644
--- a/compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 #include <malloc.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/windows_h.cpp b/compiler-rt/test/asan/TestCases/Windows/windows_h.cpp
index b3aacb96d4498..651fb971fd265 100644
--- a/compiler-rt/test/asan/TestCases/Windows/windows_h.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/windows_h.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: %run %t
 
 // Just make sure we can parse <windows.h>

diff  --git a/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_heap.cpp b/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_heap.cpp
index 6c8a649f930aa..a70a86eafec6f 100644
--- a/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_heap.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_heap.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 class Parent {

diff  --git a/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cpp b/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cpp
index 78c7f49ce447b..1bccd653fa6ea 100644
--- a/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/wrong_downcast_on_stack.cpp
@@ -1,6 +1,4 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 class Parent {

diff  --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 10fe57670ad41..e8c96f9b58d0e 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -146,28 +146,38 @@ def build_invocation(compile_flags):
   config.substitutions.append( ("%clang_asan_static ", build_invocation(clang_asan_static_cflags)) )
   config.substitutions.append( ("%clangxx_asan_static ", build_invocation(clang_asan_static_cxxflags)) )
 
-# MSVC-specific tests might also use the clang-cl.exe driver.
-if platform.system() == 'Windows' and target_is_msvc:
-  clang_cl_cxxflags = ["-Wno-deprecated-declarations",
-                       "-WX",
-                       "-D_HAS_EXCEPTIONS=0",
-                       "-Zi"] + target_cflags
-  clang_cl_asan_cxxflags = ["-fsanitize=address"] + clang_cl_cxxflags
-  if config.asan_dynamic:
-    clang_cl_asan_cxxflags.append("-MD")
-
-  clang_cl_invocation = build_invocation(clang_cl_cxxflags)
-  clang_cl_invocation = clang_cl_invocation.replace("clang.exe","clang-cl.exe")
-  config.substitutions.append( ("%clang_cl ", clang_cl_invocation) )
-
-  clang_cl_asan_invocation = build_invocation(clang_cl_asan_cxxflags)
-  clang_cl_asan_invocation = clang_cl_asan_invocation.replace("clang.exe","clang-cl.exe")
-  config.substitutions.append( ("%clang_cl_asan ", clang_cl_asan_invocation) )
-
-  base_lib = os.path.join(config.compiler_rt_libdir, "clang_rt.asan%%s%s.lib" % config.target_suffix)
-  config.substitutions.append( ("%asan_lib", base_lib % "") )
-  config.substitutions.append( ("%asan_cxx_lib", base_lib % "_cxx") )
-  config.substitutions.append( ("%asan_dll_thunk", base_lib % "_dll_thunk") )
+if platform.system() == 'Windows':
+  # MSVC-specific tests might also use the clang-cl.exe driver.
+  if target_is_msvc:
+    clang_cl_cxxflags = ["-Wno-deprecated-declarations",
+                        "-WX",
+                        "-D_HAS_EXCEPTIONS=0",
+                        "-Zi"] + target_cflags
+    clang_cl_asan_cxxflags = ["-fsanitize=address"] + clang_cl_cxxflags
+    if config.asan_dynamic:
+      clang_cl_asan_cxxflags.append("-MD")
+
+    clang_cl_invocation = build_invocation(clang_cl_cxxflags)
+    clang_cl_invocation = clang_cl_invocation.replace("clang.exe","clang-cl.exe")
+    config.substitutions.append( ("%clang_cl ", clang_cl_invocation) )
+
+    clang_cl_asan_invocation = build_invocation(clang_cl_asan_cxxflags)
+    clang_cl_asan_invocation = clang_cl_asan_invocation.replace("clang.exe","clang-cl.exe")
+    config.substitutions.append( ("%clang_cl_asan ", clang_cl_asan_invocation) )
+    config.substitutions.append( ("%Od", "-Od") )
+    config.substitutions.append( ("%Fe", "-Fe") )
+
+    base_lib = os.path.join(config.compiler_rt_libdir, "clang_rt.asan%%s%s.lib" % config.target_suffix)
+    config.substitutions.append( ("%asan_lib", base_lib % "") )
+    config.substitutions.append( ("%asan_cxx_lib", base_lib % "_cxx") )
+    config.substitutions.append( ("%asan_dll_thunk", base_lib % "_dll_thunk") )
+  else:
+    # To make some of these tests work on MinGW target without changing their
+    # behaviour for MSVC target, substitute clang-cl flags with gcc-like ones.
+    config.substitutions.append( ("%clang_cl ", build_invocation(target_cxxflags)) )
+    config.substitutions.append( ("%clang_cl_asan ", build_invocation(clang_asan_cxxflags)) )
+    config.substitutions.append( ("%Od", "-O0") )
+    config.substitutions.append( ("%Fe", "-o") )
 
 # FIXME: De-hardcode this path.
 asan_source_dir = os.path.join(


        


More information about the llvm-commits mailing list