[compiler-rt] 847fa84 - [RISC-V][HWASAN] Adjust lit test support for RISC-V HWASAN feature

Alexey Baturo via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 05:15:11 PST 2022


Author: Alexey Baturo
Date: 2022-12-14T16:13:55+03:00
New Revision: 847fa84b3d346313bbad31d4c76b0f70d73827aa

URL: https://github.com/llvm/llvm-project/commit/847fa84b3d346313bbad31d4c76b0f70d73827aa
DIFF: https://github.com/llvm/llvm-project/commit/847fa84b3d346313bbad31d4c76b0f70d73827aa.diff

LOG: [RISC-V][HWASAN] Adjust lit test support for RISC-V HWASAN feature

Reviewed by: vitalybuka

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

Added: 
    

Modified: 
    compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp
    compiler-rt/test/hwasan/TestCases/Linux/vfork.c
    compiler-rt/test/hwasan/TestCases/exported-tagged-global.c
    compiler-rt/test/hwasan/TestCases/stack-oob.c
    compiler-rt/test/hwasan/TestCases/stack-uas.c
    compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c
    compiler-rt/test/hwasan/TestCases/try-catch.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp b/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp
index b9f805f327d64..95f05d634bfc7 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
 
-// REQUIRES: aarch64-target-arch || x86_64-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch
 // REQUIRES: pointer-tagging
 
 #include <assert.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/Linux/vfork.c b/compiler-rt/test/hwasan/TestCases/Linux/vfork.c
index f4e1d2a5885b5..3ab0ce97202fd 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/vfork.c
+++ b/compiler-rt/test/hwasan/TestCases/Linux/vfork.c
@@ -1,7 +1,7 @@
 // https://github.com/google/sanitizers/issues/925
 // RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
 
-// REQUIRES: aarch64-target-arch || x86_64-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch
 // REQUIRES: pointer-tagging
 
 #include <assert.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c b/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c
index 9c4936c0b94ba..24f501239129f 100644
--- a/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c
+++ b/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c
@@ -4,7 +4,10 @@
 // RUN: %run %t
 // RUN: %clang_hwasan -O1 -mllvm --aarch64-enable-global-isel-at-O=1 %s -o %t
 // RUN: %run %t
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
+
+// This test relies on aarch64 option thus it fails for risc-v
+// XFAIL: riscv64-target-arch
 
 static int global;
 

diff  --git a/compiler-rt/test/hwasan/TestCases/stack-oob.c b/compiler-rt/test/hwasan/TestCases/stack-oob.c
index 1e6cefaf03f18..b745fb071ad19 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-oob.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-oob.c
@@ -10,7 +10,8 @@
 // REQUIRES: stable-runtime
 
 // Stack short granules are currently not implemented on x86.
-// XFAIL: x86_64
+// RISC-V target doesn't support oldrt
+// XFAIL: x86_64, riscv64
 
 #include <stdlib.h>
 #include <sanitizer/hwasan_interface.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/stack-uas.c b/compiler-rt/test/hwasan/TestCases/stack-uas.c
index 7f5a6f26d0675..6edacd7587cb9 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-uas.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-uas.c
@@ -40,7 +40,7 @@ __attribute__((noinline)) void Unrelated3() {
 __attribute__((noinline)) char buggy() {
   char *volatile p;
   {
-    char zzz[0x1000];
+    char zzz[0x1000] = {};
     p = zzz;
   }
   return *p;

diff  --git a/compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c b/compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c
index b66ab5b4babad..85e04b79ee6c8 100644
--- a/compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c
+++ b/compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c
@@ -3,7 +3,7 @@
 // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK
 
 // REQUIRES: stable-runtime
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 
 #include <sanitizer/hwasan_interface.h>
 #include <stdio.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/try-catch.cpp b/compiler-rt/test/hwasan/TestCases/try-catch.cpp
index 8e35a9dd2a5ff..1449d8d6f81d0 100644
--- a/compiler-rt/test/hwasan/TestCases/try-catch.cpp
+++ b/compiler-rt/test/hwasan/TestCases/try-catch.cpp
@@ -5,6 +5,7 @@
 // RUN: %clangxx_hwasan_oldrt -static-libstdc++ %s -mllvm -hwasan-instrument-landing-pads=0 -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=BAD
 
 // C++ tests on x86_64 require instrumented libc++/libstdc++.
+// RISC-V target doesn't support oldrt
 // REQUIRES: aarch64-target-arch
 
 #include <stdexcept>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
index 3f4c216345ec3..5a2d0dc228cd1 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
@@ -2,7 +2,7 @@
 
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope --std=c++11 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <functional>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
index cd2ed4b82fd6e..89bdf1736777f 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
index 3ea25ba06b9ab..95803da9fc9db 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
@@ -5,7 +5,7 @@
 // Function jumps over variable initialization making lifetime analysis
 // ambiguous. Asan should ignore such variable and program must not fail.
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <stdlib.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
index 51d10ba10a850..aee1c46c2bcb9 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 int *p;

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
index b84656360e814..8ee127796019b 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
@@ -7,7 +7,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O2 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 int *arr;

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
index 5ab834e497c9e..e6643f4120dde 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 volatile int *p;

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
index 1f7fbd1610a6a..14d9c44192488 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <stdlib.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
index adbcc1cab85d4..5e85a9287a219 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 int *p[3];

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp
index 491d83eba5d49..9e4712cfe1524 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp
@@ -2,7 +2,7 @@
 
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && %run %t
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <stdio.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp
index 396a03d22bb86..3157c0bd23fc1 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp
@@ -1,7 +1,7 @@
 // RUN: %clangxx_hwasan  -mllvm -hwasan-use-stack-safety=0 -mllvm -hwasan-use-after-scope -O2 %s -o %t && \
 // RUN:     %run %t 2>&1
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <sanitizer/hwasan_interface.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
index d6c751ac73284..db2ab61835bc6 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -std=c++11 -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 struct IntHolder {

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
index 369fdbeb172c2..9315820943160 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -std=c++11 -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 struct IntHolder {

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
index b3b928d29c73f..ba53bf8e47c1f 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
@@ -27,7 +27,7 @@
 // RUN: not %run %t-noexcept 9 2>&1 | FileCheck %s
 // RUN: not %run %t-noexcept 10 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 #include <stdlib.h>

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
index 28648e4804860..7432c1ee7226a 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
@@ -3,7 +3,7 @@
 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
 // REQUIRES: stable-runtime
 
 volatile int *p = 0;


        


More information about the llvm-commits mailing list