[PERF2BOLT] Fix unittest failure

Fix failure caused by commit e549ac072b "Do not issue parsing error on
weird build ids".
This commit is contained in:
Rafael Auler 2022-09-28 15:59:58 -07:00
parent 0401dc2913
commit ba9cc6537c
2 changed files with 9 additions and 1 deletions

View File

@ -311,6 +311,10 @@ private:
/// Consume the entire line /// Consume the entire line
void consumeRestOfLine(); void consumeRestOfLine();
/// True if the next token in the parsing buffer is a new line, but don't
/// consume it (peek only).
bool checkNewLine();
/// Parse a single LBR entry as output by perf script -Fbrstack /// Parse a single LBR entry as output by perf script -Fbrstack
ErrorOr<LBREntry> parseLBREntry(); ErrorOr<LBREntry> parseLBREntry();

View File

@ -1056,6 +1056,10 @@ void DataAggregator::consumeRestOfLine() {
Line += 1; Line += 1;
} }
bool DataAggregator::checkNewLine() {
return ParsingBuf[0] == '\n';
}
ErrorOr<DataAggregator::PerfBranchSample> DataAggregator::parseBranchSample() { ErrorOr<DataAggregator::PerfBranchSample> DataAggregator::parseBranchSample() {
PerfBranchSample Res; PerfBranchSample Res;
@ -2148,7 +2152,7 @@ DataAggregator::parseNameBuildIDPair() {
// If one of the strings is missing, don't issue a parsing error, but still // If one of the strings is missing, don't issue a parsing error, but still
// do not return a value. // do not return a value.
consumeAllRemainingFS(); consumeAllRemainingFS();
if (checkAndConsumeNewLine()) if (checkNewLine())
return NoneType(); return NoneType();
ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true); ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true);