Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: mojo/tools/run_pure_go_tests.py

Issue 1384243002: Adds the ability to run pure Go unit tests in the Mojo test suite. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« mojo/tools/get_test_list.py ('K') | « mojo/tools/get_test_list.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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())
OLDNEW
« mojo/tools/get_test_list.py ('K') | « mojo/tools/get_test_list.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698