Skip to content

Commit

Permalink
Run PRESUBMIT_test.py in subdirectories
Browse files Browse the repository at this point in the history
Right now, changes to //PRESUBMIT.py trigger running
//PRESUBMIT_test.py during presubmit checks.

However, this does not happen for PRESUBMITs in subdirectories, of
which there is a number with associated PRESUBMIT_test. This CL allows
running the associated PRESUBMIT_test.

Bug: 821981
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I057f4d736992795dde7dd0d329ed3773d22553dc
Reviewed-on: https://chromium-review.googlesource.com/966906
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544318}
  • Loading branch information
Vaclav Brozek authored and Commit Bot committed Mar 20, 2018
1 parent 10f218c commit cdc7def
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -2633,11 +2633,13 @@ def _CommonChecks(input_api, output_api):
results.extend(input_api.RunTests(
input_api.canned_checks.CheckVPythonSpec(input_api, output_api)))

if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
input_api, output_api,
input_api.PresubmitLocalPath(),
whitelist=[r'^PRESUBMIT_test\.py$']))
for f in input_api.AffectedFiles():
path, name = input_api.os_path.split(f.LocalPath())
if name == 'PRESUBMIT.py':
full_path = input_api.os_path.join(input_api.PresubmitLocalPath(), path)
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
input_api, output_api, full_path,
whitelist=[r'^PRESUBMIT_test\.py$']))
return results


Expand Down
1 change: 1 addition & 0 deletions chrome/browser/resources/PRESUBMIT_test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright 2014 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.
Expand Down
1 change: 1 addition & 0 deletions ios/PRESUBMIT_test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright 2017 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.
Expand Down
1 change: 1 addition & 0 deletions media/PRESUBMIT_test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright 2014 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.
Expand Down
1 change: 1 addition & 0 deletions third_party/WebKit/PRESUBMIT_test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright 2017 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.
Expand Down

0 comments on commit cdc7def

Please sign in to comment.