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