Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
|
viettrungluu
2015/10/05 23:16:59
The current copyright does not have the "(c)".
rudominer
2015/10/06 00:29:10
Done.
| |
| 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)) | |
| 23 | |
| 24 saved_cwd = os.getcwd() | |
|
viettrungluu
2015/10/05 23:16:59
Why do you bother doing this?
rudominer
2015/10/06 00:29:10
Good point. Removed.
| |
| 25 # TODO(rudominer) Uncomment the line below when we are able to make use of | |
| 26 # the src_root variable. | |
| 27 # src_root = Paths().src_root | |
| 28 | |
| 29 test_dir_list = [ | |
| 30 # TODO(rudominer) Add paths to go directories with tests. | |
|
viettrungluu
2015/10/05 23:16:59
It seems like a bad idea to hard-code stuff in a s
rudominer
2015/10/06 00:29:10
OK. What do you think about the following strategy
viettrungluu
2015/10/06 01:46:30
SGTM
| |
| 31 # NOTE(rudominer) The paths should all be made absolute by including | |
| 32 # src_root as the first path component. | |
| 33 #os.path.join(src_root, 'mojom', 'mojom_parser', 'lexer'), | |
| 34 ] | |
| 35 | |
| 36 for test_dir in test_dir_list: | |
| 37 os.chdir(test_dir) | |
| 38 print "Running Go tests in %s..." % test_dir | |
| 39 call_result = subprocess.call([go_tool, "test"], env=env) | |
| 40 if call_result: | |
| 41 os.chdir(saved_cwd ) | |
| 42 return call_result | |
| 43 | |
| 44 os.chdir(saved_cwd) | |
| 45 | |
| 46 if __name__ == '__main__': | |
| 47 sys.exit(main()) | |
| OLD | NEW |