OLD | NEW |
| (Empty) |
1 # Copyright 2014 the V8 project authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import shutil | |
7 | |
8 from testrunner.local import commands | |
9 from testrunner.local import testsuite | |
10 from testrunner.local import utils | |
11 from testrunner.objects import testcase | |
12 | |
13 | |
14 class BaseUnitTestsSuite(testsuite.TestSuite): | |
15 def __init__(self, name, root): | |
16 super(BaseUnitTestsSuite, self).__init__(name, root) | |
17 | |
18 def ListTests(self, context): | |
19 shell = os.path.abspath(os.path.join(context.shell_dir, self.shell())) | |
20 if utils.IsWindows(): | |
21 shell += ".exe" | |
22 output = commands.Execute(context.command_prefix + | |
23 [shell, "--gtest_list_tests"] + | |
24 context.extra_flags) | |
25 if output.exit_code != 0: | |
26 print output.stdout | |
27 print output.stderr | |
28 return [] | |
29 tests = [] | |
30 test_case = '' | |
31 for line in output.stdout.splitlines(): | |
32 test_desc = line.strip().split()[0] | |
33 if test_desc.endswith('.'): | |
34 test_case = test_desc | |
35 elif test_case and test_desc: | |
36 test = testcase.TestCase(self, test_case + test_desc, dependency=None) | |
37 tests.append(test) | |
38 tests.sort() | |
39 return tests | |
40 | |
41 def GetFlagsForTestCase(self, testcase, context): | |
42 return (testcase.flags + ["--gtest_filter=" + testcase.path] + | |
43 ["--gtest_random_seed=%s" % context.random_seed] + | |
44 ["--gtest_print_time=0"] + | |
45 context.mode_flags) | |
46 | |
47 def shell(self): | |
48 return "base-unittests" | |
49 | |
50 | |
51 def GetSuite(name, root): | |
52 return BaseUnitTestsSuite(name, root) | |
OLD | NEW |