-
Notifications
You must be signed in to change notification settings - Fork 521
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
Fix part of #5343: Exempt targets incompatible with code coverage #5480
Fix part of #5343: Exempt targets incompatible with code coverage #5480
Conversation
PR description will contain much more context, but this also includes adding missing test declarations and some other fixes in existing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed.
scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/proto/script_exemptions.proto
Show resolved
Hide resolved
PTAL @adhiamboperes for codeowners and @Rd4dev for code coverage project interoperability. Note that this PR has a few changes that @Rd4dev should bring into her PRs, so this PR will have a few additional clean-ups before it's ready to submit. I will ask for re-review once those are done, but please do review it before then if you can. |
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
APK & AAB differences analysisNote that this is a summarized snapshot. See the CI artifacts for detailed differences. DevExpand to see flavor specificsUniversal APKAPK file size: 19 MiB (old), 19 MiB (new), 4 bytes (Added) APK download size (estimated): 17 MiB (old), 17 MiB (new), 3 bytes (Removed) Method count: 259120 (old), 259120 (new), 0 (No change) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 6788 (old), 6788 (new), 0 (No change)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 18 MiB (old), 18 MiB (new), 4 bytes (Added) Configuration hdpiAPK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change) Configuration ldpiAPK file size: 49 KiB (old), 49 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 86 KiB (old), 86 KiB (new), 0 bytes (No change) Configuration xhdpiAPK file size: 57 KiB (old), 57 KiB (new), 0 bytes (No change) Configuration xxhdpiAPK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change) Configuration xxxhdpiAPK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change) AlphaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 4 bytes (Added) APK download size (estimated): 10 MiB (old), 10 MiB (new), 10 bytes (Removed) Method count: 115112 (old), 115112 (new), 0 (No change) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5758 (old), 5758 (new), 0 (No change)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 10 MiB (old), 10 MiB (new), 4 bytes (Added) Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) BetaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 0 bytes (No change) APK download size (estimated): 10 MiB (old), 10 MiB (new), 13 bytes (Removed) Method count: 115108 (old), 115108 (new), 0 (No change) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5758 (old), 5758 (new), 0 (No change)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 10 MiB (old), 10 MiB (new), 4 bytes (Added) Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) GaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 8 bytes (Added) APK download size (estimated): 10 MiB (old), 10 MiB (new), 4 bytes (Added) Method count: 115108 (old), 115108 (new), 0 (No change) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5758 (old), 5758 (new), 0 (No change)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 10 MiB (old), 10 MiB (new), 4 bytes (Added) Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @BenHenning, I took a pass and I don't have concerns that you haven't documented.
Thanks, @BenHenning. I've incorporated all the changes into #5461 and added tests for them. I've also tested this PR with a few incompatible sources, and they were exempted as expected. Other than adjusting the exemption message, Todo addition and adding the additional test case (everything you mentioned), this looks good. I can take another look and approve once the refactoring and test additions are done if needed. |
This removes code that was moved to a downstream PR, adds missing test coverage for the new exemption behavior, and improves the messaging for the new exemption behavior. Also, updates the shard count for RunCoverageTest since 4 seemed to be a bit too few when running the test locally since the tests can take quite some time to complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed changes.
Thanks again @Rd4dev and @adhiamboperes for the reviews and follow-ups. The latest changes should be code complete from my perspective, so PTAL and let me know if any additional changes are needed.
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/proto/script_exemptions.proto
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt
Outdated
Show resolved
Hide resolved
scripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @BenHenning! This LGTM.
scripts/src/javatests/org/oppia/android/scripts/coverage/RunCoverageTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed latest changes.
Thanks @adhiamboperes & @Rd4dev for the review.
@Rd4dev I followed up with a change per your comment. PTAL and resolve the thread if it looks good to you. Otherwise, please let me know if any follow-up changes are needed.
I'm also enabling auto-merge on this PR since it seems like everything is addressed at this point, and it's needed for RD's downstream PRs.
Explanation
Fixes part of #5343
This PR prepares for enabling code coverage support in CI by:
At a high-level, there are several reasons why a test may fail to run in coverage:
SpotlightFragmentTest
).There are probably many investigations needed to fix all of these problems, so it makes sense to at least denylist all tests that that are for sure known to fail. This at least sets up the team to get some value from CI-run code coverage, though hard enforcement probably can't be enabled until these stability problems are addressed.
Note that a custom script was written for the purpose of actually performing this analysis, and that can be seen here:
With its corresponding library Bazel declaration:
and its binary declaration:
This script was a significant help in simplifying the work to determining the list of exempted files. It also seems stable: running it with the latest exemption list correctly only runs valid tests.
The script also produced some high-level outputs which are interesting to note:
RunCoverageForAll
script itself).bazel coverage
.Note to reviewers:
scripts/assets/test_file_exemptions.textproto
was automatically generated using the script above, and it was sorted by file path to make it a bit cleaner.Finally, please note that
DirectoryManagementUtilTest
had one source file change due to a compile-time build warning that wasn't caught before (since the test wasn't being built in Bazel with Kotlin warnings-as-errors enabled).Essential Checklist
For UI-specific PRs only
N/A -- This is only affecting build and test infrastructure.