mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-19 14:00:09 +00:00
[RGT] Use GTEST_SKIP() in more places where we skip a test
Simply returning will report the test as PASSED when it didn't really do anything. SKIPPED is the correct result for these. Found by the Rotten Green Tests project.
This commit is contained in:
parent
88a7508b1f
commit
6aa8a836c0
@ -103,15 +103,15 @@ TEST(CrashRecoveryTest, DumpStackCleanup) {
|
||||
}
|
||||
|
||||
TEST(CrashRecoveryTest, LimitedStackTrace) {
|
||||
// FIXME: Handle "Depth" parameter in PrintStackTrace() function
|
||||
// to print stack trace upto a specified Depth.
|
||||
if (Triple(sys::getProcessTriple()).isOSWindows())
|
||||
GTEST_SKIP();
|
||||
std::string Res;
|
||||
llvm::raw_string_ostream RawStream(Res);
|
||||
PrintStackTrace(RawStream, 1);
|
||||
std::string Str = RawStream.str();
|
||||
// FIXME: Handle "Depth" parameter in PrintStackTrace() function
|
||||
// to print stack trace upto a specified Depth.
|
||||
if (!Triple(sys::getProcessTriple()).isOSWindows()) {
|
||||
EXPECT_EQ(std::string::npos, Str.find("#1"));
|
||||
}
|
||||
EXPECT_EQ(std::string::npos, Str.find("#1"));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -484,12 +484,12 @@ TEST(Support, HomeDirectory) {
|
||||
#endif
|
||||
// Do not try to test it if we don't know what to expect.
|
||||
// On Windows we use something better than env vars.
|
||||
if (!expected.empty()) {
|
||||
SmallString<128> HomeDir;
|
||||
auto status = path::home_directory(HomeDir);
|
||||
EXPECT_TRUE(status);
|
||||
EXPECT_EQ(expected, HomeDir);
|
||||
}
|
||||
if (expected.empty())
|
||||
GTEST_SKIP();
|
||||
SmallString<128> HomeDir;
|
||||
auto status = path::home_directory(HomeDir);
|
||||
EXPECT_TRUE(status);
|
||||
EXPECT_EQ(expected, HomeDir);
|
||||
}
|
||||
|
||||
// Apple has their own solution for this.
|
||||
@ -564,21 +564,21 @@ TEST(Support, ConfigDirectory) {
|
||||
TEST(Support, ConfigDirectory) {
|
||||
std::string Expected = getEnvWin(L"LOCALAPPDATA");
|
||||
// Do not try to test it if we don't know what to expect.
|
||||
if (!Expected.empty()) {
|
||||
SmallString<128> CacheDir;
|
||||
EXPECT_TRUE(path::user_config_directory(CacheDir));
|
||||
EXPECT_EQ(Expected, CacheDir);
|
||||
}
|
||||
if (Expected.empty())
|
||||
GTEST_SKIP();
|
||||
SmallString<128> CacheDir;
|
||||
EXPECT_TRUE(path::user_config_directory(CacheDir));
|
||||
EXPECT_EQ(Expected, CacheDir);
|
||||
}
|
||||
|
||||
TEST(Support, CacheDirectory) {
|
||||
std::string Expected = getEnvWin(L"LOCALAPPDATA");
|
||||
// Do not try to test it if we don't know what to expect.
|
||||
if (!Expected.empty()) {
|
||||
SmallString<128> CacheDir;
|
||||
EXPECT_TRUE(path::cache_directory(CacheDir));
|
||||
EXPECT_EQ(Expected, CacheDir);
|
||||
}
|
||||
if (Expected.empty())
|
||||
GTEST_SKIP();
|
||||
SmallString<128> CacheDir;
|
||||
EXPECT_TRUE(path::cache_directory(CacheDir));
|
||||
EXPECT_EQ(Expected, CacheDir);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -102,7 +102,7 @@ protected:
|
||||
|
||||
TEST_F(PageSizeTest, PageSize) {
|
||||
if (!isSupported())
|
||||
return;
|
||||
GTEST_SKIP();
|
||||
|
||||
llvm::Expected<unsigned> Result = llvm::sys::Process::getPageSize();
|
||||
ASSERT_FALSE(!Result);
|
||||
|
@ -83,7 +83,7 @@ protected:
|
||||
#define CHECK_UNSUPPORTED() \
|
||||
do { \
|
||||
if (isUnsupportedOSOrEnvironment()) \
|
||||
return; \
|
||||
GTEST_SKIP(); \
|
||||
} while (0);
|
||||
|
||||
TEST_F(ThreadPoolTest, AsyncBarrier) {
|
||||
@ -263,7 +263,7 @@ TEST_F(ThreadPoolTest, AffinityMask) {
|
||||
|
||||
// Skip this test if less than 4 threads are available.
|
||||
if (llvm::hardware_concurrency().compute_thread_count() < 4)
|
||||
return;
|
||||
GTEST_SKIP();
|
||||
|
||||
using namespace llvm::sys;
|
||||
if (getenv("LLVM_THREADPOOL_AFFINITYMASK")) {
|
||||
@ -275,7 +275,7 @@ TEST_F(ThreadPoolTest, AffinityMask) {
|
||||
[](auto &T) { return T.getData().front() < 16UL; }) &&
|
||||
"Threads ran on more CPUs than expected! The affinity mask does not "
|
||||
"seem to work.");
|
||||
return;
|
||||
GTEST_SKIP();
|
||||
}
|
||||
std::string Executable =
|
||||
sys::fs::getMainExecutable(TestMainArgv0, &ThreadPoolTestStringArg1);
|
||||
|
@ -2143,7 +2143,7 @@ TEST_F(VFSFromYAMLTest, DirectoryIteration) {
|
||||
TEST_F(VFSFromYAMLTest, DirectoryIterationSameDirMultipleEntries) {
|
||||
// https://llvm.org/bugs/show_bug.cgi?id=27725
|
||||
if (!supportsSameDirMultipleYAMLEntries())
|
||||
return;
|
||||
GTEST_SKIP();
|
||||
|
||||
IntrusiveRefCntPtr<DummyFileSystem> Lower(new DummyFileSystem());
|
||||
Lower->addDirectory("//root/zab");
|
||||
|
Loading…
Reference in New Issue
Block a user