diff options
author | sky <sky@chromium.org> | 2015-08-10 14:37:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-10 21:37:37 +0000 |
commit | 6ffac75a0ae783badb17b13ab7e99e9b09bcedfd (patch) | |
tree | 891e7bc06cacc5b740b1612204dab987bd89ed3c /mojo/tools | |
parent | ebab689942bb5ace2cdefa7ddebeb14cd42991e4 (diff) | |
download | chromium_src-6ffac75a0ae783badb17b13ab7e99e9b09bcedfd.zip chromium_src-6ffac75a0ae783badb17b13ab7e99e9b09bcedfd.tar.gz chromium_src-6ffac75a0ae783badb17b13ab7e99e9b09bcedfd.tar.bz2 |
Makes mopy turn off gtest coloring
Without this gtest could turn on coloring, which confuses the code
that searches the output. The specific error I was getting was re was
being passed a regular expression that contained escape sequences,
which triggered an exception in re saying the string wasn't balanced.
BUG=none
TEST=none
R=msw@chromium.org
Review URL: https://codereview.chromium.org/1279833003
Cr-Commit-Position: refs/heads/master@{#342701}
Diffstat (limited to 'mojo/tools')
-rwxr-xr-x | mojo/tools/apptest_runner.py | 1 | ||||
-rw-r--r-- | mojo/tools/mopy/gtest.py | 10 |
2 files changed, 3 insertions, 8 deletions
diff --git a/mojo/tools/apptest_runner.py b/mojo/tools/apptest_runner.py index 5ceb6fa..f917b229 100755 --- a/mojo/tools/apptest_runner.py +++ b/mojo/tools/apptest_runner.py @@ -33,7 +33,6 @@ def main(): default=APPTESTS, help='The file listing tests to run.') args = parser.parse_args() - gtest.set_color() logger = logging.getLogger() logging.basicConfig(stream=sys.stdout, format='%(levelname)s:%(message)s') logger.setLevel(logging.DEBUG if args.verbose else logging.WARNING) diff --git a/mojo/tools/mopy/gtest.py b/mojo/tools/mopy/gtest.py index 996d232..b53c9e6 100644 --- a/mojo/tools/mopy/gtest.py +++ b/mojo/tools/mopy/gtest.py @@ -23,13 +23,6 @@ import xvfb XVFB_DISPLAY_ID = 9 -def set_color(): - '''Run gtests with color on TTY, unless its environment variable is set.''' - if sys.stdout.isatty() and 'GTEST_COLOR' not in os.environ: - logging.getLogger().debug('Setting GTEST_COLOR=yes') - os.environ['GTEST_COLOR'] = 'yes' - - def run_apptest(config, shell, args, apptest, isolate): '''Run the apptest; optionally isolating fixtures across shell invocations. @@ -155,6 +148,9 @@ def _build_command_line(config, args, apptest): def _run_test_with_xvfb(config, shell, args, apptest): '''Run the test with xvfb; return the output or raise an exception.''' env = os.environ.copy() + # Make sure gtest doesn't try to add color to the output. Color is done via + # escape sequences which confuses the code that searches the gtest output. + env['GTEST_COLOR'] = 'no' if (config.target_os != Config.OS_LINUX or '--gtest_list_tests' in args or not xvfb.should_start_xvfb(env)): return _run_test_with_timeout(config, shell, args, apptest, env) |