| 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 |
| 11 # with the distribution. | 11 # with the distribution. |
| 12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
| 13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
| 14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
| 15 # | 15 # |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 import test |
| 28 import os | 29 import os |
| 29 import shutil | 30 from os.path import join, dirname, exists |
| 30 | 31 import platform |
| 31 from testrunner.local import commands | 32 import utils |
| 32 from testrunner.local import testsuite | |
| 33 from testrunner.local import utils | |
| 34 from testrunner.objects import testcase | |
| 35 | |
| 36 | |
| 37 class CcTestSuite(testsuite.TestSuite): | |
| 38 | |
| 39 def __init__(self, name, root): | |
| 40 super(CcTestSuite, self).__init__(name, root) | |
| 41 self.serdes_dir = normpath(join(root, "..", "..", "out", ".serdes")) | |
| 42 if exists(self.serdes_dir): | |
| 43 shutil.rmtree(self.serdes_dir, True) | |
| 44 os.makedirs(self.serdes_dir) | |
| 45 | |
| 46 def ListTests(self, context): | |
| 47 shell = join(context.shell_dir, self.shell()) | |
| 48 if utils.IsWindows(): | |
| 49 shell += '.exe' | |
| 50 output = commands.Execute([shell, '--list']) | |
| 51 if output.exit_code != 0: | |
| 52 print output.stdout | |
| 53 print output.stderr | |
| 54 return [] | |
| 55 tests = [] | |
| 56 for test_desc in output.stdout.strip().split(): | |
| 57 raw_test, dependency = test_desc.split('<') | |
| 58 if dependency != '': | |
| 59 dependency = raw_test.split('/')[0] + '/' + dependency | |
| 60 else: | |
| 61 dependency = None | |
| 62 test = testcase.TestCase(self, raw_test, dependency=dependency) | |
| 63 tests.append(test) | |
| 64 tests.sort() | |
| 65 return tests | |
| 66 | |
| 67 def GetFlagsForTestCase(self, testcase, context): | |
| 68 testname = testcase.path.split(os.path.sep)[-1] | |
| 69 serialization_file = join(self.serdes_dir, "serdes_" + testname) | |
| 70 serialization_file += ''.join(testcase.flags).replace('-', '_') | |
| 71 return (testcase.flags + [testcase.path] + context.mode_flags + | |
| 72 ["--testing_serialization_file=" + serialization_file]) | |
| 73 | |
| 74 def shell(self): | |
| 75 return "cctest" | |
| 76 | |
| 77 | |
| 78 def GetSuite(name, root): | |
| 79 return CcTestSuite(name, root) | |
| 80 | |
| 81 | |
| 82 # Deprecated definitions below. | |
| 83 # TODO(jkummerow): Remove when SCons is no longer supported. | |
| 84 | |
| 85 | |
| 86 from os.path import exists, join, normpath | |
| 87 import test | |
| 88 | 33 |
| 89 | 34 |
| 90 class CcTestCase(test.TestCase): | 35 class CcTestCase(test.TestCase): |
| 91 | 36 |
| 92 def __init__(self, path, executable, mode, raw_name, dependency, context, vari
ant_flags): | 37 def __init__(self, path, executable, mode, raw_name, dependency, context, vari
ant_flags): |
| 93 super(CcTestCase, self).__init__(context, path, mode) | 38 super(CcTestCase, self).__init__(context, path, mode) |
| 94 self.executable = executable | 39 self.executable = executable |
| 95 self.raw_name = raw_name | 40 self.raw_name = raw_name |
| 96 self.dependency = dependency | 41 self.dependency = dependency |
| 97 self.variant_flags = variant_flags | 42 self.variant_flags = variant_flags |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return result | 112 return result |
| 168 | 113 |
| 169 def GetTestStatus(self, sections, defs): | 114 def GetTestStatus(self, sections, defs): |
| 170 status_file = join(self.root, 'cctest.status') | 115 status_file = join(self.root, 'cctest.status') |
| 171 if exists(status_file): | 116 if exists(status_file): |
| 172 test.ReadConfigurationInto(status_file, sections, defs) | 117 test.ReadConfigurationInto(status_file, sections, defs) |
| 173 | 118 |
| 174 | 119 |
| 175 def GetConfiguration(context, root): | 120 def GetConfiguration(context, root): |
| 176 return CcTestConfiguration(context, root) | 121 return CcTestConfiguration(context, root) |
| OLD | NEW |