mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 07:58:23 +08:00
Revert "[NFC][Diagnostic] Try all permutations in longest match test" (#163342)
Reverts llvm/llvm-project#163277 The test is failing on many bots including: - https://lab.llvm.org/buildbot/#/builders/46/builds/24812 - https://lab.llvm.org/buildbot/#/builders/55/builds/18592 - https://lab.llvm.org/buildbot/#/builders/63/builds/11216 - https://lab.llvm.org/buildbot/#/builders/161/builds/8401
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -296,35 +295,23 @@ TEST_F(SuppressionMappingTest, EmitCategoryIsExcluded) {
|
||||
}
|
||||
|
||||
TEST_F(SuppressionMappingTest, LongestMatchWins) {
|
||||
StringRef Lines[] = {
|
||||
"[unused]",
|
||||
"src:*clang/*",
|
||||
"src:*clang/lib/Sema/*",
|
||||
"src:*clang/lib/Sema/*=emit",
|
||||
"src:*clang/lib/Sema/foo*",
|
||||
};
|
||||
llvm::MutableArrayRef<StringRef> Rules = Lines;
|
||||
Rules = Rules.drop_front();
|
||||
llvm::sort(Rules);
|
||||
llvm::StringLiteral SuppressionMappingFile = R"(
|
||||
[unused]
|
||||
src:*clang/*
|
||||
src:*clang/lib/Sema/*=emit
|
||||
src:*clang/lib/Sema/foo*)";
|
||||
Diags.getDiagnosticOptions().DiagnosticSuppressionMappingsFile = "foo.txt";
|
||||
FS->addFile("foo.txt", /*ModificationTime=*/{},
|
||||
llvm::MemoryBuffer::getMemBuffer(SuppressionMappingFile));
|
||||
clang::ProcessWarningOptions(Diags, Diags.getDiagnosticOptions(), *FS);
|
||||
EXPECT_THAT(diags(), IsEmpty());
|
||||
|
||||
do {
|
||||
Diags.getDiagnosticOptions().DiagnosticSuppressionMappingsFile = "foo.txt";
|
||||
std::string Contents = join(std::begin(Lines), std::end(Lines), "\n");
|
||||
FS->addFile("foo.txt", /*ModificationTime=*/{},
|
||||
llvm::MemoryBuffer::getMemBuffer(Contents));
|
||||
clang::ProcessWarningOptions(Diags, Diags.getDiagnosticOptions(), *FS);
|
||||
EXPECT_THAT(diags(), IsEmpty());
|
||||
|
||||
EXPECT_TRUE(Diags.isSuppressedViaMapping(
|
||||
diag::warn_unused_function, locForFile("clang/lib/Basic/foo.h")))
|
||||
<< Contents;
|
||||
EXPECT_FALSE(Diags.isSuppressedViaMapping(
|
||||
diag::warn_unused_function, locForFile("clang/lib/Sema/bar.h")))
|
||||
<< Contents;
|
||||
EXPECT_TRUE(Diags.isSuppressedViaMapping(
|
||||
diag::warn_unused_function, locForFile("clang/lib/Sema/foo.h")))
|
||||
<< Contents;
|
||||
} while (std::next_permutation(Rules.begin(), Rules.end()));
|
||||
EXPECT_TRUE(Diags.isSuppressedViaMapping(
|
||||
diag::warn_unused_function, locForFile("clang/lib/Basic/foo.h")));
|
||||
EXPECT_FALSE(Diags.isSuppressedViaMapping(
|
||||
diag::warn_unused_function, locForFile("clang/lib/Sema/bar.h")));
|
||||
EXPECT_TRUE(Diags.isSuppressedViaMapping(diag::warn_unused_function,
|
||||
locForFile("clang/lib/Sema/foo.h")));
|
||||
}
|
||||
|
||||
TEST_F(SuppressionMappingTest, LongShortMatch) {
|
||||
|
||||
Reference in New Issue
Block a user