From 847fa84b3d346313bbad31d4c76b0f70d73827aa Mon Sep 17 00:00:00 2001 From: Alexey Baturo Date: Sun, 31 Jul 2022 13:41:49 +0300 Subject: [PATCH] [RISC-V][HWASAN] Adjust lit test support for RISC-V HWASAN feature Reviewed by: vitalybuka Differential Revision: https://reviews.llvm.org/D131344 --- compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp | 2 +- compiler-rt/test/hwasan/TestCases/Linux/vfork.c | 2 +- compiler-rt/test/hwasan/TestCases/exported-tagged-global.c | 5 ++++- compiler-rt/test/hwasan/TestCases/stack-oob.c | 3 ++- compiler-rt/test/hwasan/TestCases/stack-uas.c | 2 +- compiler-rt/test/hwasan/TestCases/tag-mismatch-border-address.c | 2 +- compiler-rt/test/hwasan/TestCases/try-catch.cpp | 1 + compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-setjmp.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp | 2 +- compiler-rt/test/hwasan/TestCases/use-after-scope.cpp | 2 +- 21 files changed, 25 insertions(+), 20 deletions(-) diff --git a/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp b/compiler-rt/test/hwasan/TestCases/Linux/atfork.cpp index b9f805f..95f05d6 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 diff --git a/compiler-rt/test/hwasan/TestCases/Linux/vfork.c b/compiler-rt/test/hwasan/TestCases/Linux/vfork.c index f4e1d2a..3ab0ce9 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 diff --git a/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c b/compiler-rt/test/hwasan/TestCases/exported-tagged-global.c index 9c4936c..24f5012 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 1e6cefa..b745fb0 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 #include diff --git a/compiler-rt/test/hwasan/TestCases/stack-uas.c b/compiler-rt/test/hwasan/TestCases/stack-uas.c index 7f5a6f2..6edacd7 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 b66ab5b..85e04b7 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 #include diff --git a/compiler-rt/test/hwasan/TestCases/try-catch.cpp b/compiler-rt/test/hwasan/TestCases/try-catch.cpp index 8e35a9d..1449d8d 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 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 3f4c216..5a2d0dc 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 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 cd2ed4b..89bdf17 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 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 3ea25ba..95803da 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 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 51d10ba..aee1c46 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 b846563..8ee1277 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 5ab834e..e6643f4 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 1f7fbd1..14d9c44 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 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 adbcc1c..5e85a92 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 491d83e..9e4712c 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 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 396a03d..3157c0b 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 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 d6c751ac..db2ab61 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 369fdbe..9315820 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 b3b928d..ba53bf8 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 diff --git a/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp index 28648e4..7432c1e 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; -- 2.7.4