Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Unified Diff: tools/utils.py

Issue 2713193002: Add more debugging support to coredump archiving code (Closed)
Patch Set: fix long line, fix win part Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/utils.py
diff --git a/tools/utils.py b/tools/utils.py
index b89d227d7d59a53df4f5931e3f5a84613fe37d4e..f489f0db858ba59fd5cab3a670c3d0cf3b5ab010 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -700,7 +700,7 @@ class UnexpectedCrash(object):
self.binary = binary
def __str__(self):
- return "%s: %s %s" % (self.test, self.binary, self.pid)
+ return "Crash(%s: %s %s)" % (self.test, self.binary, self.pid)
class SiteConfigBotoFileDisabler(object):
def __init__(self):
@@ -831,9 +831,10 @@ class BaseCoreDumpArchiver(object):
# test.dart will write a line for each unexpected crash into this file.
_UNEXPECTED_CRASHES_FILE = "unexpected-crashes"
- def __init__(self):
+ def __init__(self, search_dir):
self._bucket = 'dart-temp-crash-archive'
self._binaries_dir = os.getcwd()
+ self._search_dir = search_dir
def __enter__(self):
# Cleanup any stale files
@@ -871,9 +872,20 @@ class BaseCoreDumpArchiver(object):
else:
missing.append(crash)
self._upload(files)
+
if missing:
- raise Exception('Missing crash dumps for: %s' % ', '.join(
- [str(c) for c in missing]))
+ self._report_missing_crashes(missing, throw=True)
+
+ def _report_missing_crashes(self, missing, throw=True):
+ missing_as_string = ', '.join([str(c) for c in missing])
+ other_files = list(glob.glob(os.path.join(self._search_dir, '*')))
+ print >> sys.stderr, (
+ "Could not find crash dumps for '%s' in search directory '%s'.\n"
+ "Existing files which *did not* match the pattern inside the search "
+ "directory are are:\n %s"
+ % (missing_as_string, self._search_dir, '\n '.join(other_files)))
+ if throw:
+ raise Exception('Missing crash dumps for: %s' % missing_as_string)
def _upload(self, files):
bot_utils = GetBotUtils()
@@ -934,8 +946,7 @@ class BaseCoreDumpArchiver(object):
class LinuxCoreDumpArchiver(BaseCoreDumpArchiver):
def __init__(self):
- super(self.__class__, self).__init__()
- self._search_dir = os.getcwd()
+ super(self.__class__, self).__init__(os.getcwd())
def _cleanup(self):
found = super(self.__class__, self)._cleanup()
@@ -951,9 +962,8 @@ class LinuxCoreDumpArchiver(BaseCoreDumpArchiver):
class WindowsCoreDumpArchiver(BaseCoreDumpArchiver):
def __init__(self):
- super(self.__class__, self).__init__()
- self._search_dir = os.path.join(
- os.getcwd(), WindowsCoredumpEnabler.WINDOWS_COREDUMP_FOLDER)
+ super(self.__class__, self).__init__(os.path.join(
+ os.getcwd(), WindowsCoredumpEnabler.WINDOWS_COREDUMP_FOLDER))
def _cleanup(self):
found = super(self.__class__, self)._cleanup()
@@ -967,6 +977,34 @@ class WindowsCoreDumpArchiver(BaseCoreDumpArchiver):
for core_filename in glob.glob(pattern):
return core_filename
+ def _report_missing_crashes(self, missing, throw=True):
+ # Let's only print the debugging information and not throw. We'll do more
+ # validation for werfault.exe and throw afterwards.
+ super(self.__class__, self)._report_missing_crashes(missing, throw=False)
+
+ # Let's check again for the image execution options for werfault. Maybe
+ # puppet came a long during testing and reverted our change.
+ try:
+ import winreg
+ except ImportError:
+ import _winreg as winreg
+ for wowbit in [winreg.KEY_WOW64_64KEY, winreg.KEY_WOW64_32KEY]:
+ try:
+ with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
+ WindowsCoredumpEnabler.IMGEXEC_NAME,
+ 0,
+ winreg.KEY_READ | wowbit) as handle:
+ raise Exception(
+ "Found werfault.exe was disabled. Probably by puppet. Too bad")
+ except OSError:
+ # If the open did not work the werfault.exe execution setting is as it
+ # should be.
+ pass
+
+ if throw:
+ missing_as_string = ', '.join([str(c) for c in missing])
+ raise Exception('Missing crash dumps for: %s' % missing_as_string)
+
@contextlib.contextmanager
def NooptCoreDumpArchiver():
yield
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698