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

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

Issue 1867563003: Go system tests: Sets the environment variable GODEBUG=cgocheck=2. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | mojo/tools/mojob.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Central list of tests to run (as appropriate for a given config). Add tests 6 """Central list of tests to run (as appropriate for a given config). Add tests
7 to run by modifying this file. 7 to run by modifying this file.
8 8
9 Note that this file is both imported (by mojob.py) and run directly (via a 9 Note that this file is both imported (by mojob.py) and run directly (via a
10 recipe).""" 10 recipe)."""
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 # Utility functions ---------------------------------------------------------- 46 # Utility functions ----------------------------------------------------------
47 47
48 # Call this to determine if a test matching classes this_tests_types should 48 # Call this to determine if a test matching classes this_tests_types should
49 # run: e.g., ShouldRunTest(Config.TEST_TYPE_DEFAULT, "sky") returns true if 49 # run: e.g., ShouldRunTest(Config.TEST_TYPE_DEFAULT, "sky") returns true if
50 # the test list being requested specifies the default set or the "sky" set. 50 # the test list being requested specifies the default set or the "sky" set.
51 def ShouldRunTest(*this_tests_types): 51 def ShouldRunTest(*this_tests_types):
52 return not types_to_run.isdisjoint(this_tests_types) 52 return not types_to_run.isdisjoint(this_tests_types)
53 53
54 # Call this to add the given command to the test list. 54 # Call this to add the given command to the test list.
55 def AddEntry(name, command): 55 # |env| is an optional dictionary to be used to update the environment for
56 # the test process.
57 def AddEntry(name, command, env=None):
56 if config.sanitizer == Config.SANITIZER_ASAN: 58 if config.sanitizer == Config.SANITIZER_ASAN:
57 command = (["python", os.path.join("mojo", "tools", 59 command = (["python", os.path.join("mojo", "tools",
58 "run_command_through_symbolizer.py")] + 60 "run_command_through_symbolizer.py")] +
59 command) 61 command)
60 test_list.append({"name": name, "command": command}) 62 test_list.append({"name": name, "command": command, "env" : env})
61 63
62 # Call this to add the given command to the test list. If appropriate, the 64 # Call this to add the given command to the test list. If appropriate, the
63 # command will be run under xvfb. 65 # command will be run under xvfb.
64 def AddXvfbEntry(name, command): 66 def AddXvfbEntry(name, command):
65 real_command = ["python"] 67 real_command = ["python"]
66 if config.target_os == Config.OS_LINUX: 68 if config.target_os == Config.OS_LINUX:
67 real_command += ["./testing/xvfb.py", paths.SrcRelPath(paths.build_dir)] 69 real_command += ["./testing/xvfb.py", paths.SrcRelPath(paths.build_dir)]
68 real_command += command 70 real_command += command
69 AddEntry(name, real_command) 71 AddEntry(name, real_command)
70 72
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 [os.path.join("mojo", "tools", "apptest_runner.py"), 123 [os.path.join("mojo", "tools", "apptest_runner.py"),
122 os.path.join("mojo", "tools", "data", "nacl_apptests"), 124 os.path.join("mojo", "tools", "data", "nacl_apptests"),
123 build_dir] + verbose_flags) 125 build_dir] + verbose_flags)
124 126
125 # Go unit tests (Linux-only): 127 # Go unit tests (Linux-only):
126 if (target_os == Config.OS_LINUX and 128 if (target_os == Config.OS_LINUX and
127 config.sanitizer != Config.SANITIZER_ASAN and 129 config.sanitizer != Config.SANITIZER_ASAN and
128 ShouldRunTest(Config.TEST_TYPE_DEFAULT, Config.TEST_TYPE_UNIT, "go")): 130 ShouldRunTest(Config.TEST_TYPE_DEFAULT, Config.TEST_TYPE_UNIT, "go")):
129 # Go system tests: 131 # Go system tests:
130 AddEntry("Go system tests", 132 AddEntry("Go system tests",
131 [os.path.join(build_dir, "obj", "mojo", "go", "system_test")]) 133 [os.path.join(build_dir, "obj", "mojo", "go", "system_test")],
134 env={'GODEBUG' : 'cgocheck=2'})
132 135
133 # Pure Go unit tests: 136 # Pure Go unit tests:
134 assert paths.go_tool_path is not None 137 assert paths.go_tool_path is not None
135 go_tool = paths.go_tool_path 138 go_tool = paths.go_tool_path
136 AddEntry("Go unit tests", 139 AddEntry("Go unit tests",
137 ["python", os.path.join("mojo", "tools", "run_pure_go_tests.py"), 140 ["python", os.path.join("mojo", "tools", "run_pure_go_tests.py"),
138 go_tool, os.path.join("mojo", "tools", "data", "gotests")]) 141 go_tool, os.path.join("mojo", "tools", "data", "gotests")])
139 142
140 # Python unit tests: 143 # Python unit tests:
141 if ShouldRunTest(Config.TEST_TYPE_DEFAULT, Config.TEST_TYPE_UNIT, "python"): 144 if ShouldRunTest(Config.TEST_TYPE_DEFAULT, Config.TEST_TYPE_UNIT, "python"):
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 config = Config(**json.load(args.config_file)) 301 config = Config(**json.load(args.config_file))
299 test_list = GetTestList(config) 302 test_list = GetTestList(config)
300 json.dump(test_list, args.test_list_file, indent=2) 303 json.dump(test_list, args.test_list_file, indent=2)
301 args.test_list_file.write("\n") 304 args.test_list_file.write("\n")
302 305
303 return 0 306 return 0
304 307
305 308
306 if __name__ == "__main__": 309 if __name__ == "__main__":
307 sys.exit(main()) 310 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | mojo/tools/mojob.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698