aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2023-01-26 07:47:37 -0800
committerPaul Robinson <paul.robinson@sony.com>2023-01-26 08:40:38 -0800
commit787876b0d592a6b4e87d00a0adb89ce87dfc11cd (patch)
tree057166e83865dc63146bda792324da56199e04fe /clang
parent3674421c4bc0cd3b65b8f1feaaf7038ac2d47ca8 (diff)
downloadllvm-787876b0d592a6b4e87d00a0adb89ce87dfc11cd.zip
llvm-787876b0d592a6b4e87d00a0adb89ce87dfc11cd.tar.gz
llvm-787876b0d592a6b4e87d00a0adb89ce87dfc11cd.tar.bz2
[unittests] Use GTEST_SKIP() instead of return when appropriate
Basically NFC: A TEST/TEST_F/etc that bails out early (usually because setup failed or some other runtime condition wasn't met) generally should use GTEST_SKIP() to report its status correctly, unless it takes steps to report another status (e.g., FAIL()).
Diffstat (limited to 'clang')
-rw-r--r--clang/unittests/AST/StructuralEquivalenceTest.cpp4
-rw-r--r--clang/unittests/Driver/ToolChainTest.cpp2
-rw-r--r--clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/clang/unittests/AST/StructuralEquivalenceTest.cpp b/clang/unittests/AST/StructuralEquivalenceTest.cpp
index 03616d7..5060301 100644
--- a/clang/unittests/AST/StructuralEquivalenceTest.cpp
+++ b/clang/unittests/AST/StructuralEquivalenceTest.cpp
@@ -460,7 +460,7 @@ TEST_F(StructuralEquivalenceFunctionTest,
// These attributes may not be available on certain platforms.
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
llvm::Triple::x86_64)
- return;
+ GTEST_SKIP();
auto t = makeNamedDecls("__attribute__((preserve_all)) void foo();",
"__attribute__((ms_abi)) void foo();", Lang_C99);
EXPECT_FALSE(testStructuralMatch(t));
@@ -469,7 +469,7 @@ TEST_F(StructuralEquivalenceFunctionTest,
TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentSavedRegsAttr) {
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
llvm::Triple::x86_64)
- return;
+ GTEST_SKIP();
auto t = makeNamedDecls(
"__attribute__((no_caller_saved_registers)) void foo();",
" void foo();", Lang_C99);
diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp
index 068c583..4ddeada 100644
--- a/clang/unittests/Driver/ToolChainTest.cpp
+++ b/clang/unittests/Driver/ToolChainTest.cpp
@@ -243,7 +243,7 @@ TEST(ToolChainTest, GetTargetAndMode) {
llvm::InitializeAllTargets();
std::string IgnoredError;
if (!llvm::TargetRegistry::lookupTarget("x86_64", IgnoredError))
- return;
+ GTEST_SKIP();
ParsedClangName Res = ToolChain::getTargetAndModeFromProgramName("clang");
EXPECT_TRUE(Res.TargetPrefix.empty());
diff --git a/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp b/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
index f54c655..6983a53 100644
--- a/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ b/clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -57,7 +57,7 @@ TEST(InterpreterTest, CatchException) {
// Using llvm::consumeError will require typeinfo for ErrorInfoBase, we
// can avoid that by going via the C interface.
LLVMConsumeError(llvm::wrap(J.takeError()));
- return;
+ GTEST_SKIP();
}
}
@@ -102,16 +102,16 @@ extern "C" int throw_exception() {
// AIX is unsupported.
if (Triple.isOSAIX())
- return;
+ GTEST_SKIP();
// FIXME: ARM fails due to `Not implemented relocation type!`
if (Triple.isARM())
- return;
+ GTEST_SKIP();
// FIXME: libunwind on darwin is broken, see PR49692.
if (Triple.isOSDarwin() && (Triple.getArch() == llvm::Triple::aarch64 ||
Triple.getArch() == llvm::Triple::aarch64_32))
- return;
+ GTEST_SKIP();
llvm::cantFail(Interp->ParseAndExecute(ExceptionCode));
testing::internal::CaptureStdout();