mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
testutil/dott: normalize error messages
Summary: run-tests.py uses common-pattern.py to normalize error messages to things like `$ENOENT$`. Implement that behavior. Reviewed By: xavierd Differential Revision: D16209208 fbshipit-source-id: 3e609cc16442f80b844264f93dce9ea46517458d
This commit is contained in:
parent
27908b883c
commit
08c15a105a
@ -157,3 +157,28 @@ _normalizefuncs = []
|
||||
|
||||
# Decorator. Add an output normalizing function.
|
||||
normalizeoutput = _normalizefuncs.append
|
||||
|
||||
|
||||
_errors = {
|
||||
br"$ENOENT$": (
|
||||
# strerror()
|
||||
br"No such file or directory",
|
||||
# FormatMessage(ERROR_FILE_NOT_FOUND)
|
||||
br"The system cannot find the file specified",
|
||||
),
|
||||
br"$ENOTDIR$": (
|
||||
# strerror()
|
||||
br"Not a directory",
|
||||
# FormatMessage(ERROR_PATH_NOT_FOUND)
|
||||
br"The system cannot find the path specified",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@normalizeoutput
|
||||
def _normalizeerr(out, _errors=_errors):
|
||||
"""Translate error messages to '$ENOENT$'"""
|
||||
for name, values in _errors.items():
|
||||
for value in values:
|
||||
out = out.replace(value, name)
|
||||
return out
|
||||
|
Loading…
Reference in New Issue
Block a user