Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 import os | 29 import os |
| 30 from os.path import join, dirname, exists | 30 from os.path import join, dirname, exists |
| 31 import platform | 31 import platform |
| 32 import utils | 32 import utils |
| 33 | 33 |
| 34 DEBUG_FLAGS = ['--enable-slow-asserts', '--debug-code', '--verify-heap'] | 34 DEBUG_FLAGS = ['--enable-slow-asserts', '--debug-code', '--verify-heap'] |
| 35 | 35 |
| 36 | 36 |
| 37 class CcTestCase(test.TestCase): | 37 class CcTestCase(test.TestCase): |
| 38 | 38 |
| 39 def __init__(self, path, executable, mode, raw_name, context): | 39 def __init__(self, path, executable, mode, raw_name, dependency, context): |
| 40 super(CcTestCase, self).__init__(context, path) | 40 super(CcTestCase, self).__init__(context, path) |
| 41 self.executable = executable | 41 self.executable = executable |
| 42 self.mode = mode | 42 self.mode = mode |
| 43 self.raw_name = raw_name | 43 self.raw_name = raw_name |
| 44 self.dependency = dependency | |
| 44 | 45 |
| 45 def GetLabel(self): | 46 def GetLabel(self): |
| 46 return "%s %s %s" % (self.mode, self.path[-2], self.path[-1]) | 47 return "%s %s %s" % (self.mode, self.path[-2], self.path[-1]) |
| 47 | 48 |
| 48 def GetName(self): | 49 def GetName(self): |
| 49 return self.path[-1] | 50 return self.path[-1] |
| 50 | 51 |
| 51 def GetCommand(self): | 52 def BuildCommand(self, name): |
| 52 serialization_file = join('obj', 'test', self.mode, 'serdes') | 53 serialization_file = join('obj', 'test', self.mode, 'serdes') |
| 53 serialization_option = '--testing_serialization_file=' + serialization_file | 54 serialization_option = '--testing_serialization_file=' + serialization_file |
| 54 result = [ self.executable, self.raw_name, serialization_option ] | 55 result = [ self.executable, name, serialization_option ] |
| 55 if self.mode == 'debug': | 56 if self.mode == 'debug': |
| 56 result += DEBUG_FLAGS | 57 result += DEBUG_FLAGS |
| 57 return result | 58 return result |
| 58 | 59 |
| 60 def GetCommand(self): | |
| 61 return self.BuildCommand(self.raw_name) | |
| 62 | |
| 63 def Run(self): | |
| 64 if self.dependency != '': | |
| 65 dependent_command = self.BuildCommand(self.dependency) | |
| 66 self.RunCommand(dependent_command) | |
|
Christian Plesner Hansen
2009/02/03 08:21:16
Consider checking that this command didn't fail an
olehougaard
2009/02/03 08:34:26
Done
| |
| 67 return test.TestCase.Run(self) | |
| 68 | |
| 59 | 69 |
| 60 class CcTestConfiguration(test.TestConfiguration): | 70 class CcTestConfiguration(test.TestConfiguration): |
| 61 | 71 |
| 62 def __init__(self, context, root): | 72 def __init__(self, context, root): |
| 63 super(CcTestConfiguration, self).__init__(context, root) | 73 super(CcTestConfiguration, self).__init__(context, root) |
| 64 | 74 |
| 65 def GetBuildRequirements(self): | 75 def GetBuildRequirements(self): |
| 66 return ['cctests'] | 76 return ['cctests'] |
| 67 | 77 |
| 68 def ListTests(self, current_path, path, mode): | 78 def ListTests(self, current_path, path, mode): |
| 69 executable = join('obj', 'test', mode, 'cctest') | 79 executable = join('obj', 'test', mode, 'cctest') |
| 70 if utils.IsWindows(): | 80 if utils.IsWindows(): |
| 71 executable += '.exe' | 81 executable += '.exe' |
| 72 output = test.Execute([executable, '--list'], self.context) | 82 output = test.Execute([executable, '--list'], self.context) |
| 73 if output.exit_code != 0: | 83 if output.exit_code != 0: |
| 74 print output.stdout | 84 print output.stdout |
| 75 print output.stderr | 85 print output.stderr |
| 76 return [] | 86 return [] |
| 77 result = [] | 87 result = [] |
| 78 for raw_test in output.stdout.strip().split(): | 88 for test_desc in output.stdout.strip().split(): |
| 79 full_path = current_path + raw_test.split('/') | 89 raw_test, dependency = test_desc.split('<') |
| 90 relative_path = raw_test.split('/') | |
| 91 full_path = current_path + relative_path | |
| 92 if dependency != '': | |
| 93 dependency = relative_path[0] + '/' + dependency | |
| 80 if self.Contains(path, full_path): | 94 if self.Contains(path, full_path): |
| 81 result.append(CcTestCase(full_path, executable, mode, raw_test, self.con text)) | 95 result.append(CcTestCase(full_path, executable, mode, raw_test, dependen cy, self.context)) |
| 82 return result | 96 return result |
| 83 | 97 |
| 84 def GetTestStatus(self, sections, defs): | 98 def GetTestStatus(self, sections, defs): |
| 85 status_file = join(self.root, 'cctest.status') | 99 status_file = join(self.root, 'cctest.status') |
| 86 if exists(status_file): | 100 if exists(status_file): |
| 87 test.ReadConfigurationInto(status_file, sections, defs) | 101 test.ReadConfigurationInto(status_file, sections, defs) |
| 88 | 102 |
| 89 | 103 |
| 90 def GetConfiguration(context, root): | 104 def GetConfiguration(context, root): |
| 91 return CcTestConfiguration(context, root) | 105 return CcTestConfiguration(context, root) |
| OLD | NEW |