OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # valgrind_test.py | 6 # valgrind_test.py |
7 | 7 |
8 """Runs an exe through Valgrind and puts the intermediate files in a | 8 """Runs an exe through Valgrind and puts the intermediate files in a |
9 directory. | 9 directory. |
10 """ | 10 """ |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 Returns the path to the wrapper. It's up to the caller to use the wrapper | 389 Returns the path to the wrapper. It's up to the caller to use the wrapper |
390 appropriately. | 390 appropriately. |
391 """ | 391 """ |
392 command = " ".join(proc) | 392 command = " ".join(proc) |
393 command = command.replace("%p", "$$.%p") | 393 command = command.replace("%p", "$$.%p") |
394 | 394 |
395 (fd, indirect_fname) = tempfile.mkstemp(dir=self.log_dir, | 395 (fd, indirect_fname) = tempfile.mkstemp(dir=self.log_dir, |
396 prefix="browser_wrapper.", | 396 prefix="browser_wrapper.", |
397 text=True) | 397 text=True) |
398 f = os.fdopen(fd, "w") | 398 f = os.fdopen(fd, "w") |
399 f.write("#!/bin/sh\n") | 399 f.write("#!/bin/bash\n") |
400 f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n\n') | 400 f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n\n') |
401 f.write('for arg in $@\ndo\n') | 401 f.write('for arg in $@\ndo\n') |
402 f.write(' if [[ "$arg" =~ --test-name=(.*) ]]\n then\n') | 402 f.write(' if [[ "$arg" =~ --test-name=(.*) ]]\n then\n') |
403 f.write(' TESTCASE=${BASH_REMATCH[1]}\n') | 403 f.write(' TESTCASE=${BASH_REMATCH[1]}\n') |
404 f.write(' echo $TESTCASE >`dirname $0`/testcase.$$.name\n') | 404 f.write(' echo $TESTCASE >`dirname $0`/testcase.$$.name\n') |
405 f.write(' fi\ndone\n') | 405 f.write(' fi\ndone\n') |
406 # Add the PID of the browser wrapper to the logfile names so we can | 406 # Add the PID of the browser wrapper to the logfile names so we can |
407 # separate log files for different UI tests at the analyze stage. | 407 # separate log files for different UI tests at the analyze stage. |
408 f.write(command) | 408 f.write(command) |
409 f.write(' "$@"\n') | 409 f.write(' "$@"\n') |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 platform_name = sys.platform + "(Unknown)" | 1116 platform_name = sys.platform + "(Unknown)" |
1117 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1117 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
1118 platform_name) | 1118 platform_name) |
1119 | 1119 |
1120 def CreateTool(tool): | 1120 def CreateTool(tool): |
1121 return ToolFactory().Create(tool) | 1121 return ToolFactory().Create(tool) |
1122 | 1122 |
1123 if __name__ == '__main__': | 1123 if __name__ == '__main__': |
1124 logging.error(sys.argv[0] + " can not be run from command line") | 1124 logging.error(sys.argv[0] + " can not be run from command line") |
1125 sys.exit(1) | 1125 sys.exit(1) |
OLD | NEW |