Commit e1434d3b authored by Andrew Grieve's avatar Andrew Grieve Committed by Chromium LUCI CQ

SuperSize: Fix mojo categorization in canned queries

Was searching for "mojo::" within source_path rather than name.

Bug: None
Change-Id: I1a8171d89a3f2a9a64f9d7bad6254020db1fddd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600026
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838921}
parent ac39b3e1
......@@ -5,6 +5,7 @@
"""Contains a set of Chrome-specific size queries."""
import logging
import re
import models
......@@ -132,7 +133,11 @@ def _CategorizeGenerated(symbols):
'/protobuf/' in s.object_path or
s.object_path.endswith('.pbzero.o') or
s.object_path.endswith('.pb.o'))))
symbols = g.Add('Mojo', symbols.WhereSourcePathMatches(r'\bmojom?\b|^mojo::'))
mojo_pattern = re.compile(r'\bmojom?\b')
symbols = g.Add(
'Mojo',
symbols.Filter(lambda s: (s.full_name.startswith('mojo::') or mojo_pattern
.search(s.source_path))))
symbols = g.Add('DevTools', symbols.WhereSourcePathMatches(
r'\b(?:protocol|devtools)\b'))
symbols = g.Add('Blink (bindings)', symbols.WherePathMatches(
......
......@@ -76,8 +76,9 @@ std::string_view GeneratedLens::ParentName(const BaseSymbol& symbol) {
return "C++ Protocol Buffers";
}
static LazyRE2 mojo_regex = {"\\bmojom?\\b|^mojo::"};
if (PartialMatch(symbol.SourcePath(), *mojo_regex)) {
static LazyRE2 mojo_regex = {"\\bmojom?\\b"};
if (symbol.FullName().substr(0, 7) == "mojom::" ||
PartialMatch(symbol.SourcePath(), *mojo_regex)) {
return "Mojo";
}
......
......@@ -59,14 +59,22 @@ TEST(LensTest, TestGeneratedLensCppProto) {
EXPECT_EQ("C++ Protocol Buffers", GeneratedLens().ParentName(sym));
}
TEST(LensTest, TestGeneratedLensMojo) {
TEST(LensTest, TestGeneratedLensMojo1) {
Symbol sym;
sym.section_id_ = SectionId::kText;
sym.object_path_ = "a.mojom";
sym.source_path_ = "a.mojom";
sym.flags_ |= SymbolFlag::kGeneratedSource;
EXPECT_EQ("Mojo", GeneratedLens().ParentName(sym));
}
TEST(LensTest, TestGeneratedLensMojo2) {
Symbol sym;
sym.section_id_ = SectionId::kText;
sym.flags_ |= SymbolFlag::kGeneratedSource;
sym.full_name_ = "mojom::foo()";
EXPECT_EQ("Mojo", GeneratedLens().ParentName(sym));
}
TEST(LensTest, TestGeneratedLensDevTools) {
Symbol sym;
sym.section_id_ = SectionId::kText;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment