OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import argparse | |
7 import os | |
8 import subprocess | |
9 import sys | |
10 | |
11 from mopy.paths import Paths | |
12 | |
13 | |
14 def main(): | |
15 parser = argparse.ArgumentParser(description="Runs pure Go tests in the " | |
16 "Mojo source tree from a hard-coded list of directories.") | |
17 parser.add_argument('go_tool_path', metavar='go-tool-path', | |
18 help="the path to the 'go' binary") | |
19 args = parser.parse_args() | |
20 go_tool = args.go_tool_path | |
21 env = os.environ.copy() | |
22 env['GOROOT'] = os.path.dirname(os.path.dirname(go_tool)) | |
viettrungluu
2015/10/06 01:46:30
Maybe it should take the Go root as an argument in
viettrungluu
2015/10/06 21:08:06
You didn't say anything about this.
rudominer
2015/10/09 18:30:30
I'm sorry I missed this comment. I took your secon
| |
23 | |
24 # TODO(rudominer) Uncomment the line below when we are able to make use of | |
25 # the src_root variable. | |
26 # src_root = Paths().src_root | |
27 | |
28 test_dir_list = [ | |
29 # TODO(rudominer) Add paths to go directories with tests. | |
30 # NOTE(rudominer) The paths should all be made absolute by including | |
ppi
2015/10/06 17:57:47
This will be better enforced by assert on os.path.
rudominer
2015/10/06 20:28:54
This is now organized differently.
| |
31 # src_root as the first path component. | |
32 # os.path.join(src_root, 'mojom', 'mojom_parser', 'lexer'), | |
33 ] | |
34 | |
35 for test_dir in test_dir_list: | |
36 os.chdir(test_dir) | |
37 print "Running Go tests in %s..." % test_dir | |
38 call_result = subprocess.call([go_tool, "test"], env=env) | |
39 if call_result: | |
40 os.chdir(saved_cwd ) | |
ppi
2015/10/06 17:57:46
Need to drop this line too.
rudominer
2015/10/06 20:28:54
Thanks. Done.
| |
41 return call_result | |
42 | |
43 if __name__ == '__main__': | |
44 sys.exit(main()) | |
OLD | NEW |