| 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 30 matching lines...) Expand all Loading... |
| 41 self.dependency = dependency | 41 self.dependency = dependency |
| 42 self.variant_flags = variant_flags | 42 self.variant_flags = variant_flags |
| 43 | 43 |
| 44 def GetLabel(self): | 44 def GetLabel(self): |
| 45 return "%s %s %s" % (self.mode, self.path[-2], self.path[-1]) | 45 return "%s %s %s" % (self.mode, self.path[-2], self.path[-1]) |
| 46 | 46 |
| 47 def GetName(self): | 47 def GetName(self): |
| 48 return self.path[-1] | 48 return self.path[-1] |
| 49 | 49 |
| 50 def BuildCommand(self, name): | 50 def BuildCommand(self, name): |
| 51 serialization_file = '' | 51 serialization_file = join('obj', 'test', self.mode, 'serdes') |
| 52 if exists(join(self.context.buildspace, 'obj', 'test', self.mode)): | |
| 53 serialization_file = join('obj', 'test', self.mode, 'serdes') | |
| 54 else: | |
| 55 serialization_file = join('obj', 'serdes') | |
| 56 serialization_file += '_' + self.GetName() | 52 serialization_file += '_' + self.GetName() |
| 57 serialization_file = join(self.context.buildspace, serialization_file) | 53 serialization_file = join(self.context.buildspace, serialization_file) |
| 58 serialization_file += ''.join(self.variant_flags).replace('-', '_') | 54 serialization_file += ''.join(self.variant_flags).replace('-', '_') |
| 59 serialization_option = '--testing_serialization_file=' + serialization_file | 55 serialization_option = '--testing_serialization_file=' + serialization_file |
| 60 result = [ self.executable, name, serialization_option ] | 56 result = [ self.executable, name, serialization_option ] |
| 61 result += self.context.GetVmFlags(self, self.mode) | 57 result += self.context.GetVmFlags(self, self.mode) |
| 62 return result | 58 return result |
| 63 | 59 |
| 64 def GetCommand(self): | 60 def GetCommand(self): |
| 65 return self.BuildCommand(self.raw_name) | 61 return self.BuildCommand(self.raw_name) |
| 66 | 62 |
| 67 def Run(self): | 63 def Run(self): |
| 68 if self.dependency != '': | 64 if self.dependency != '': |
| 69 dependent_command = self.BuildCommand(self.dependency) | 65 dependent_command = self.BuildCommand(self.dependency) |
| 70 output = self.RunCommand(dependent_command) | 66 output = self.RunCommand(dependent_command) |
| 71 if output.HasFailed(): | 67 if output.HasFailed(): |
| 72 return output | 68 return output |
| 73 return test.TestCase.Run(self) | 69 return test.TestCase.Run(self) |
| 74 | 70 |
| 75 | 71 |
| 76 class CcTestConfiguration(test.TestConfiguration): | 72 class CcTestConfiguration(test.TestConfiguration): |
| 77 | 73 |
| 78 def __init__(self, context, root): | 74 def __init__(self, context, root): |
| 79 super(CcTestConfiguration, self).__init__(context, root) | 75 super(CcTestConfiguration, self).__init__(context, root) |
| 80 | 76 |
| 81 def GetBuildRequirements(self): | 77 def GetBuildRequirements(self): |
| 82 return ['cctests'] | 78 return ['cctests'] |
| 83 | 79 |
| 84 def ListTests(self, current_path, path, mode, variant_flags): | 80 def ListTests(self, current_path, path, mode, variant_flags): |
| 85 executable = 'cctest' | 81 executable = join('obj', 'test', mode, 'cctest') |
| 86 if utils.IsWindows(): | 82 if utils.IsWindows(): |
| 87 executable += '.exe' | 83 executable += '.exe' |
| 88 executable = join(self.context.buildspace, executable) | 84 executable = join(self.context.buildspace, executable) |
| 89 if not exists(executable): | |
| 90 executable = join('obj', 'test', mode, 'cctest') | |
| 91 if utils.IsWindows(): | |
| 92 executable += '.exe' | |
| 93 executable = join(self.context.buildspace, executable) | |
| 94 output = test.Execute([executable, '--list'], self.context) | 85 output = test.Execute([executable, '--list'], self.context) |
| 95 if output.exit_code != 0: | 86 if output.exit_code != 0: |
| 96 print output.stdout | 87 print output.stdout |
| 97 print output.stderr | 88 print output.stderr |
| 98 return [] | 89 return [] |
| 99 result = [] | 90 result = [] |
| 100 for test_desc in output.stdout.strip().split(): | 91 for test_desc in output.stdout.strip().split(): |
| 101 raw_test, dependency = test_desc.split('<') | 92 raw_test, dependency = test_desc.split('<') |
| 102 relative_path = raw_test.split('/') | 93 relative_path = raw_test.split('/') |
| 103 full_path = current_path + relative_path | 94 full_path = current_path + relative_path |
| 104 if dependency != '': | 95 if dependency != '': |
| 105 dependency = relative_path[0] + '/' + dependency | 96 dependency = relative_path[0] + '/' + dependency |
| 106 if self.Contains(path, full_path): | 97 if self.Contains(path, full_path): |
| 107 result.append(CcTestCase(full_path, executable, mode, raw_test, dependen
cy, self.context, variant_flags)) | 98 result.append(CcTestCase(full_path, executable, mode, raw_test, dependen
cy, self.context, variant_flags)) |
| 108 result.sort() | 99 result.sort() |
| 109 return result | 100 return result |
| 110 | 101 |
| 111 def GetTestStatus(self, sections, defs): | 102 def GetTestStatus(self, sections, defs): |
| 112 status_file = join(self.root, 'cctest.status') | 103 status_file = join(self.root, 'cctest.status') |
| 113 if exists(status_file): | 104 if exists(status_file): |
| 114 test.ReadConfigurationInto(status_file, sections, defs) | 105 test.ReadConfigurationInto(status_file, sections, defs) |
| 115 | 106 |
| 116 | 107 |
| 117 def GetConfiguration(context, root): | 108 def GetConfiguration(context, root): |
| 118 return CcTestConfiguration(context, root) | 109 return CcTestConfiguration(context, root) |
| OLD | NEW |