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

Side by Side Diff: tools/testrunner/local/commands.py

Issue 1177903005: [test] More debugging output in test runner. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
11 # with the distribution. 11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its 12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived 13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission. 14 # from this software without specific prior written permission.
15 # 15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 import os
30 import subprocess 29 import subprocess
30 import sys
31 from threading import Timer 31 from threading import Timer
32 32
33 from ..local import utils 33 from ..local import utils
34 from ..objects import output 34 from ..objects import output
35 35
36 36
37 SEM_INVALID_VALUE = -1 37 SEM_INVALID_VALUE = -1
38 SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h 38 SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h
39 39
40 40
(...skipping 25 matching lines...) Expand all
66 stdout=subprocess.PIPE, 66 stdout=subprocess.PIPE,
67 stderr=subprocess.PIPE, 67 stderr=subprocess.PIPE,
68 **rest 68 **rest
69 ) 69 )
70 if (utils.IsWindows() and prev_error_mode != SEM_INVALID_VALUE): 70 if (utils.IsWindows() and prev_error_mode != SEM_INVALID_VALUE):
71 Win32SetErrorMode(prev_error_mode) 71 Win32SetErrorMode(prev_error_mode)
72 72
73 def kill_process(process, timeout_result): 73 def kill_process(process, timeout_result):
74 timeout_result[0] = True 74 timeout_result[0] = True
75 try: 75 try:
76 process.kill() 76 if utils.IsWindows():
77 if verbose:
78 print "Attempting to kill process %d" % process.pid
79 sys.stdout.flush()
80 tk = subprocess.Popen(
81 'taskkill /T /F /PID %d' % process.pid,
82 stdout=subprocess.PIPE,
83 stderr=subprocess.PIPE,
84 )
85 stdout, stderr = tk.communicate()
86 if verbose:
87 print "Taskkill results for %d" % process.pid
88 print stdout
89 print stderr
90 print "Return code: %d" % tk.returncode
91 sys.stdout.flush()
92 else:
93 process.kill()
77 except OSError: 94 except OSError:
78 sys.stderr.write('Error: Process %s already ended.\n' % process.pid) 95 sys.stderr.write('Error: Process %s already ended.\n' % process.pid)
79 96
80 # Pseudo object to communicate with timer thread. 97 # Pseudo object to communicate with timer thread.
81 timeout_result = [False] 98 timeout_result = [False]
82 99
83 timer = Timer(timeout, kill_process, [process, timeout_result]) 100 timer = Timer(timeout, kill_process, [process, timeout_result])
84 timer.start() 101 timer.start()
85 stdout, stderr = process.communicate() 102 stdout, stderr = process.communicate()
86 timer.cancel() 103 timer.cancel()
87 return process.returncode, timeout_result[0], stdout, stderr 104 return process.returncode, timeout_result[0], stdout, stderr
88 105
89 106
90 def Execute(args, verbose=False, timeout=None): 107 def Execute(args, verbose=False, timeout=None):
91 args = [ c for c in args if c != "" ] 108 args = [ c for c in args if c != "" ]
92 exit_code, timed_out, stdout, stderr = RunProcess( 109 exit_code, timed_out, stdout, stderr = RunProcess(
93 verbose, 110 verbose,
94 timeout, 111 timeout,
95 args=args, 112 args=args,
96 ) 113 )
97 return output.Output(exit_code, timed_out, stdout, stderr) 114 return output.Output(exit_code, timed_out, stdout, stderr)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698