Skip to content

Instantly share code, notes, and snippets.

@gregarndt
Created August 25, 2015 14:56
Show Gist options
  • Select an option

  • Save gregarndt/97caa54a006ae76e235b to your computer and use it in GitHub Desktop.

Select an option

Save gregarndt/97caa54a006ae76e235b to your computer and use it in GitHub Desktop.
test treeherder taskcluster error parsing
import re
RE_ERR_MATCH = re.compile((
r"^error: TEST FAILED"
r"|^g?make(?:\[\d+\])?: \*\*\*"
r"|^Remote Device Error:"
r"|^[A-Za-z.]+Error: "
r"|^[A-Za-z.]*Exception: "
r"|^remoteFailed:"
r"|^rm: cannot "
r"|^abort:"
r"|^Output exceeded \d+ bytes"
r"|^The web-page 'stop build' button was pressed"
r"|.*\.js: line \d+, col \d+, Error -"
r"|^\[taskcluster\] Error:"
r"|^\[[\w-]+:(?:error|exception)+\]"
))
assert bool(RE_ERR_MATCH.match("[taskcluster-vcs:error] Error something"))
assert bool(RE_ERR_MATCH.match("[taskcluster:error] Error something"))
assert bool(RE_ERR_MATCH.match("[taskcluster:exception] Some kind of exception"))
# old style error
assert bool(RE_ERR_MATCH.match("[taskcluster] Error: something"))
# Shouldn't catch anything
assert bool(RE_ERR_MATCH.match("[taskcluster] something")) == False
assert bool(RE_ERR_MATCH.match("[taskcluster:info] something")) == False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment