diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 23:12:59 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 23:12:59 +0000 |
commit | 4a3ce97a93e8b43082c4ae243ac8127c92890b28 (patch) | |
tree | 1bc7f4c275950155b1a0add3f0636a419fac0307 /tools/diagnose-me.py | |
parent | 565b7f06a1db3c89f1056e3867f9e184b11d6ada (diff) | |
download | chromium_src-4a3ce97a93e8b43082c4ae243ac8127c92890b28.zip chromium_src-4a3ce97a93e8b43082c4ae243ac8127c92890b28.tar.gz chromium_src-4a3ce97a93e8b43082c4ae243ac8127c92890b28.tar.bz2 |
Check in a script to diagnose common system configuration problems.
Review URL: https://chromiumcodereview.appspot.com/9309011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/diagnose-me.py')
-rwxr-xr-x | tools/diagnose-me.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/diagnose-me.py b/tools/diagnose-me.py new file mode 100755 index 0000000..75bcfae --- /dev/null +++ b/tools/diagnose-me.py @@ -0,0 +1,59 @@ +#!/usr/bin/python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Diagnose some common system configuration problems on Linux, and +suggest fixes.""" + +import subprocess +import sys + +all_checks = [] + +def Check(name): + """Decorator that defines a diagnostic check.""" + def wrap(func): + all_checks.append((name, func)) + return func + return wrap + + +@Check("/usr/bin/ld is not gold") +def CheckSystemLd(): + proc = subprocess.Popen(['/usr/bin/ld', '-v'], stdout=subprocess.PIPE) + stdout = proc.communicate()[0] + if 'GNU gold' in stdout: + return ("When /usr/bin/ld is gold, system updates can silently\n" + "corrupt your graphics drivers.\n" + "Try 'sudo apt-get remove binutils-gold'.\n") + return None + + +@Check("random lds are not in the $PATH") +def CheckPathLd(): + proc = subprocess.Popen(['which', '-a', 'ld'], stdout=subprocess.PIPE) + stdout = proc.communicate()[0] + instances = stdout.split() + if len(instances) > 1: + return ("You have multiple 'ld' binaries in your $PATH:\n" + + '\n'.join(' - ' + i for i in instances) + "\n" + "You should delete all of them but your system one.\n" + "gold is hooked into your build via gyp.\n") + return None + + +def RunChecks(): + for name, check in all_checks: + sys.stdout.write("* Checking %s: " % name) + sys.stdout.flush() + error = check() + if not error: + print "ok" + else: + print "FAIL" + print error + + +if __name__ == '__main__': + RunChecks() |