def CollectDebugData(self, log_level): """Collects various information that may be useful for debugging. Specifically: 1. Captures a screenshot. 2. Collects stdout and system logs. 3. Attempts to symbolize all currently unsymbolized minidumps. All collected information is stored as artifacts, and everything but the screenshot is also included in the return value. Platforms may override this to provide other debug information in addition to the above set of information. Args: log_level: The logging level to use from the logging module, e.g. logging.ERROR. Returns: A debug_data.DebugData object containing the collected data. """ suffix = artifact_logger.GetTimestampSuffix() data = debug_data.DebugData() self._CollectScreenshot(log_level, suffix + '.png') self._CollectSystemLog(log_level, suffix + '.txt', data) self._CollectStdout(log_level, suffix + '.txt', data) self._SymbolizeAndLogMinidumps(log_level, data) return data
def CollectDebugData(self, log_level): """Collect debug data and return it. Children should override this to actually collect useful debug data. Args: log_level: The logging level to use from the logging module, e.g. logging.ERROR. Returns: A debug_data.DebugData object containing the collected data. """ del log_level # unused logging.warning( 'Crashed app of type %s does not implement the CollectDebugData ' 'method, unable to provide actual debug information', self.app_type) return debug_data.DebugData()
def CleanupUnsymbolizedMinidumps(self, fatal=False): """Cleans up any unsymbolized minidumps so they aren't found later. Args: fatal: Whether the presence of unsymbolized minidumps should be considered a fatal error or not. Typically, before a test should be non-fatal, while after a test should be fatal. """ log_level = logging.ERROR if fatal else logging.WARNING unsymbolized_paths = self.GetAllUnsymbolizedMinidumpPaths(log=False) if not unsymbolized_paths: return culprit_test = 'current test' if fatal else 'a previous test' logging.log(log_level, 'Found %d unsymbolized minidumps leftover from %s. Outputting ' 'below: ', len(unsymbolized_paths), culprit_test) self._SymbolizeAndLogMinidumps(log_level, debug_data.DebugData()) if fatal: raise RuntimeError( 'Test left unsymbolized minidumps around after finishing.')
def CollectDebugData(self, log_level): del log_level return debug_data.DebugData()