Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 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 | |
|
ppi
2015/10/05 21:49:58
I think the style guide wants two empty lines here
rudominer
2015/10/05 23:08:13
Done. But now the two empty lines are lines 12 and
| |
| 11 def main(): | |
| 12 parser = argparse.ArgumentParser() | |
|
ppi
2015/10/05 21:49:58
Please add a desription string, ie. argparse.Argum
rudominer
2015/10/05 23:08:13
Done.
| |
| 13 parser.add_argument('--go_tool') | |
|
ppi
2015/10/05 21:49:58
I think we prefer "dash-only" arguments: --go-tool
ppi
2015/10/05 21:49:58
If that is a required argument I'd make it positio
rudominer
2015/10/05 23:08:12
Done.
rudominer
2015/10/05 23:08:13
Done.
rudominer
2015/10/05 23:08:13
Done.
| |
| 14 args = parser.parse_args() | |
| 15 go_tool = args.go_tool | |
| 16 assert go_tool is not None | |
| 17 env = os.environ.copy() | |
| 18 env['GOROOT'] = os.path.dirname(os.path.dirname(go_tool)) | |
| 19 | |
| 20 saved_cwd = os.getcwd() | |
| 21 | |
| 22 test_dir_list = [ | |
| 23 # TODO(rudominer) Add paths to go directories with tests. | |
| 24 #os.path.join('mojom', 'mojom_parser', 'lexer'), | |
| 25 ] | |
| 26 | |
| 27 for test_dir in test_dir_list: | |
| 28 os.chdir(test_dir) | |
|
ppi
2015/10/05 21:49:58
There is an issue here that as "test_dir" is relat
rudominer
2015/10/05 23:08:13
Thank you for catching this. I went with your opti
| |
| 29 print "Running Go tests in %s..." % test_dir | |
| 30 call_result = subprocess.call([go_tool, "test"], env=env) | |
| 31 if call_result: | |
| 32 os.chdir(saved_cwd ) | |
| 33 return call_result | |
| 34 | |
| 35 os.chdir(saved_cwd ) | |
|
ppi
2015/10/05 21:49:58
remove the space after "saved_cwd".
rudominer
2015/10/05 23:08:13
Done.
| |
| 36 | |
| 37 if __name__ == '__main__': | |
| 38 sys.exit(main()) | |
| OLD | NEW |