mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Split test for log parser changes
GitOrigin-RevId: efe9fb29c5ae56889b686692f8533ae0ae4a3b1d
This commit is contained in:
parent
3fb74c5cd4
commit
fcf9c92160
3 changed files with 36 additions and 5 deletions
|
@ -906,6 +906,21 @@ const ProjectController = {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
latexLogParserAssignment(cb) {
|
||||||
|
SplitTestHandler.getAssignment(
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
'latex-log-parser',
|
||||||
|
(error, assignment) => {
|
||||||
|
// do not fail editor load if assignment fails
|
||||||
|
if (error) {
|
||||||
|
cb(null, { variant: 'default' })
|
||||||
|
} else {
|
||||||
|
cb(null, assignment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
err,
|
err,
|
||||||
|
|
|
@ -82,6 +82,8 @@ export const handleLogFiles = async (outputFiles, data, signal) => {
|
||||||
result.log,
|
result.log,
|
||||||
{
|
{
|
||||||
ignoreDuplicates: true,
|
ignoreDuplicates: true,
|
||||||
|
oldRegexes:
|
||||||
|
getMeta('ol-splitTestVariants')['latex-log-parser'] !== 'new',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ const LINES_REGEX = /lines? ([0-9]+)/
|
||||||
const PACKAGE_REGEX = /^(?:Package|Class|Module) (\b.+\b) Warning/
|
const PACKAGE_REGEX = /^(?:Package|Class|Module) (\b.+\b) Warning/
|
||||||
const FILE_LINE_ERROR_REGEX = /^([./].*):(\d+): (.*)/
|
const FILE_LINE_ERROR_REGEX = /^([./].*):(\d+): (.*)/
|
||||||
|
|
||||||
|
const LATEX_WARNING_REGEX_OLD = /^LaTeX Warning: (.*)$/
|
||||||
|
const PACKAGE_WARNING_REGEX_OLD = /^(Package \b.+\b Warning:.*)$/
|
||||||
|
const PACKAGE_REGEX_OLD = /^Package (\b.+\b) Warning/
|
||||||
|
|
||||||
const STATE = {
|
const STATE = {
|
||||||
NORMAL: 0,
|
NORMAL: 0,
|
||||||
ERROR: 1,
|
ERROR: 1,
|
||||||
|
@ -23,6 +27,16 @@ export default class LatexParser {
|
||||||
this.fileStack = []
|
this.fileStack = []
|
||||||
this.currentFileList = this.rootFileList = []
|
this.currentFileList = this.rootFileList = []
|
||||||
this.openParens = 0
|
this.openParens = 0
|
||||||
|
// TODO: Needed only for beta release; remove when over. 20220530
|
||||||
|
if (options.oldRegexes) {
|
||||||
|
this.latexWarningRegex = LATEX_WARNING_REGEX_OLD
|
||||||
|
this.packageWarningRegex = PACKAGE_WARNING_REGEX_OLD
|
||||||
|
this.packageRegex = PACKAGE_REGEX_OLD
|
||||||
|
} else {
|
||||||
|
this.latexWarningRegex = LATEX_WARNING_REGEX
|
||||||
|
this.packageWarningRegex = PACKAGE_WARNING_REGEX
|
||||||
|
this.packageRegex = PACKAGE_REGEX
|
||||||
|
}
|
||||||
this.log = new LogText(text)
|
this.log = new LogText(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +59,7 @@ export default class LatexParser {
|
||||||
} else if (this.currentLineIsRunawayArgument()) {
|
} else if (this.currentLineIsRunawayArgument()) {
|
||||||
this.parseRunawayArgumentError()
|
this.parseRunawayArgumentError()
|
||||||
} else if (this.currentLineIsWarning()) {
|
} else if (this.currentLineIsWarning()) {
|
||||||
this.parseSingleWarningLine(LATEX_WARNING_REGEX)
|
this.parseSingleWarningLine(this.latexWarningRegex)
|
||||||
} else if (this.currentLineIsHboxWarning()) {
|
} else if (this.currentLineIsHboxWarning()) {
|
||||||
this.parseHboxLine()
|
this.parseHboxLine()
|
||||||
} else if (this.currentLineIsPackageWarning()) {
|
} else if (this.currentLineIsPackageWarning()) {
|
||||||
|
@ -95,11 +109,11 @@ export default class LatexParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
currentLineIsWarning() {
|
currentLineIsWarning() {
|
||||||
return !!this.currentLine.match(LATEX_WARNING_REGEX)
|
return !!this.currentLine.match(this.latexWarningRegex)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentLineIsPackageWarning() {
|
currentLineIsPackageWarning() {
|
||||||
return !!this.currentLine.match(PACKAGE_WARNING_REGEX)
|
return !!this.currentLine.match(this.packageWarningRegex)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentLineIsHboxWarning() {
|
currentLineIsHboxWarning() {
|
||||||
|
@ -161,7 +175,7 @@ export default class LatexParser {
|
||||||
|
|
||||||
parseMultipleWarningLine() {
|
parseMultipleWarningLine() {
|
||||||
// Some package warnings are multiple lines, let's parse the first line
|
// Some package warnings are multiple lines, let's parse the first line
|
||||||
let warningMatch = this.currentLine.match(PACKAGE_WARNING_REGEX)
|
let warningMatch = this.currentLine.match(this.packageWarningRegex)
|
||||||
// Something strange happened, return early
|
// Something strange happened, return early
|
||||||
if (!warningMatch) {
|
if (!warningMatch) {
|
||||||
return
|
return
|
||||||
|
@ -169,7 +183,7 @@ export default class LatexParser {
|
||||||
const warningLines = [warningMatch[1]]
|
const warningLines = [warningMatch[1]]
|
||||||
let lineMatch = this.currentLine.match(LINES_REGEX)
|
let lineMatch = this.currentLine.match(LINES_REGEX)
|
||||||
let line = lineMatch ? parseInt(lineMatch[1], 10) : null
|
let line = lineMatch ? parseInt(lineMatch[1], 10) : null
|
||||||
const packageMatch = this.currentLine.match(PACKAGE_REGEX)
|
const packageMatch = this.currentLine.match(this.packageRegex)
|
||||||
const packageName = packageMatch[1]
|
const packageName = packageMatch[1]
|
||||||
// Regex to get rid of the unnecesary (packagename) prefix in most multi-line warnings
|
// Regex to get rid of the unnecesary (packagename) prefix in most multi-line warnings
|
||||||
const prefixRegex = new RegExp(
|
const prefixRegex = new RegExp(
|
||||||
|
|
Loading…
Reference in a new issue