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

Side by Side Diff: mojo/tools/mopy/gtest.py

Issue 1231493002: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import Queue 7 import Queue
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if hasattr(exception, 'output'): 126 if hasattr(exception, 'output'):
127 print exception.output 127 print exception.output
128 print str(exception) 128 print str(exception)
129 print 72 * "-" 129 print 72 * "-"
130 130
131 131
132 def _build_command_line(config, args, apptest): 132 def _build_command_line(config, args, apptest):
133 """Build the apptest command line. This value isn't executed on Android.""" 133 """Build the apptest command line. This value isn't executed on Android."""
134 paths = Paths(config) 134 paths = Paths(config)
135 # On Linux, always run tests with xvfb, but not for --gtest_list_tests. 135 # On Linux, always run tests with xvfb, but not for --gtest_list_tests.
136 use_xvfb = (config.target_os == Config.OS_LINUX and 136 not_list_tests = not "--gtest_list_tests" in args
137 not "--gtest_list_tests" in args) 137 use_xvfb = config.target_os == Config.OS_LINUX and not_list_tests
138 prefix = [paths.xvfb, paths.build_dir] if use_xvfb else [] 138 xvfb_prefix = [paths.xvfb, paths.build_dir] if use_xvfb else []
139 return prefix + [paths.mojo_runner] + args + [apptest] 139 data_dir = ["--use-temporary-user-data-dir"] if not_list_tests else []
140 return xvfb_prefix + [paths.mojo_runner] + data_dir + args + [apptest]
140 141
141 142
142 # TODO(msw): Determine proper test timeout durations (starting small). 143 # TODO(msw): Determine proper test timeout durations (starting small).
143 def _run_test_with_timeout(config, shell, args, apptest, timeout_in_seconds=10): 144 def _run_test_with_timeout(config, shell, args, apptest, timeout_in_seconds=10):
144 """Run the test with a timeout; return the output or raise an exception.""" 145 """Run the test with a timeout; return the output or raise an exception."""
145 result = Queue.Queue() 146 result = Queue.Queue()
146 thread = threading.Thread(target=_run_test, 147 thread = threading.Thread(target=_run_test,
147 args=(config, shell, args, apptest, result)) 148 args=(config, shell, args, apptest, result))
148 thread.start() 149 thread.start()
149 process_or_shell = result.get() 150 process_or_shell = result.get()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 (r, w) = os.pipe() 187 (r, w) = os.pipe()
187 with os.fdopen(r, "r") as rf: 188 with os.fdopen(r, "r") as rf:
188 with os.fdopen(w, "w") as wf: 189 with os.fdopen(w, "w") as wf:
189 arguments = args + [apptest] 190 arguments = args + [apptest]
190 shell.StartActivity('MojoShellActivity', arguments, wf, wf.close) 191 shell.StartActivity('MojoShellActivity', arguments, wf, wf.close)
191 output = rf.read() 192 output = rf.read()
192 except Exception as e: 193 except Exception as e:
193 output = e.output if hasattr(e, 'output') else "" 194 output = e.output if hasattr(e, 'output') else ""
194 exception = str(e) 195 exception = str(e)
195 result.put((output, exception)) 196 result.put((output, exception))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698