| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 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 | 28 |
| 29 # These imports are required for the on-demand conversion from | |
| 30 # old to new status file format. | |
| 31 from os.path import exists | |
| 32 from os.path import getmtime | |
| 33 | |
| 34 from . import old_statusfile | |
| 35 | |
| 36 | |
| 37 # These outcomes can occur in a TestCase's outcomes list: | 29 # These outcomes can occur in a TestCase's outcomes list: |
| 38 SKIP = "SKIP" | 30 SKIP = "SKIP" |
| 39 FAIL = "FAIL" | 31 FAIL = "FAIL" |
| 40 PASS = "PASS" | 32 PASS = "PASS" |
| 41 OKAY = "OKAY" | 33 OKAY = "OKAY" |
| 42 TIMEOUT = "TIMEOUT" | 34 TIMEOUT = "TIMEOUT" |
| 43 CRASH = "CRASH" | 35 CRASH = "CRASH" |
| 44 SLOW = "SLOW" | 36 SLOW = "SLOW" |
| 45 FLAKY = "FLAKY" | 37 FLAKY = "FLAKY" |
| 46 # These are just for the status files and are mapped below in DEFS: | 38 # These are just for the status files and are mapped below in DEFS: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 else: | 101 else: |
| 110 assert False | 102 assert False |
| 111 if len(result) == 0: return | 103 if len(result) == 0: return |
| 112 if rule in target_dict: | 104 if rule in target_dict: |
| 113 target_dict[rule] |= result | 105 target_dict[rule] |= result |
| 114 else: | 106 else: |
| 115 target_dict[rule] = result | 107 target_dict[rule] = result |
| 116 | 108 |
| 117 | 109 |
| 118 def ReadStatusFile(path, variables): | 110 def ReadStatusFile(path, variables): |
| 119 # As long as the old-format .status files are authoritative, just | |
| 120 # create the converted version on demand and cache it to speed up | |
| 121 # subsequent runs. | |
| 122 if path.endswith(".status"): | |
| 123 newpath = path + "2" | |
| 124 if not exists(newpath) or getmtime(newpath) < getmtime(path): | |
| 125 print "Converting status file." | |
| 126 converted = old_statusfile.ConvertNotation(path).GetOutput() | |
| 127 with open(newpath, 'w') as f: | |
| 128 f.write(converted) | |
| 129 path = newpath | |
| 130 | |
| 131 with open(path) as f: | 111 with open(path) as f: |
| 132 global KEYWORDS | 112 global KEYWORDS |
| 133 contents = eval(f.read(), KEYWORDS) | 113 contents = eval(f.read(), KEYWORDS) |
| 134 | 114 |
| 135 rules = {} | 115 rules = {} |
| 136 wildcards = {} | 116 wildcards = {} |
| 137 variables.update(VARIABLES) | 117 variables.update(VARIABLES) |
| 138 for section in contents: | 118 for section in contents: |
| 139 assert type(section) == list | 119 assert type(section) == list |
| 140 assert len(section) == 2 | 120 assert len(section) == 2 |
| 141 if not eval(section[0], variables): continue | 121 if not eval(section[0], variables): continue |
| 142 section = section[1] | 122 section = section[1] |
| 143 assert type(section) == dict | 123 assert type(section) == dict |
| 144 for rule in section: | 124 for rule in section: |
| 145 assert type(rule) == str | 125 assert type(rule) == str |
| 146 if rule[-1] == '*': | 126 if rule[-1] == '*': |
| 147 _ParseOutcomeList(rule, section[rule], wildcards, variables) | 127 _ParseOutcomeList(rule, section[rule], wildcards, variables) |
| 148 else: | 128 else: |
| 149 _ParseOutcomeList(rule, section[rule], rules, variables) | 129 _ParseOutcomeList(rule, section[rule], rules, variables) |
| 150 return rules, wildcards | 130 return rules, wildcards |
| OLD | NEW |