OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # debugger_unittests.py | 2 # debugger_unittests.py |
3 # | 3 # |
4 # Run chrome debugger front-end tests. | 4 # Run chrome debugger front-end tests. |
5 # see also chrome/test/debugger/test_protocol.js | 5 # see also chrome/test/debugger/test_protocol.js |
6 | 6 |
7 import optparse | 7 import optparse |
8 import os.path | 8 import os.path |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
11 import time | 11 import time |
12 | 12 |
13 import google.path_utils | 13 import google.path_utils |
14 import google.process_utils | 14 import google.process_utils |
15 | 15 |
16 def RunTests(build_dir=None): | 16 def RunTests(build_dir=None): |
17 '''This is just a simple wrapper for running the test through v8_shell_sample. | 17 '''This is just a simple wrapper for running the test through v8_shell_sample. |
18 Since v8_shell_sample always returns 0 whether the test passes or fails, | 18 Since v8_shell_sample always returns 0 whether the test passes or fails, |
19 buildbot looks at stdout to test for failure. | 19 buildbot looks at stdout to test for failure. |
20 ''' | 20 ''' |
21 script_dir = google.path_utils.ScriptDir() | 21 script_dir = google.path_utils.ScriptDir() |
22 chrome_dir = google.path_utils.FindUpward(script_dir, "chrome") | 22 chrome_dir = google.path_utils.FindUpward(script_dir, "chrome") |
23 v8_dir = google.path_utils.FindUpward(script_dir, "v8") | 23 v8_dir = google.path_utils.FindUpward(script_dir, "v8") |
24 if build_dir: | 24 if build_dir: |
25 v8_shell_sample = os.path.join(build_dir, "v8_shell_sample.exe") | 25 v8_shell_sample = os.path.join(build_dir, "v8_shell_sample.exe") |
26 else: | 26 else: |
27 v8_shell_sample = os.path.join(chrome_dir, "Debug", "v8_shell_sample.exe") | 27 v8_shell_sample = os.path.join(chrome_dir, "Debug", "v8_shell_sample.exe") |
28 # look for Debug version first | 28 # look for Debug version first |
29 if not os.path.isfile(v8_shell_sample): | 29 if not os.path.isfile(v8_shell_sample): |
30 v8_shell_sample = os.path.join(chrome_dir, "Release", "v8_shell_sample.exe
") | 30 v8_shell_sample = os.path.join(chrome_dir, "Release", |
| 31 "v8_shell_sample.exe") |
31 cmd = [v8_shell_sample, | 32 cmd = [v8_shell_sample, |
32 "--allow-natives-syntax", | 33 "--allow-natives-syntax", |
33 "--expose-debug-as", "debugContext", | 34 "--expose-debug-as", "debugContext", |
34 os.path.join(chrome_dir, "browser", "debugger", "resources", "debugger_
shell.js"), | 35 os.path.join(chrome_dir, "browser", "debugger", "resources", |
| 36 "debugger_shell.js"), |
35 # TODO Change the location of mjsunit.js from the copy in this | 37 # TODO Change the location of mjsunit.js from the copy in this |
36 # directory to the copy in V8 when switching to use V8 from | 38 # directory to the copy in V8 when switching to use V8 from |
37 # code.google.com. | 39 # code.google.com. |
38 # os.path.join(v8_dir, "test", "mjsunit", "mjsunit.js"), | 40 # os.path.join(v8_dir, "test", "mjsunit", "mjsunit.js"), |
39 os.path.join(chrome_dir, "test", "debugger", "mjsunit.js"), | 41 os.path.join(chrome_dir, "test", "debugger", "mjsunit.js"), |
40 os.path.join(chrome_dir, "test", "debugger", "test_protocol.js") | 42 os.path.join(chrome_dir, "test", "debugger", "test_protocol.js") |
41 ] | 43 ] |
42 (retcode, output) = google.process_utils.RunCommandFull(cmd, | 44 (retcode, output) = google.process_utils.RunCommandFull(cmd, |
43 collect_output=True) | 45 collect_output=True) |
44 if "Success" in output: | 46 if "Success" in output: |
45 return 0 | 47 return 0 |
46 else: | 48 else: |
47 return 1 | 49 return 1 |
48 | 50 |
49 if __name__ == "__main__": | 51 if __name__ == "__main__": |
50 parser = optparse.OptionParser("usage: %prog [--build_dir=dir]") | 52 parser = optparse.OptionParser("usage: %prog [--build_dir=dir]") |
51 parser.add_option("", "--build_dir", | 53 parser.add_option("", "--build_dir", |
52 help="directory where v8_shell_sample.exe was built") | 54 help="directory where v8_shell_sample.exe was built") |
53 (options, args) = parser.parse_args() | 55 (options, args) = parser.parse_args() |
54 ret = RunTests(options.build_dir) | 56 ret = RunTests(options.build_dir) |
55 sys.exit(ret) | 57 sys.exit(ret) |
OLD | NEW |