Disable the crash collection script if the system python is too old to run it. Also, warn the user if there is no GDB installed on the system, which will make crash collection less useful than it should.
Signed-off-by: John Admanski <[email protected]> Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/bin/test.py | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/bin/test.py b/client/bin/test.py index cb7040f..54783fb 100644 --- a/client/bin/test.py +++ b/client/bin/test.py @@ -45,6 +45,20 @@ class test(common_test.base_test): parent of the current test execution. If we can't determine it, the core file and the report file will be copied to all test debug dirs. """ + self.crash_handling_enabled = False + + # make sure this script will run with a new enough python to work + cmd = ("python -c 'import sys; " + "print sys.version_info[0], sys.version_info[1]'") + result = utils.run(cmd, ignore_status=True) + if result.exit_status != 0: + logging.warning('System python is too old, crash handling disabled') + return + major, minor = [int(x) for x in result.stdout.strip().split()] + if (major, minor) < (2, 4): + logging.warning('System python is too old, crash handling disabled') + return + self.pattern_file = '/proc/sys/kernel/core_pattern' try: # Enable core dumps @@ -60,11 +74,15 @@ class test(common_test.base_test): os.getpid()) utils.open_write_close(self.debugdir_tmp_file, self.debugdir + "\n") except Exception, e: - self.crash_handling_enabled = False - logging.error('Crash handling system disabled: %s' % e) + logging.warning('Crash handling disabled: %s' % e) else: self.crash_handling_enabled = True - logging.debug('Crash handling system enabled') + try: + os_dep.command('gdb') + except ValueError: + logging.warning('GDB is missing on this system. Crash handling ' + 'will operate with limited functionality' + logging.debug('Crash handling enabled') def crash_handler_report(self): -- 1.7.0.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
