OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 from os.path import join, exists | 6 from os.path import join, exists |
7 | 7 |
8 import test | 8 import test |
| 9 from testing import test_runner |
9 | 10 |
10 class VmTestCase(test.TestCase): | 11 class VmTestCase(test.TestCase): |
11 def __init__(self, path, context, mode, arch, flags): | 12 def __init__(self, path, context, mode, arch, flags): |
12 super(VmTestCase, self).__init__(context, path) | 13 super(VmTestCase, self).__init__(context, path) |
13 self.mode = mode | 14 self.mode = mode |
14 self.arch = arch | 15 self.arch = arch |
15 self.flags = flags | 16 self.flags = flags |
16 | 17 |
17 def IsNegative(self): | 18 def IsNegative(self): |
18 # TODO(kasperl): Figure out how to support negative tests. Maybe | 19 # TODO(kasperl): Figure out how to support negative tests. Maybe |
(...skipping 19 matching lines...) Expand all Loading... |
38 | 39 |
39 | 40 |
40 class VmTestConfiguration(test.TestConfiguration): | 41 class VmTestConfiguration(test.TestConfiguration): |
41 def __init__(self, context, root): | 42 def __init__(self, context, root): |
42 super(VmTestConfiguration, self).__init__(context, root) | 43 super(VmTestConfiguration, self).__init__(context, root) |
43 | 44 |
44 def ListTests(self, current_path, path, mode, arch): | 45 def ListTests(self, current_path, path, mode, arch): |
45 if not arch in ['ia32', 'x64', 'arm', 'simarm']: | 46 if not arch in ['ia32', 'x64', 'arm', 'simarm']: |
46 return [] | 47 return [] |
47 run_tests = self.context.GetRunTests(mode, arch) | 48 run_tests = self.context.GetRunTests(mode, arch) |
48 output = test.Execute(run_tests + ['--list'], self.context) | 49 output = test_runner.Execute(run_tests + ['--list'], self.context) |
49 if output.exit_code != 0: | 50 if output.exit_code != 0: |
50 print output.stdout | 51 print output.stdout |
51 print output.stderr | 52 print output.stderr |
52 return [ ] | 53 return [ ] |
53 tests = [ ] | 54 tests = [ ] |
54 for test_line in output.stdout.strip().split('\n'): | 55 for test_line in output.stdout.strip().split('\n'): |
55 name_and_flags = test_line.split() | 56 name_and_flags = test_line.split() |
56 name = name_and_flags[0] | 57 name = name_and_flags[0] |
57 flags = name_and_flags[1:] | 58 flags = name_and_flags[1:] |
58 test_path = current_path + [name] | 59 test_path = current_path + [name] |
59 if self.Contains(path, test_path): | 60 if self.Contains(path, test_path): |
60 tests.append(VmTestCase(test_path, self.context, mode, arch, flags)) | 61 tests.append(VmTestCase(test_path, self.context, mode, arch, flags)) |
61 return tests | 62 return tests |
62 | 63 |
63 def GetTestStatus(self, sections, defs): | 64 def GetTestStatus(self, sections, defs): |
64 status = join(self.root, 'vm.status') | 65 status = join(self.root, 'vm.status') |
65 if exists(status): test.ReadConfigurationInto(status, sections, defs) | 66 if exists(status): test.ReadConfigurationInto(status, sections, defs) |
66 | 67 |
67 | 68 |
68 def GetConfiguration(context, root): | 69 def GetConfiguration(context, root): |
69 return VmTestConfiguration(context, root) | 70 return VmTestConfiguration(context, root) |
OLD | NEW |