WebLayer: Add presubmit script for skew tests expectations file
Bug: 1172440 Change-Id: I24a8ecf04e74c35c91a5a09b112952d038f65e00 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2941116 Reviewed-by: Robbie McElrath <rmcelrath@chromium.org> Commit-Queue: Rakib Hasan <rmhasan@google.com> Cr-Commit-Position: refs/heads/master@{#889489}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7b02ca0253
commit
9341e56899
34
weblayer/browser/android/javatests/skew/PRESUBMIT.py
Normal file
34
weblayer/browser/android/javatests/skew/PRESUBMIT.py
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2021 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
|
||||
EXPECTATIONS_FILE = 'expectations.txt'
|
||||
|
||||
|
||||
def _MaybeAddTypToPath():
|
||||
src_dir = os.path.join(
|
||||
os.path.dirname(inspect.getfile(CheckChangeOnUpload)),
|
||||
os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)
|
||||
typ_dir = os.path.join(src_dir, 'third_party', 'catapult',
|
||||
'third_party', 'typ')
|
||||
if typ_dir not in sys.path:
|
||||
sys.path.append(typ_dir)
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
_MaybeAddTypToPath()
|
||||
from typ.expectations_parser import TestExpectations
|
||||
|
||||
results = []
|
||||
test_expectations = TestExpectations()
|
||||
with open(EXPECTATIONS_FILE, 'r') as exp:
|
||||
ret, errors = test_expectations.parse_tagged_list(exp.read())
|
||||
|
||||
if ret:
|
||||
results.append(output_api.PresubmitError(
|
||||
'Expectations file had the following errors: \n' + errors))
|
||||
return results
|
Reference in New Issue
Block a user