1 import sys
, glob
, os
, subprocess
, logging
8 log
= logging
.getLogger()
10 def addCommonOptions(parser
, defaults
={}):
11 parser
.add_option("--xre-path",
12 action
= "store", type = "string", dest
= "xrePath",
13 # individual scripts will set a sane default
15 help = "absolute path to directory containing XRE (probably xulrunner)")
16 if 'SYMBOLS_PATH' not in defaults
:
17 defaults
['SYMBOLS_PATH'] = None
18 parser
.add_option("--symbols-path",
19 action
= "store", type = "string", dest
= "symbolsPath",
20 default
= defaults
['SYMBOLS_PATH'],
21 help = "absolute path to directory containing breakpad symbols")
23 def checkForCrashes(dumpDir
, symbolsPath
, testName
=None):
24 stackwalkPath
= os
.environ
.get('MINIDUMP_STACKWALK', None)
25 # try to get the caller's filename if no test name is given
28 testName
= os
.path
.basename(sys
._getframe
(1).f_code
.co_filename
)
33 dumps
= glob
.glob(os
.path
.join(dumpDir
, '*.dmp'))
35 log
.info("TEST-UNEXPECTED-FAIL | %s | application crashed (minidump found)", testName
)
36 if symbolsPath
and stackwalkPath
:
37 nullfd
= open(os
.devnull
, 'w')
38 # eat minidump_stackwalk errors
39 subprocess
.call([stackwalkPath
, d
, symbolsPath
], stderr
=nullfd
)
42 extra
= os
.path
.splitext(d
)[0] + ".extra"
43 if os
.path
.exists(extra
):