Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Issue 2629723004: Add presubmit check to prevent package boundary violations. (Closed)

Created:
3 years, 11 months ago by ehmaldonado_webrtc
Modified:
3 years, 10 months ago
Reviewers:
kjellander_webrtc
CC:
webrtc-reviews_webrtc.org, qiang.lu, niklas.enbom, yujie_mao (webrtc), peah-webrtc
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Add presubmit check to prevent package boundary violations. BUG=webrtc:6954 NOTRY=True Review-Url: https://codereview.webrtc.org/2629723004 Cr-Commit-Position: refs/heads/master@{#16357} Committed: https://chromium.googlesource.com/external/webrtc/+/4fb97462a8443fd0879953f0b30d59811828f851

Patch Set 1 #

Total comments: 16

Patch Set 2 : Rewrite using regular expressions. #

Patch Set 3 : Add tests. #

Total comments: 15

Patch Set 4 : Addressed comments. #

Total comments: 3

Patch Set 5 : Change tests. #

Patch Set 6 : Add more tests. #

Total comments: 3

Patch Set 7 : preffix->prefix #

Patch Set 8 : Sort lists before comparing. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+422 lines, --3 lines) Patch
M PRESUBMIT.py View 1 2 3 5 chunks +32 lines, -2 lines 0 comments Download
A tools-webrtc/check_package_boundaries.py View 1 2 3 4 5 1 chunk +137 lines, -0 lines 0 comments Download
A tools-webrtc/check_package_boundaries_test.py View 1 2 3 4 5 6 7 1 chunk +67 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/BUILD.gn View 1 2 3 4 5 1 chunk +14 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/expected.pyl View 1 2 3 4 5 1 chunk +20 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/subpackage1/BUILD.gn View 1 2 3 4 5 1 chunk +15 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/subpackage1/subsubpackage1/BUILD.gn View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/subpackage2/BUILD.gn View 1 2 3 4 5 1 chunk +15 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/all_build_files/subpackage2/subsubpackage2/BUILD.gn View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
A tools-webrtc/testdata/common_prefix/BUILD.gn View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/common_prefix/call/BUILD.gn View 1 2 3 4 5 6 0 chunks +-1 lines, --1 lines 0 comments Download
A tools-webrtc/testdata/common_prefix/expected.pyl View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_multiple_targets/BUILD.gn View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_multiple_targets/expected.pyl View 1 2 3 4 1 chunk +20 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_multiple_targets/subpackage1/BUILD.gn View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_multiple_targets/subpackage2/BUILD.gn View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_single_target/BUILD.gn View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_single_target/expected.pyl View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/multiple_errors_single_target/subpackage/BUILD.gn View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/no_errors/BUILD.gn View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
A tools-webrtc/testdata/no_errors/expected.pyl View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 29 (10 generated)
ehmaldonado_webrtc
3 years, 11 months ago (2017-01-13 14:49:35 UTC) #3
kjellander_webrtc
Can you share some numbers on how long this check takes to run on a ...
3 years, 11 months ago (2017-01-16 07:26:10 UTC) #4
ehmaldonado_webrtc
Without setting --max_messages, and without specifying BUILD.gn files (so that all BUILD.gn files are processed) ...
3 years, 11 months ago (2017-01-16 08:52:51 UTC) #5
ehmaldonado_webrtc
PTAL Tests on the way... :)
3 years, 11 months ago (2017-01-16 10:57:55 UTC) #6
ehmaldonado_webrtc
On 2017/01/16 10:57:55, ehmaldonado_webrtc wrote: > PTAL > Tests on the way... :) And tests ...
3 years, 11 months ago (2017-01-16 13:14:26 UTC) #7
kjellander_webrtc
First round. I will review the actual tests later. https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py File PRESUBMIT.py (right): https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py#newcode301 PRESUBMIT.py:301: ...
3 years, 11 months ago (2017-01-19 10:51:26 UTC) #8
ehmaldonado_webrtc
https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py File PRESUBMIT.py (right): https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py#newcode301 PRESUBMIT.py:301: def _CheckNoPackageBoundaryViolations(input_api, gn_files, output_api): On 2017/01/19 10:51:26, kjellander_webrtc wrote: ...
3 years, 11 months ago (2017-01-19 13:33:56 UTC) #9
kjellander_webrtc
https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py File PRESUBMIT.py (right): https://codereview.webrtc.org/2629723004/diff/40001/PRESUBMIT.py#newcode301 PRESUBMIT.py:301: def _CheckNoPackageBoundaryViolations(input_api, gn_files, output_api): On 2017/01/19 13:33:56, ehmaldonado_webrtc wrote: ...
3 years, 11 months ago (2017-01-24 09:33:20 UTC) #10
ehmaldonado_webrtc
PTAL :)
3 years, 11 months ago (2017-01-24 14:09:05 UTC) #11
kjellander_webrtc
On 2017/01/24 14:09:05, ehmaldonado_webrtc wrote: > PTAL :) Woho, solid testing work here. LGTM!
3 years, 11 months ago (2017-01-24 17:46:10 UTC) #12
kjellander_webrtc
..but please address my comments https://codereview.webrtc.org/2629723004/diff/100001/tools-webrtc/check_package_boundaries_test.py File tools-webrtc/check_package_boundaries_test.py (right): https://codereview.webrtc.org/2629723004/diff/100001/tools-webrtc/check_package_boundaries_test.py#newcode59 tools-webrtc/check_package_boundaries_test.py:59: def test_common_preffix(self): preffix -> ...
3 years, 11 months ago (2017-01-24 17:46:27 UTC) #13
ehmaldonado_webrtc
Done :) Maybe this should wait until https://codereview.webrtc.org/2649563002/ is submitted? Otherwise people modifiying webrtc/modules/BUILD.gn might ...
3 years, 11 months ago (2017-01-24 17:57:33 UTC) #15
kjellander_webrtc
On 2017/01/24 17:57:33, ehmaldonado_webrtc wrote: > Done :) > Maybe this should wait until https://codereview.webrtc.org/2649563002/ ...
3 years, 11 months ago (2017-01-25 15:53:06 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2629723004/120001
3 years, 10 months ago (2017-01-30 12:31:56 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: presubmit on master.tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/presubmit/builds/12813)
3 years, 10 months ago (2017-01-30 12:37:06 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2629723004/140001
3 years, 10 months ago (2017-01-30 13:24:43 UTC) #24
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://chromium.googlesource.com/external/webrtc/+/4fb97462a8443fd0879953f0b30d59811828f851
3 years, 10 months ago (2017-01-30 13:27:27 UTC) #27
tommi
On 2017/01/30 13:27:27, commit-bot: I haz the power wrote: > Committed patchset #8 (id:140001) as ...
3 years, 10 months ago (2017-02-12 16:32:48 UTC) #28
kjellander_webrtc
3 years, 10 months ago (2017-02-13 06:29:12 UTC) #29
Message was sent while issue was closed.
On 2017/02/12 16:32:48, tommi (webrtc) wrote:
> On 2017/01/30 13:27:27, commit-bot: I haz the power wrote:
> > Committed patchset #8 (id:140001) as
> >
>
https://chromium.googlesource.com/external/webrtc/+/4fb97462a8443fd0879953f0b...
> 
> I'm getting an error on Windows whenever I do a git cl upload.  See below.  I
> wonder if this could be because of assumptions that don't hold on all
platforms?
> (e.g. '/' vs '\\')

Seems likely. Edward: can you give this a try on your Windows machine? 
We could setup presubmit checks on Windows as well, if this turns out to be a
recurring problem (but I don't remember any other recent case).

 
> d:\src\webrtc\src\out\Default>git cl upload -m "Rebase"
> Using 50% similarity for rename/copy detection. Override with --similarity.
> Running presubmit upload checks ...
> 
> ** Presubmit Warnings **
> d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py (0.10s) failed
> F.FF.
> ======================================================================
> FAIL: test_all_build_files (__main__.UnitTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 63, in test_all_build_files
>     self.RunTest(os.path.join(TESTDATA_DIR, 'all_build_files'), True)
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 48, in RunTest
>     self.assertListEqual(sorted(expected_messages), sorted(logger.messages))
> AssertionError: Lists differ: [['subpackage1/BUILD.gn', '12'... != []
> 
> First list contains 4 additional elements.
> First extra element 0:
> ['subpackage1/BUILD.gn', '12', 'error_1',
> 'subsubpackage1/dummy_subsubpackage1.cc', 'subsubpackage1']
> 
> + []
> - [['subpackage1/BUILD.gn',
> -   '12',
> -   'error_1',
> -   'subsubpackage1/dummy_subsubpackage1.cc',
> -   'subsubpackage1'],
> -  ['subpackage1/BUILD.gn',
> -   '13',
> -   'error_1',
> -   'subsubpackage1/dummy_subsubpackage1.h',
> -   'subsubpackage1'],
> -  ['subpackage2/BUILD.gn',
> -   '12',
> -   'error_2',
> -   'subsubpackage2/dummy_subsubpackage2.cc',
> -   'subsubpackage2'],
> -  ['subpackage2/BUILD.gn',
> -   '13',
> -   'error_2',
> -   'subsubpackage2/dummy_subsubpackage2.h',
> -   'subsubpackage2']]
> 
> ======================================================================
> FAIL: test_multiple_errors_multiple_targets (__main__.UnitTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 57, in test_multiple_errors_multiple_targets
>     self.RunTest(os.path.join(TESTDATA_DIR,
'multiple_errors_multiple_targets'))
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 48, in RunTest
>     self.assertListEqual(sorted(expected_messages), sorted(logger.messages))
> AssertionError: Lists differ: [['BUILD.gn', '18', 'error_1',... != []
> 
> First list contains 4 additional elements.
> First extra element 0:
> ['BUILD.gn', '18', 'error_1', 'subpackage1/dummy_subpackage1.cc',
'subpackage1']
> 
> + []
> - [['BUILD.gn',
> -   '18',
> -   'error_1',
> -   'subpackage1/dummy_subpackage1.cc',
> -   'subpackage1'],
> -  ['BUILD.gn',
> -   '19',
> -   'error_1',
> -   'subpackage1/dummy_subpackage1.h',
> -   'subpackage1'],
> -  ['BUILD.gn',
> -   '25',
> -   'error_2',
> -   'subpackage1/dummy_subpackage2.cc',
> -   'subpackage1'],
> -  ['BUILD.gn',
> -   '26',
> -   'error_2',
> -   'subpackage1/dummy_subpackage2.h',
> -   'subpackage1']]
> 
> ======================================================================
> FAIL: test_multiple_errors_single_target (__main__.UnitTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 54, in test_multiple_errors_single_target
>     self.RunTest(os.path.join(TESTDATA_DIR, 'multiple_errors_single_target'))
>   File "d:\src\webrtc\src\tools-webrtc\check_package_boundaries_test.py", line
> 48, in RunTest
>     self.assertListEqual(sorted(expected_messages), sorted(logger.messages))
> AssertionError: Lists differ: [['BUILD.gn', '11', 'dummy_tar... != []
> 
> First list contains 2 additional elements.
> First extra element 0:
> ['BUILD.gn', '11', 'dummy_target', 'subpackage/dummy_subpackage_file.cc',
> 'subpackage']
> 
> + []
> - [['BUILD.gn',
> -   '11',
> -   'dummy_target',
> -   'subpackage/dummy_subpackage_file.cc',
> -   'subpackage'],
> -  ['BUILD.gn',
> -   '12',
> -   'dummy_target',
> -   'subpackage/dummy_subpackage_file.h',
> -   'subpackage']]
> 
> ----------------------------------------------------------------------
> Ran 5 tests in 0.006s
> 
> FAILED (failures=3)
> 
> 
> Presubmit checks took 2.5s to calculate.
> 
> There were presubmit warnings. Are you sure you wish to continue? (y/N): N

Powered by Google App Engine
This is Rietveld 408576698