Chromium Code Reviews| Index: tools/testrunner/local/statusfile.py |
| diff --git a/tools/testrunner/local/statusfile.py b/tools/testrunner/local/statusfile.py |
| index bfa53c53484b75b30e148dc0cfd1f2488c13929d..6e2a012a9aa0795a0f1a1a812fbc5dfaaead0185 100644 |
| --- a/tools/testrunner/local/statusfile.py |
| +++ b/tools/testrunner/local/statusfile.py |
| @@ -25,6 +25,7 @@ |
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +import os |
| # These outcomes can occur in a TestCase's outcomes list: |
| SKIP = "SKIP" |
| @@ -125,10 +126,14 @@ def _ParseOutcomeList(rule, outcomes, target_dict, variables): |
| target_dict[rule] = result |
| -def ReadStatusFile(path, variables): |
| +def ReadContent(path): |
| with open(path) as f: |
| global KEYWORDS |
| - contents = eval(f.read(), KEYWORDS) |
| + return eval(f.read(), KEYWORDS) |
| + |
| + |
| +def ReadStatusFile(path, variables): |
| + contents = ReadContent(path) |
| rules = {} |
| wildcards = {} |
| @@ -146,3 +151,25 @@ def ReadStatusFile(path, variables): |
| else: |
| _ParseOutcomeList(rule, section[rule], rules, variables) |
| return rules, wildcards |
| + |
| + |
| +def PresubmitCheck(path): |
| + contents = ReadContent(path) |
| + root_prefix = os.path.basename(os.path.dirname(path)) + "/" |
| + |
| + try: |
| + for section in contents: |
| + assert type(section) == list |
|
Jakob Kummerow
2015/11/25 11:04:17
This checker bails out on the first error it finds
|
| + assert len(section) == 2 |
| + section = section[1] |
| + assert type(section) == dict |
| + for rule in section: |
| + assert type(rule) == str |
| + assert not rule.startswith(root_prefix), ( |
| + "Suite name prefix must not be used in status files") |
| + assert not rule.endswith('.js'), ( |
| + ".js extension must not be used in status files.") |
| + return True |
| + except Exception as e: |
| + print e |
| + return False |