Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude browser tests from upstream that are known to fail in Brave #7953

Merged
merged 1 commit into from
Mar 22, 2021

Conversation

mariospr
Copy link
Contributor

@mariospr mariospr commented Feb 12, 2021

This patch disables entire *_browsertest.cc files by making them empty
via chromium_src overrides, as well as all the JS tests via a patch to
include_js_tests.gni, so that we avoid running any test that we know
are going to fail because of the many ways in which Brave is different
than Chromium upstream.

Note that it's possible that this way of excluding tests is a bit too
agressive (i.e. it's likely that some browser tests inside the excluded
files would pass), but for now it's a good enough initial approach as
it enables us to considerably increase test coverage without having
to maintain patches in a too intrusive way.

As a reference, a this time of this patch's writing (on top of Brave
1.23.30 / Chromium 89.0.4389.86), this are the stats when running
upstream's unit tests on a Linux/Debug build, without this patch:

  • Total run: 13355 tests
  • Passed: 10427 tests
  • Not passed: 2928 tests
    • Failed: 870 tests
    • Crashed: 1593 tests
    • Timed out: 465 tests

With this patch applied, the numbers look like this:

  • Total run: 2957 tests
  • Passed: 2957 tests
  • Not passed: 0 tests

That is, what we have with this patch applied looks as follows:

  • 2957/13355 -> 22.14% of ALL the original tests being run
  • 2957/10427 -> 28.36% of the PASSING TESTS still being run

In other words, we're increasing test coverage in 2957 browser tests
in a relatively clean way (i.e. no complex patching) while losing
71.64% of the browser tests that would run and pass if we were not
excluding them in such an agressive way. Not as good results as for
the case of unit tests, but still an improvement for test coverage.

Fix brave/brave-browser#8297

Submitter Checklist:

  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)
  • Requested a security/privacy review as needed

Reviewer Checklist:

  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Run all the enabled browser tests from upstream with npm run test -- browser_tests and check that they all pass

@mariospr mariospr added the tests label Feb 12, 2021
@mariospr mariospr added this to the 1.22.x - Nightly milestone Feb 12, 2021
@mariospr mariospr self-assigned this Feb 12, 2021
if (is_chromeos_ash) {
deps += [ "//ash/public/cpp/external_arc:external_arc" ]
}
+ sources -= brave_chromium_browser_test_exclusions_payments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as other PR, can we just use chromium_src overrides to effectively remove these files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #7901 (comment), that would imply emptying quite a bunch of files but, in the other hand, I think would avoid having to maintain all the ifs I had to use in the browser_tests_exclusions.gni file, so worth a go.

I'll do this change once I finish doing the same for unit_tests, thanks!

@mariospr
Copy link
Contributor Author

@bridiver As mentioned in #7901, I finally got your review comments addressed here and got to a point where all the tests that I run are passing, so I think it's a good time to ping you now.

One important difference here, though, is that I couldn't find a way to "empty" JavaScript files via chromium_src overrides in a similar way to what we do for C++ files, meaning that I ended up simply disabling all JS tests (via include_js_tests.gni) to prevent some of them from failing (a bit too overkill, perhaps), resulting in a whole lot of fewer tests being run.

In any case, and similar to what I posted in #7901, here is how things changed now that we're emptying files via overrides compared to the previous approach of removing them via GN files, these are the numbers:

BEFORE addressing your review comments (i.e. removing failing test suites via GN):

  • Brave/Chromium Version: Brave 1.22.18 / Chromium 89.0.4389.40
  • Results withOUT any exclusion:
    • Total run: 13337 tests
      • Passed: 11429 tests
      • Not passed: 1908 tests
        • Failed: 871 tests
        • Crashed: 555 tests
        • Timed out: 482 tests
  • Results after excluding failing test suites:
    • Total run: 6084 tests (all passing)

In other words:

  • 6084/13337 -> 45.62% of ALL the original tests being run
  • 6084/11429 -> 53.23% of the PASSING TESTS still being run

AFTER addressing your review comments (i.e. removing failing test suites via chromium_src overrides + ignoring ALL JS tests via include_js_tests.gni):

  • Brave/Chromium Version: Brave 1.23.30 / Chromium 89.0.4389.86
  • Results withOUT any exclusion:
    • Total run: 13355 tests
      • Passed: 10427 tests
      • Not passed: 2928 tests
        • Failed: 870 tests
        • Crashed: 1593 tests
        • Timed out: 465 tests
          Timed out: 0 tests
  • Results after excluding failing test suites:
    • Total run: 2957 tests (all passing)

In other words:

  • 2957/13355 -> 22.14% of ALL the original tests being run
  • 2957/10427 -> 28.36% of the PASSING TESTS still being run

As you can see, results here vary wildly and we move from running and passing 53.23% of all the tests that would pass if no exclusions were made to passing only 28.36%, which is nearly half of them. IMHO, this huge reduction is mainly caused due to the fact that we're now excluding all JS tests (instead of just a few ones) combined with the fact that I had to also exclude a bunch of C++ tests more to workaround the steep increase in crashes observed between this two versions of the PR (initially 555 crashes, now 1593!), but still I'm not sure if that justifies going for the more costly approach to exclude tests using GN rules.

Perhaps this override-based method, while yielding much worse results, is still good enough as a first step towards running upstream's browser_tests though. Or perhaps I should spend some more time trying to find a better way to more selectively exclude JS tests, as well as properly understanding why exactly we have way more crashing tests now in case there's something fixable that is introducing too much noise here.

@bridiver WDYT?

@mariospr mariospr marked this pull request as ready for review March 12, 2021 15:38
@mariospr mariospr requested a review from a team as a code owner March 12, 2021 15:38
@mariospr
Copy link
Contributor Author

@bridiver Thanks for the review, landing now then.

This patch disables entire *_browsertest.cc files by making them empty
via chromium_src overrides, as well as all the JS tests via a patch to
include_js_tests.gni, so that we avoid running any test that we know
are going to fail because of the many ways in which Brave is different
than Chromium upstream.

Note that it's possible that this way of excluding tests is a bit too
agressive (i.e. it's likely that some browser tests inside the excluded
files would pass), but for now it's a good enough initial approach as
it enables us to considerably increase test coverage without having
to maintain patches in a too intrusive way.

As a reference, a this time of this patch's writing (on top of Brave
1.23.30 / Chromium 89.0.4389.86), this are the stats when running
upstream's unit tests on a Linux/Debug build, without this patch:

  * Total run: 13355 tests
  * Passed: 10427 tests
  * Not passed: 2928 tests
    - Failed: 870 tests
    - Crashed: 1593 tests
    - Timed out: 465 tests

With this patch applied, the numbers look like this:

  * Total run: 2957 tests
  * Passed: 2957 tests
  * Not passed: 0 tests

That is, what we have with this patch applied looks as follows:

  * 2957/13355 -> 22.14% of ALL the original tests being run
  * 2957/10427 -> 28.36% of the PASSING TESTS still being run

In other words, we're increasing test coverage in 2957 browser tests
in a relatively clean way (i.e. no complex patching) while losing
71.64% of the browser tests that would run and pass if we were not
excluding them in such an agressive way. Not as good results as for
the case of unit tests, but still an improvement for test coverage.

Fix brave/brave-browser#8297
@mariospr
Copy link
Contributor Author

@bridiver Thanks for the review, landing now then.

Actually, I've just rebased this and will wait for the bots again before merging because there were failures on nearly all of them and, while it's likely they were unrelated, I'd rather play it safer and give it another round before merging.

@mariospr
Copy link
Contributor Author

Actually, I've just rebased this and will wait for the bots again before merging because there were failures on nearly all of them and, while it's likely they were unrelated, I'd rather play it safer and give it another round before merging.

Now merging for real

@mariospr mariospr merged commit 10bdab4 into master Mar 22, 2021
@mariospr mariospr deleted the issues/8297 branch March 22, 2021 19:25
mariospr added a commit that referenced this pull request Dec 21, 2021
Similarly to what we've done earlier in the year for other tests [1],
this patch disables entire *_browsertest.cc files by making them empty
via chromium_src overrides, as well as all the JS tests via a patch to
include_js_tests.gni, so that we avoid running any test that we know
are going to fail because of the many ways in which Brave is different
than Chromium upstream.

[1] #7953
mariospr added a commit that referenced this pull request Dec 22, 2021
Similarly to what we've done earlier in the year for other tests [1],
this patch disables entire *_browsertest.cc files by making them empty
via chromium_src overrides, as well as all the JS tests via a patch to
include_js_tests.gni, so that we avoid running any test that we know
are going to fail because of the many ways in which Brave is different
than Chromium upstream.

[1] #7953
mariospr added a commit that referenced this pull request Dec 23, 2021
Similarly to what we've done earlier in the year for other tests [1],
this patch disables entire *_browsertest.cc files by making them empty
via chromium_src overrides, as well as all the JS tests via a patch to
include_js_tests.gni, so that we avoid running any test that we know
are going to fail because of the many ways in which Brave is different
than Chromium upstream.

[1] #7953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get Chromium browser_tests working
2 participants