Commit Graph

237 Commits (7149d2362165cedd74d69f4c78822cb65147b836)

Author SHA1 Message Date
Debrian Figueroa 6095d40061 Make sure PresubmitResult can be converted to a json.
R=martiniss@google.com

Change-Id: Ida198bd834e39cc76d483a88a894f8e39d346976
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1681082
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Debrian Figueroa <debrian@google.com>
6 years ago
Debrian Figueroa dd2737e2b5 Augment presubmit_support to output a json summary.
Adds functionality to presubmit api to return error,
notification and warning messages caught in
presubmit_support.py in the form of a json.

Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Bug:971895
Change-Id: I42a3df3994077342216d002381b6135012b4334c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1666250
Commit-Queue: Debrian Figueroa <debrian@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
6 years ago
Edward Lemur 21000eb851 presubmit_support: Run tests on parallel when asked.
Bug: 819774
Change-Id: I19cd59aab23f3afb39da7fa04c470ad4b1c688f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1627402
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre 7c93846385 Convert except statements to be Python 3 compatible
Ran "2to3 -w -n -f except ./".

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Ifa274cb83f74cfa8ce092fffbb88f3ab5309e72c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1607841
Commit-Queue: Raul Tambre <raul@tambre.ee>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Raul Tambre 09e64b49ee Make presubmit scripts not inherit the executor script's context
This caused compatibility issues, because the executor script (presubmit_support.py) asks the parser for Python 3-style print functions and inherits this to the presubmit scripts it runs, of which some still use the old style statements.

Bug: 961783
Change-Id: I545d778991a53f484bce6c7e29089e0484dc19ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1605917
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
6 years ago
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Yoshisato Yanagisawa 57dd17b46e expose temporary_directory.
Since python2 tempfile does not have TemporaryDirectory, we need to either use temporary_directory in gclient_utils or implement it by ourselves.  If we chose latter, we also need to implement rmtree for Windows.  Considering that, I suppose using gclient_utils should be much easier.

Bug: 939959
Change-Id: Ife21a2bc297ac61a4c1940b06df937c293961ae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524815
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Auto-Submit: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
6 years ago
Yoshisato Yanagisawa 04600b4f26 Expose gclient_paths via InputAPI.
The function we use with gclient_utils has moved to gclient_paths.
However, I am not sure gclient_utils is used by others or not.

Additional change:
- sorted testMembersChanged members for ease of understanding what is
  different.

Bug: 939959
Change-Id: I8b822e26afc73b39d2a33c5e07779c9c14cbd394
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1521850
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@chromium.org>
6 years ago
Caleb Rouleau c0546b9817 presubmit: support 'Bug: 1234, 5678'
The current BugsFromDescription code returns ['1234, 5678'] but I think it
should return ['1234', '5678']. For 'BUG=1234, 5678' this already works.

This was preventing me from uploading
https://chromium-review.googlesource.com/c/catapult/+/1481239
because of https://cs.chromium.org/chromium/src/third_party/catapult/PRESUBMIT.py?q=catapult/PRESUBMIT.py&sq=package:chromium&g=0&l=52

See https://logs.chromium.org/logs/catapult/buildbucket/cr-buildbucket.appspot.com/8920885706080647120/+/steps/presubmit/0/stdout

Change-Id: Ibb3fca8c7a6ec664cdf9a38a8a7ac2bf66cb73ed
Reviewed-on: https://chromium-review.googlesource.com/c/1481240
Auto-Submit: Caleb Rouleau <crouleau@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
6 years ago
Edward Lemur 020b59722a presubmit: Remove EnsureCQIncludeTrybotsAreAdded
Bug: 845642
Change-Id: I552b2da4abbac7ca7f6f3961d2b1c5002fb26f47
Reviewed-on: https://chromium-review.googlesource.com/c/1351509
Reviewed-by: Andy Perelson <ajp@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 7e3c67f2c3 presubmit_support: Fix parallel execution of presubmit tests.
The flag value was not being propagated correctly.

Bug: 819774
Change-Id: I42519e1c84704b9a4a613005d3441b7ee12ea427
Reviewed-on: https://chromium-review.googlesource.com/1142533
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Yoshisato Yanagisawa 406de133ef Add gclient_utils to InputAPI export.
Let me make them exported via InputAPI to be used by our repo.

Change-Id: I1a0c7f49ab5a3c00b2617062444d67bbb9600837
Reviewed-on: https://chromium-review.googlesource.com/1117958
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
7 years ago
Aaron Gable 4b23a2c6d7 Remove more Rietveld support from presubmit
This simplifies future removals of unnecessary code from git-cl.

Bug: 770408
Change-Id: I20329fb6d93b349bf2e9f4aebc795b3f7ef0b646
Reviewed-on: https://chromium-review.googlesource.com/1070588
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
7 years ago
Edward Lemur 1037c743e3 presubmit: Don't overwrite cwd when running tests.
Sometimes 'cwd' has already been specified, for example by GetPythonUnitTests.
Don't overwrite it if it has been.

TBR=agable@chromium.org

Bug: 829084
Change-Id: Ide65c2811bcdd2628d4e886227d634dc66bfd297
Reviewed-on: https://chromium-review.googlesource.com/1038665
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Sergey Ulanov 166bc4ceed Add mojom and fidl files to DEFAULT_WHITE_LIST
This will allow to ensure that fidl and mojom files have proper
copyright header.

Bug: 831384
Change-Id: I5e41bbf27f2e3f2c6749a52de7463d651d033b81
Reviewed-on: https://chromium-review.googlesource.com/1036606
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
7 years ago
Kent Tamura 179dd1e016 input_api.DEFAULT_BLACK_LIST should not block third_party/blink.
We recently moved many files in third_party/WebKit to
third_party/blink. DEFAULT_BLACK_LIST should not block third_party/blink
as well as third_party/WebKit.

Bug: 836555
Change-Id: I5b3a3187f976b011c8efc8bf60635d6a5af1b56b
Reviewed-on: https://chromium-review.googlesource.com/1029562
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
7 years ago
John Budorick 161623779e presubmit: don't attempt to verify nonexistent vpython specs.
Bug: 834180
Change-Id: I431431e4fdf99c16c5fc3dbc7ed999b0c8da24bc
Reviewed-on: https://chromium-review.googlesource.com/1016690
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
7 years ago
Edward Lesmes 8e28279759 Reland "presubmit support: Run all tests in parallel."
Currently all tests in a PRESUBMIT.py file are run in parallel, but not
all tests across PRESUBMIT.py files.

This introduces a flag that will allow presubmit to run all tests across
PRESUBMIT files in parallel.

Bug: 819774
Change-Id: Idd3046cb3c85e9c28932a9789ba7b207a01d9f99
Reviewed-on: https://chromium-review.googlesource.com/994241
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Edward Lesmes 1ad681eca2 Revert "presubmit support: Run all tests in parallel."
This reverts commit c7d0b34084.

Reason for revert:

See https://logs.chromium.org/v/?s=infra%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8950238735438551408%2F%2B%2Fsteps%2Fpresubmit%2F0%2Fstdout
Two go bootstraps executing concurrently and breaking each other. govet and golint presubmit checks both try to bootstrap go at the same time. 


Original change's description:
> presubmit support: Run all tests in parallel.
> 
> Currently all tests in a PRESUBMIT.py file are run in parallel, but not
> all tests across PRESUBMIT.py files.
> 
> This introduces a pool common to all files so we can run all of them.
> 
> Bug: 819774
> Change-Id: Ic129af1bc9e6da568fa9fa71827193c6d8ab9af1
> Reviewed-on: https://chromium-review.googlesource.com/973691
> Reviewed-by: Aaron Gable <agable@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=agable@chromium.org,ehmaldonado@chromium.org

Change-Id: Ia5b5ae5af8d6cf9bd72388f58ff0f032a4367e10
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 819774
Reviewed-on: https://chromium-review.googlesource.com/994032
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Aaron Gable 668c1d8d1f Reland "Remove Rietveld support from presubmit"
Since no one can upload or land changes from Rietveld anymore,
PRESUBMIT and its support files no longer need to be able to
support it.

Bug: 770408
Change-Id: I4ca6391291e7b0755c78af453c3d006ad3666a17
Reviewed-on: https://chromium-review.googlesource.com/991053
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
7 years ago
Edward Lesmes c7d0b34084 presubmit support: Run all tests in parallel.
Currently all tests in a PRESUBMIT.py file are run in parallel, but not
all tests across PRESUBMIT.py files.

This introduces a pool common to all files so we can run all of them.

Bug: 819774
Change-Id: Ic129af1bc9e6da568fa9fa71827193c6d8ab9af1
Reviewed-on: https://chromium-review.googlesource.com/973691
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Aaron Gable ecee74ca4e presubmit: don't die when skipping unknown checks
If someone doesn't want to run a check, and that check doesn't
exist... great! We won't be running that check anyway.

R=iannucci

Bug: 770408, 828154
Change-Id: I74478cac9988e21a1fadfb2c9d23dac1697aaa46
Reviewed-on: https://chromium-review.googlesource.com/991093
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sean McCullough <seanmccullough@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
7 years ago
Aaron Gable aa6ddc6017 Revert "Remove Rietveld support from presubmit"
This reverts commit f3eed0016e.

Reason for revert: Some PRESUBMIT checks still expect 
CheckRietveldTryJobExecution to exist.

Original change's description:
> Remove Rietveld support from presubmit
> 
> Since no one can upload or land changes from Rietveld anymore,
> PRESUBMIT and its support files no longer need to be able to
> support it.
> 
> R=​tandrii@chromium.org
> 
> Bug: 770408
> Change-Id: I749092b66fdca16d5cef77e8cefc905aa5375b50
> Reviewed-on: https://chromium-review.googlesource.com/693380
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>

TBR=agable@chromium.org,tandrii@chromium.org

Change-Id: I72e29bd8a9739406f29190adbeb7eb7718ed21cd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 770408
Reviewed-on: https://chromium-review.googlesource.com/991012
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
7 years ago
Aaron Gable f3eed0016e Remove Rietveld support from presubmit
Since no one can upload or land changes from Rietveld anymore,
PRESUBMIT and its support files no longer need to be able to
support it.

R=tandrii@chromium.org

Bug: 770408
Change-Id: I749092b66fdca16d5cef77e8cefc905aa5375b50
Reviewed-on: https://chromium-review.googlesource.com/693380
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Robert Iannucci 5025893cb6 [presubmit_support] Prevent depot_tools' virtualenv from leaking into other repos.
Currently in LUCI `git cl` is invoked on chromium_presubmit using vpython. This
means that it operates under the depot_tools .vpython environment (which is
blank).

Some features in presubmit_support allow invocation of python subprocesses, and
previously they would use `sys.executable` (especially on windows, but
occasionally on non-windows as well).

In non-vpython environments, this just picks up the system python and whatever
modules happen to be installed there. Some python unittests work around this on
non-windows systems by having a shebang line which explicitly invokes vpython.

This CL changes presubmit_support so that invocations of 'python', or executions
of '.py' scripts will always end up invoking vpython. In the best case, this will
pick up the invoked scripts' vpython environment. In the worst case, this will
invoke the script under an empty vpython environment (aka "stock python").

R=dpranke@chromium.org, jbudorick@chromium.org, tandrii@chromium.org, tikuta@chromium.org

Bug: 821669
Change-Id: I5d2d5dfd0364022d56833c2c8af4983553a29c7a
Reviewed-on: https://chromium-review.googlesource.com/961865
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Daniel Bratell 72272996b6 Remove duplicate assignment of same variable in presubmit code
Change-Id: I04261053a37db078e2aff579ab4521056cce673c
Reviewed-on: https://chromium-review.googlesource.com/931555
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
7 years ago
Aaron Gable 5d5f22ce9d Remove prompts to contact maruel
R=maruel

Change-Id: I0a5a18d598632bc77a8c70a21c8b3c4c2223d543
Reviewed-on: https://chromium-review.googlesource.com/899682
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
7 years ago
Mun Yong Jang 603d01e818 [presubmit] Use GerritAccessor in CheckChangedLUCIConfigs
For tryjobs, determine the remote branch using GerritAccessor

Bug: 761488
Change-Id: Ieea6028d222af0014ec3a57c3ad7b7eb8af5ec33
Reviewed-on: https://chromium-review.googlesource.com/834995
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Aaron Gable 7817f02543 Reland "Use core.quotePath=false when git is listing files"
This is a reland of 9219d35688

The original was reverted due to a typo (core,quotePath instead
of core.quotePath). This version is fixed.

Original change's description:
> Use core.quotePath=false when git is listing files
>
> This prevents git from putting quotes around some file names
> (those that have astral-plane characters) and not around others.
>
> R=maruel
>
> Bug: 792302
>
> Change-Id: I3b6a6b36c4720116de811b40177b59aa25c263db
> Reviewed-on: https://chromium-review.googlesource.com/815454
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>

Bug: 792302
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Change-Id: I28d2260948aaf63bd865888c2f60e4cdee9aea48
Reviewed-on: https://chromium-review.googlesource.com/822990
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Robbie Iannucci 6aaee3065c Revert "Use core.quotePath=false when git is listing files"
This reverts commit 9219d35688.

Reason for revert: unfortunately this says "core,quotePath" and since it includes recipe changes, we need something that the roller can munch on :(

Original change's description:
> Use core.quotePath=false when git is listing files
> 
> This prevents git from putting quotes around some file names
> (those that have astral-plane characters) and not around others.
> 
> R=​maruel
> 
> Bug: 792302
> Recipe-Nontrivial-Roll: build
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Change-Id: I3b6a6b36c4720116de811b40177b59aa25c263db
> Reviewed-on: https://chromium-review.googlesource.com/815454
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>

TBR=maruel@chromium.org,agable@chromium.org

Change-Id: I226388f19024403240a1443eb2b878b9293220e1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 792302
Reviewed-on: https://chromium-review.googlesource.com/821671
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Aaron Gable 9219d35688 Use core.quotePath=false when git is listing files
This prevents git from putting quotes around some file names
(those that have astral-plane characters) and not around others.

R=maruel

Bug: 792302
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Change-Id: I3b6a6b36c4720116de811b40177b59aa25c263db
Reviewed-on: https://chromium-review.googlesource.com/815454
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
7 years ago
Daniel Cheng d36fce4408 Fix silly bug in presubmit_support implementation of AppendCC.
The executor needs to accumnulate more_cc, not overwrite them.

Bug: 786386
Change-Id: Iadfe836ae9623f1b66d2db8209d347b5e61ccae8
Reviewed-on: https://chromium-review.googlesource.com/784553
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
8 years ago
Daniel Cheng 7227d2175a Add OutputApi.AppendCC to allow presubmit checks to add CCs
Bug: 786386
Change-Id: If29acf287355d150e0f89f45b2f7aa87a08dcc57
Reviewed-on: https://chromium-review.googlesource.com/776645
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
8 years ago
Raphael Kubo da Costa f2d1615bc8 presubmit: Add InputApi.CreateTemporaryFile()
Sometimes, InputApi users need to create temporary files, write to them and
pass them to another process, like this:

  with input_api.tempfile.NamedTemporaryFile() as f:
    f.write('foo')
    input_api.subprocess.check_output(['/path/to/script',
        '--reading-from', f.name])

While this works fine on Unix, on Windows subprocess cannot open and read
the file while we have it open for writing.

To work around this, we now offer a CreateTemporaryFile() that wraps a call
to tempfile.NamedTemporaryFile(delete=False), and we then take care of
removing all files created this way at the end of a presubmit run.

The idea is for users to do something like this:

  with input_api.CreateTemporaryFile() as f:
    f.write('foo')
    f.close()
    input_api.subprocess.check_output(['/path/to/script',
        '--reading-from', f.name])

with the temporary file being removed automatically in a transparent fashion
later.

Bug: 780629
Change-Id: I0d705a5d52928a43f39a51f94a2c48d277bd5ced
Reviewed-on: https://chromium-review.googlesource.com/758637
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrew Grieve 92b8b99069 presubmit: Update pydoc for AffectedFile.LocalPath()
To mention that it should not be used for accessing files.

Change-Id: I01ea79134bfc1f394c1791d47eb6fdb798358941
Reviewed-on: https://chromium-review.googlesource.com/750646
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
8 years ago
Dan Jacques 94652a3767 Add CIPD manifest PRESUBMIT.
Add CIPD manifest PRESUBMIT canned checks.

BUG=None
TEST=local

Change-Id: Ibf739147f47b4f38a2892c856cf45c5839d1c3e7
Reviewed-on: https://chromium-review.googlesource.com/707557
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Aaron Gable 5254da1843 Revert "Capture ctrl-c in presubmit multiprocessing pool"
This reverts commit 873c28d175.

Reason for revert: Broken on Windows (crbug.com/762389)

Original change's description:
> Capture ctrl-c in presubmit multiprocessing pool
> 
> Presubmit spins up lots of multiprocessing processes to run
> each individual test. If you cancel your presubmit run with
> <ctrl>+c, that signal gets passed through to each of those,
> which then raises its own KeyboardInterrupt, and prints its
> own stacktrace.
> 
> This change has each member of the multiprocessing pool instead
> exit gracefully (albeit with an error code) so that only the
> parent process prints its stacktrace.
> 
> R=​michaelpg@chromium.org
> 
> Bug: 635196
> Change-Id: If9081910a359889a43bc1b72c91a859ebe37a1d6
> Reviewed-on: https://chromium-review.googlesource.com/651764
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Aaron Gable <agable@chromium.org>

TBR=iannucci@chromium.org,agable@chromium.org,michaelpg@chromium.org

Change-Id: Ib8e5b2f59b0060dfbfbeba348e211db292318b3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 635196
Reviewed-on: https://chromium-review.googlesource.com/653434
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 873c28d175 Capture ctrl-c in presubmit multiprocessing pool
Presubmit spins up lots of multiprocessing processes to run
each individual test. If you cancel your presubmit run with
<ctrl>+c, that signal gets passed through to each of those,
which then raises its own KeyboardInterrupt, and prints its
own stacktrace.

This change has each member of the multiprocessing pool instead
exit gracefully (albeit with an error code) so that only the
parent process prints its stacktrace.

R=michaelpg@chromium.org

Bug: 635196
Change-Id: If9081910a359889a43bc1b72c91a859ebe37a1d6
Reviewed-on: https://chromium-review.googlesource.com/651764
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Takeshi Yoshino 07a6bea90f Expose ast via InputApi
To be used by https://chromium-review.googlesource.com/c/593708/

Bug:
Change-Id: I0d005bf6a6ba4262197a222cb337308551ed61a6
Reviewed-on: https://chromium-review.googlesource.com/595308
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Aaron Gable 8b478f0406 PRESUBMIT: Be resilient to changes with no Code-Review label
Bug: 750694
Change-Id: I69778c3ea0789795ad7e50d11bf677df8f7bc262
Reviewed-on: https://chromium-review.googlesource.com/594839
Reviewed-by: Daniel Jacques <dnj@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Jeremy Roman dce2250d14 Presubmit: Treat changes with Gerrit-style Tbr: header as TBRed.
Bug: 735158
Change-Id: I1444f34c84862f542909d0b70c5cdfd02394526c
Reviewed-on: https://chromium-review.googlesource.com/541638
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
8 years ago
Aaron Gable 12ef501b02 Parse Bug, R, and Tbr git-footers in PRESUBMIT
This gives PRESUBMIT equal support for all the
gerrit-style footers that we're migrating to.

R=iannucci@chromium.org, tandrii@chromium.org

Bug: 710327,710803
Change-Id: I64b8f39ef923d90ebda7dd191b83d1a7cc87c776
Reviewed-on: https://chromium-review.googlesource.com/506551
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable fc03e67e9a Refactor PRESUBMIT support for tags
We want PRESUBMIT to be able to equally support
BUG= tags (old style) and Git-Footer: footers
(new style). This change refactors the way that
the presubmit api gives access to those properties
so that it is easier to add support for equivalent
footers.

It also limits the scope of tags/footers that it
exposes, as code search shows no PRESUBMIT files
that take advantage of any of the more esoteric
ones.

Bug: 710327, 710803
Change-Id: I86f1d6cb2e1f0aff9653ef3fb455e0a6f47acf5d
Reviewed-on: https://chromium-review.googlesource.com/506450
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable b584c4f0d1 Make CQ_INCLUDE_TRYBOTS support review-specific
This CL wholly revamps the way presubmit_support adds
CQ_INCLUDE_TRYBOTS lines in commit descriptions. In
particular, when the CL is being uploaded to Gerrit,
it uses our pre-existing support for manipulating git
footers to make the whole process much simpler.

R=tandrii@chromium.org

Bug: 710547
Change-Id: I5858282a44c590f131021fa3820f1cb3f70ef620
Reviewed-on: https://chromium-review.googlesource.com/487831
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Kenneth Russell df6e7348b9 Fix addition of CQ_INCLUDE_TRYBOTS on Gerrit.
BUG=710547

Change-Id: I6558ba08683b8e010ac5051dabfd82d9a5b9c551
Reviewed-on: https://chromium-review.googlesource.com/486083
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
8 years ago
Aaron Gable 6f5a8d9987 Flip gerrit_util to raise exceptions on 404 by default
This makes the library behave more like what we'd expect,
while still allowing certain function to specify that
returning 204 or 404 is expected/acceptable behavior.

Change-Id: If3ce5598d1603819ee97aaeab0072a9e786ed96d
Reviewed-on: https://chromium-review.googlesource.com/481043
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 19ee16c860 Reland "Refactor ReadHttpResponse to be error-friendlier"
Gerrit sometimes returns a full response json object at
the same time as returning a non-200 status code. This
refactor makes it easier for calling code to request
access to that object and handle error cases on its own.

The original version of this commit had a bug where
ReadHttpResponse properly set the default value for
accept_statuses, but all calls which came through
ReadHttpJsonResponse were setting None instead.

Bug: 710028
Change-Id: I8cee435d8acd487fb777b3fd69b5e48e19d2e5a3
Reviewed-on: https://chromium-review.googlesource.com/481060
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 382674be12 Revert "Refactor ReadHttpResponse to be error-friendlier"
This reverts commit 6d7ab1bfe5.

Reason for revert: Stacktrace:
 File "/s/depot_tools/gerrit_util.py", line 816, in GetAccountDetails
   return ReadHttpJsonResponse(conn)
 File "/s/depot_tools/gerrit_util.py", line 376, in ReadHttpJsonResponse
   fh = ReadHttpResponse(conn, accept_statuses)
 File "/s/depot_tools/gerrit_util.py", line 365, in ReadHttpResponse
   if response.status not in accept_statuses:
TypeError: argument of type 'NoneType' is not iterable

Original change's description:
> Refactor ReadHttpResponse to be error-friendlier
> 
> Gerrit sometimes returns a full response json object at
> the same time as returning a non-200 status code. This
> refactor makes it easier for calling code to request
> access to that object and handle error cases on its own.
> 
> Bug: 710028
> Change-Id: Id1017d580d2fb843d5ca6287efcfed8775c52cd6
> Reviewed-on: https://chromium-review.googlesource.com/479450
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> 

TBR=agable@chromium.org,tandrii@chromium.org,chromium-reviews@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ia9d9ce835e207a32e7cc8ee35c0cf40c823c7b78
Reviewed-on: https://chromium-review.googlesource.com/481059
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 6d7ab1bfe5 Refactor ReadHttpResponse to be error-friendlier
Gerrit sometimes returns a full response json object at
the same time as returning a non-200 status code. This
refactor makes it easier for calling code to request
access to that object and handle error cases on its own.

Bug: 710028
Change-Id: Id1017d580d2fb843d5ca6287efcfed8775c52cd6
Reviewed-on: https://chromium-review.googlesource.com/479450
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Jochen Eisinger d0573ec067 Use OldContents() for OWNERS files to do checks
BUG=141253
R=dpranke@chromium.org

Change-Id: Iacbc2f0571e725e4f2ccf5ea7878f101972289bb
Reviewed-on: https://chromium-review.googlesource.com/476610
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
8 years ago