Chromium Code Reviews| Index: mojo/tools/run_pure_go_tests.py |
| diff --git a/mojo/tools/run_pure_go_tests.py b/mojo/tools/run_pure_go_tests.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..af24a3ee49a1a07b14d8cbfe72aa75018e9b4ecb |
| --- /dev/null |
| +++ b/mojo/tools/run_pure_go_tests.py |
| @@ -0,0 +1,38 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import argparse |
| +import os |
| +import subprocess |
| +import sys |
| + |
|
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
|
| +def main(): |
| + 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.
|
| + 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.
|
| + args = parser.parse_args() |
| + go_tool = args.go_tool |
| + assert go_tool is not None |
| + env = os.environ.copy() |
| + env['GOROOT'] = os.path.dirname(os.path.dirname(go_tool)) |
| + |
| + saved_cwd = os.getcwd() |
| + |
| + test_dir_list = [ |
| + # TODO(rudominer) Add paths to go directories with tests. |
| + #os.path.join('mojom', 'mojom_parser', 'lexer'), |
| + ] |
| + |
| + for test_dir in test_dir_list: |
| + 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
|
| + print "Running Go tests in %s..." % test_dir |
| + call_result = subprocess.call([go_tool, "test"], env=env) |
| + if call_result: |
| + os.chdir(saved_cwd ) |
| + return call_result |
| + |
| + 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.
|
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |