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

Fix part of #5343: Enable Coverage Generation for a list of files #5461

Merged
merged 246 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
d1c07cd
Code Coverage M1 edge case, added arg names to specifically pick the …
Rd4dev Jun 28, 2024
b26ac35
Modified script example doc and updated the exception string to be mo…
Rd4dev Jun 28, 2024
b89d9a8
Added tests for edge case checks
Rd4dev Jun 28, 2024
23cba86
Increasing the processTimeout to 10 minutes as coverage analysis take…
Rd4dev Jun 28, 2024
e24578e
Setting processTimeout in the run coverage script to see if this affe…
Rd4dev Jun 28, 2024
96c2b74
Set processTimeout for added test cases
Rd4dev Jun 28, 2024
349be2e
Triggering Build to check TIMEOUT
Rd4dev Jun 29, 2024
300fb90
Reverting the changes just to check if these changes have any effect …
Rd4dev Jun 29, 2024
181e8b2
Reverting the changes just to check if these changes have any effect …
Rd4dev Jun 29, 2024
87926ad
Re-introducing the changes while removing the ignore case check as we…
Rd4dev Jun 29, 2024
718b065
Re-introducing the test changes with the passed ci check with ignore …
Rd4dev Jun 29, 2024
c15d6e7
Trying out other unit of processTimeout value
Rd4dev Jun 29, 2024
f417bda
Do not merge - Updated WAIT_PROCESS_TIMEOUT_MS to x4
Rd4dev Jun 29, 2024
70378d6
Using a smaller / simpler source and test file to check if this still…
Rd4dev Jun 29, 2024
9dbd7be
Commenting out 1 of 2 newly added tests
Rd4dev Jun 29, 2024
f59c768
Using a simpler test and source file for sampleTestsDefaultFormat to …
Rd4dev Jun 29, 2024
f5663d7
Using a simpler test and source file for scriptTestsMarkdownFormat to…
Rd4dev Jun 29, 2024
bab336e
Checking if remvoing the 2nd test case solves the timeout to confirm
Rd4dev Jun 29, 2024
2ee1bba
Reverting back to original changes
Rd4dev Jun 29, 2024
23b15b7
Trying to see if moving the declration to setup could reduce load
Rd4dev Jun 29, 2024
6f30dac
Moving scripts source and test files to setup
Rd4dev Jun 29, 2024
b391b1c
Removed any duplicate coverage file creations as they were already in…
Rd4dev Jun 29, 2024
f684951
Almost making compute affected tests execution time to 1 millisecond …
Rd4dev Jun 29, 2024
100d8f1
The actual compute affected test do reflect processTimeout
Rd4dev Jun 29, 2024
4f2d93f
Removing lazy declaration to see if command Executor works that way
Rd4dev Jun 29, 2024
9886da4
Initialize command Executor reference
Rd4dev Jun 29, 2024
4f5d47c
Import CommandExecutor statement added
Rd4dev Jun 29, 2024
69d4583
Added arg names to script calls
Rd4dev Jun 29, 2024
e82f2fd
Trying to make it die in 1L to see if there are any actual reflection…
Rd4dev Jun 29, 2024
a757fd9
Increasing the processTimeout and commandExecutor to high values
Rd4dev Jun 29, 2024
f215839
Setting default and only option as 100L in RunCoverage
Rd4dev Jun 29, 2024
d3105cd
Attempting with main caLL
Rd4dev Jun 29, 2024
f4b305f
Intentionally causing delay in computeAffectedTestsTest to see if pro…
Rd4dev Jun 30, 2024
d78df95
Bumping time to 550 because 350 worked
Rd4dev Jun 30, 2024
c1bfbe1
Completely cleaned up RunCoverageTest for checking with just one test…
Rd4dev Jun 30, 2024
043fcfc
Making RunCoverage default to 0 while passing processTimeout value
Rd4dev Jun 30, 2024
9e3a16a
Intentionally making RunCoverageTest sleep
Rd4dev Jun 30, 2024
f40793c
Last commit overrided the processTimeout with 10 minutes while defaul…
Rd4dev Jun 30, 2024
8d6a10f
Defaulting processTimeout to 1
Rd4dev Jun 30, 2024
1a69432
Reverting all local changes
Rd4dev Jun 30, 2024
9437d67
Adding test timeout, yet this is for failures just trying out
Rd4dev Jun 30, 2024
3787ea9
Intentionally delaying in MavenDependenciesListCheck to see if same e…
Rd4dev Jun 30, 2024
7ad2668
Importing kotlin coroutines
Rd4dev Jun 30, 2024
876152d
Tried delaying in MavenDependenciesCheckTest and that still passes
Rd4dev Jun 30, 2024
0e99588
Testing timeouts
Rd4dev Jun 30, 2024
67e5fb9
Adding withTimeout to see if it can allow the coroutine to run upto t…
Rd4dev Jun 30, 2024
35e79da
Using longCommandExecutor
Rd4dev Jun 30, 2024
2abf259
Adding --test_timeout flag to bazel test run
Rd4dev Jun 30, 2024
3123047
Reverting to old sample test removing fibonacci test
Rd4dev Jun 30, 2024
c6cf052
Fixed the testRunCoverage_invalidFormat_throwsException by updating t…
Rd4dev Jun 30, 2024
f967850
Bumping up the default processTimeout for RunCoverage to 20 MINUTES
Rd4dev Jun 30, 2024
f1f24f0
Fixed ignoreCaseHTMLArgument test case with proper file creation and …
Rd4dev Jul 1, 2024
935662f
Fixed lint checks for max line length
Rd4dev Jul 1, 2024
eab7f1a
Fixed lint checks for max line length
Rd4dev Jul 1, 2024
4526517
Setting a timeout of 600seconds on both bazel tests and processTimeout
Rd4dev Jul 1, 2024
8ec6b7c
Adding --test_timeout to coverage executor
Rd4dev Jul 1, 2024
fe642a6
Reverting the addition of timeout in bazel execute as that wasn't ref…
Rd4dev Jul 1, 2024
f92e821
Remove redundant code and clean up
Rd4dev Jul 1, 2024
7132b7a
Fixed Lint checks on redundant brances and spaces
Rd4dev Jul 1, 2024
5cffdc4
Fixed testRunCoverage_localTestsMarkdownFormat_returnsCoverageData te…
Rd4dev Jul 1, 2024
e38c940
Fix testRunCoverage_ignoreCaseHTMLArgument_returnsCoverageData test w…
Rd4dev Jul 1, 2024
a136d86
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 1, 2024
073599d
Added print statment for exemption test file scenario
Rd4dev Jul 5, 2024
fecb7d9
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 5, 2024
f9d1910
Fix Test file exemption test case and simplified print and return sta…
Rd4dev Jul 5, 2024
2e47173
Fix static check - needless blank line
Rd4dev Jul 5, 2024
a724461
Calculate an aggregated coverage report for many : one test target files
Rd4dev Jul 6, 2024
5f19114
Generating reports with aggregated coverage report instead of list of…
Rd4dev Jul 6, 2024
9f9f9c6
Updated tests for multiple test target and restyles/formatted the htm…
Rd4dev Jul 6, 2024
5f9ae7a
Code cleanup - removed debugging statments, kept the mock multi cover…
Rd4dev Jul 6, 2024
45067f7
Code cleanup and fix lint checks for missing spaces
Rd4dev Jul 6, 2024
b3e4c0f
Updated the visibility of the calculateAggregateCoverageReport function
Rd4dev Jul 6, 2024
2bca7e0
Fix Lint check max line lenght exceeded
Rd4dev Jul 6, 2024
c367957
Triggering CI due to error with repo fetching and insufficient write …
Rd4dev Jul 6, 2024
1929c74
Retriggering CI builds as the test pass locally and suspecting any do…
Rd4dev Jul 6, 2024
c5c11f6
Retriggering CI builds :/ just to see if the issue still persists
Rd4dev Jul 7, 2024
2ac7b04
Fixed the asynchronous flow, which was earlier not actually running a…
Rd4dev Jul 7, 2024
5a57677
Fix Lint check, code clean up and removed the static test targets
Rd4dev Jul 7, 2024
a09057b
Added missed Deferred import
Rd4dev Jul 7, 2024
49b8e0f
Moving the coverage analysis to a else condition removing return
Rd4dev Jul 7, 2024
179e8a7
Replaced the TwoSum sample test class name with AddNums
Rd4dev Jul 7, 2024
f82c35c
Fix Lint check max line length exceeded
Rd4dev Jul 7, 2024
c38f2e8
Updated sha hash value as the sample test class name was changed
Rd4dev Jul 7, 2024
a811947
Retriggering CI builds as latest build crashed or didn't report properly
Rd4dev Jul 7, 2024
19c3be4
Cleaning up the mock data from last PR to start off
Rd4dev Jul 7, 2024
fad70b8
Raw messy implementation that works with list of files but not asynch…
Rd4dev Jul 7, 2024
2ba6dba
Messy Reference point of asynchronous workflow with many : 1 test tar…
Rd4dev Jul 7, 2024
b102076
Replace error statements with failed coverage reports to not stop the…
Rd4dev Jul 9, 2024
3ed5595
First round of clean up and introduced MIN THRESHOLD and Coverage Che…
Rd4dev Jul 9, 2024
dd918ea
Updated the md text report template for uploading as a comment with s…
Rd4dev Jul 9, 2024
e784657
Used kotlin idiomatic way to check for requirements and corrected Cam…
Rd4dev Jul 9, 2024
56809bf
Your commit message here
Rd4dev Jul 9, 2024
48c9d1b
Retriggering ci checks to see if the error on downloading remote jdk …
Rd4dev Jul 10, 2024
b814d15
Updated MD report template, cleanups and refactorings
Rd4dev Jul 10, 2024
4d5c21f
Fix Lint checks, resolved todos
Rd4dev Jul 10, 2024
4c87573
Specifying jdk version for TestBazelWorkspace build to see if this is…
Rd4dev Jul 10, 2024
3d810b2
Update TestBazelWorkspace tests to include jdk version in the bazelrc…
Rd4dev Jul 10, 2024
595e9df
Fix Lint checks on indentation
Rd4dev Jul 10, 2024
4bc533f
Refactored execute's return value to unit
Rd4dev Jul 11, 2024
ba16aaf
Refactor to take in a list of file paths as args for both cli and ci
Rd4dev Jul 11, 2024
138a141
Reverting --test_timeout flag to see other possible fixes
Rd4dev Jul 11, 2024
75e28e2
Add size large to RunCoverageTest to set timeout to 900 seconds
Rd4dev Jul 11, 2024
9da53d9
Updated tests to changes in taking in as a list of files as args
Rd4dev Jul 12, 2024
aaf3caf
Resolve merge conflict after test timeout and fetch error fixes in ed…
Rd4dev Jul 12, 2024
53d3d79
Resolve merge conflict after test timeout and fetch error fixes in ed…
Rd4dev Jul 12, 2024
d3eb372
Updated processTimeout to set as standard 5 minutes and moved outCont…
Rd4dev Jul 12, 2024
9b5995e
Merge branch 'code_coverage_fix_edge_cases' of https://github.com/opp…
Rd4dev Jul 12, 2024
fcf365e
Fix Lint checks, kdoc checks and updated tests for CoverageRunner, Co…
Rd4dev Jul 12, 2024
7f1bda0
Update tests for list of files as args implementation
Rd4dev Jul 12, 2024
6710f66
Retriggering since localTestHtmlFormat pass locally and to confirm if…
Rd4dev Jul 12, 2024
756bed8
Adding shard_count to see if that is making any difference
Rd4dev Jul 12, 2024
ab60123
Addition of dividing tests with shards did help with ci checks, now r…
Rd4dev Jul 12, 2024
d25ea9c
Adding back shards since that significantly lessens the test run time…
Rd4dev Jul 12, 2024
8802b27
Merge branch 'code_coverage_fix_edge_cases' of https://github.com/opp…
Rd4dev Jul 12, 2024
7a2f66b
Merge branch 'code_coverage_many_to_one_targets' of https://github.co…
Rd4dev Jul 12, 2024
66a387e
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 13, 2024
50574ae
Merge branch 'code_coverage_fix_edge_cases' of https://github.com/opp…
Rd4dev Jul 13, 2024
f170487
Changed base branch to develop in the repo and added reference comment
Rd4dev Jul 13, 2024
a720fe7
Updated Tests and the code now fails with Coverage Check Status
Rd4dev Jul 15, 2024
5c527a9
Resolve conflict with upstream many to one target branch
Rd4dev Jul 15, 2024
4350f5e
Fix failing test cases with changes to list of files and lint fixes
Rd4dev Jul 15, 2024
6fed0c0
Refactored runCoverageForFile generation separate function and added …
Rd4dev Jul 15, 2024
5e17837
Incrementing the shard count to 12 since the tests timeout in ci
Rd4dev Jul 15, 2024
bae304a
Decrementing the shard count to 8 to not cause overhead of resources,…
Rd4dev Jul 15, 2024
b0432f1
Reverting shards count to 4 but doubt if the cases are cached
Rd4dev Jul 15, 2024
f6fa8af
Incrementing the shard count to 6 since the tests timeout in ci with …
Rd4dev Jul 15, 2024
8955775
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 24, 2024
10d9acd
Updated the sharedAndLocalTest case to sync in with updated multi tar…
Rd4dev Jul 24, 2024
77e0149
Resolved conflicts on sync with code_coverage_many_to_one_targets branch
Rd4dev Jul 24, 2024
e0d1afe
Clean up - Removed the Raw data path print statement
Rd4dev Jul 24, 2024
be8ff1c
Removing the mock data for multi target aggregation implementation
Rd4dev Jul 26, 2024
7d76b89
Added test cases for coverage data missing and retrieval failure cases
Rd4dev Jul 26, 2024
c2eddfb
Trigger Build since ExplorationActiveTimeControllerTest seems to fail
Rd4dev Jul 26, 2024
07e6fad
Syncing in with upstream many to one targets
Rd4dev Jul 27, 2024
5479330
Removing all the asynchronous calls to make it sequential
Rd4dev Jul 28, 2024
24390f5
Updated CoverageRunnerTest after sequential flow
Rd4dev Jul 28, 2024
ffe7768
Removed asynchronous flow in both source and test files for CoverageR…
Rd4dev Jul 28, 2024
8e88c35
Renaming the runWithCoverageAsync to runCoverageForTestTarget, update…
Rd4dev Jul 28, 2024
c1f012c
Trying to find the coverage path with regex pattern as they mismatch
Rd4dev Jul 29, 2024
aa0de7f
Save lobby before switching to a side branch to test permission error…
Rd4dev Jul 29, 2024
800ccda
Trying to hit a certain line n number of times in different ways yet …
Rd4dev Jul 29, 2024
ad611b8
Reverted changes with sample test data that were added for testing pu…
Rd4dev Jul 29, 2024
84c5336
Reverting the shard count to 4 which was introducing while testing
Rd4dev Jul 29, 2024
5561b4e
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Jul 29, 2024
07184ee
Lint fixes for exceeding max line length
Rd4dev Jul 29, 2024
3974ce0
Fixes Missing Coverage Data Test Case
Rd4dev Jul 29, 2024
360dc4b
Fixed the retrieve coverage failure test case :) by reproducing the s…
Rd4dev Jul 30, 2024
565f2f5
Clean up and refactored the test cases
Rd4dev Jul 30, 2024
bd96fa3
Resolved conflict with upstream many to one targets merge
Rd4dev Jul 30, 2024
2e04f8a
Added functionality to also include source files of the test files to…
Rd4dev Jul 30, 2024
e6c506e
Isolated the sharedTest source File detection with test source File d…
Rd4dev Jul 30, 2024
0353897
Tiny clean up for finding the source file list
Rd4dev Jul 30, 2024
b749916
Added a new proto Coverage Report Container to hold all the coverage …
Rd4dev Jul 30, 2024
a35d7a0
Save lobby - Collecting protos into one coverage report container pro…
Rd4dev Jul 31, 2024
05a007b
Updating the coverage missing test case while removing the job and re…
Rd4dev Jul 31, 2024
a3a661e
Clean up and changed the test case names to be more specific on what …
Rd4dev Jul 31, 2024
8a12cf4
Added validation to ensure exactly one unique value of filePath and f…
Rd4dev Jul 31, 2024
e72179a
Clean up of aggreagation code and replaced conditional error statment…
Rd4dev Jul 31, 2024
f00ebc6
Removed the mock data used for coverage report with n:1 file target a…
Rd4dev Jul 31, 2024
2fa9737
Resolve merge conflicts with changes to upstream one to may targets b…
Rd4dev Jul 31, 2024
8b2415e
Hardcoded implementation of saving the protos to their own path
Rd4dev Jul 31, 2024
b0839ca
New proto structure for coverage to having distinct case for success …
Rd4dev Aug 1, 2024
d9ef7d8
Roughly organized layout / implementation of the flow of the protos a…
Rd4dev Aug 1, 2024
333607e
Re-writing the CoverageReporter script to handle the container proto …
Rd4dev Aug 1, 2024
b17e0d1
First set of cleanup with coverage reporter implemented
Rd4dev Aug 1, 2024
824c406
Reference point for mock data with new repeated bazel test target pro…
Rd4dev Aug 1, 2024
5ee99c0
Clean up and simplification of usage of single usage entry
Rd4dev Aug 1, 2024
372ae95
Fix lint checks and failing test case with update to the proto strucu…
Rd4dev Aug 1, 2024
6499311
Added missing import for BazelTestTarget
Rd4dev Aug 1, 2024
aa68b95
Final md report generation with failure, details - 1. failure below t…
Rd4dev Aug 2, 2024
5e0da59
Refactored CoverageReporter into unit functionalities and avoid repet…
Rd4dev Aug 2, 2024
bcb0bf2
Added parameter to save the proto to the path specified
Rd4dev Aug 2, 2024
8ff593f
Added Coverage Check Status that check through every fail and details…
Rd4dev Aug 2, 2024
9b2f0d8
Added a helper method to calculate coverage percentages
Rd4dev Aug 2, 2024
40b5f14
Updated tests for Coverage Runner Test
Rd4dev Aug 2, 2024
257e434
Added test case for CoverageReporter to test success detail, falure a…
Rd4dev Aug 2, 2024
a63a4d0
Added test case for CoverageReporter to test success detail, falure a…
Rd4dev Aug 2, 2024
edfd42d
Added combined success failure and exempted test file cases
Rd4dev Aug 2, 2024
91cd498
Updated RunCoverageTest test cases with new rewritten report implemen…
Rd4dev Aug 4, 2024
a4d5e58
Resolve merge conflicts with changes to upstream proto BazelTestTarge…
Rd4dev Aug 4, 2024
b41ad71
Fix lint checks indents and max line lengths
Rd4dev Aug 4, 2024
db74fee
Fix test with unresolved bazel test target list, added kdoc
Rd4dev Aug 4, 2024
d7ab04d
Fix failing test cases, lint checks indents, missing new lines and ma…
Rd4dev Aug 4, 2024
e5da141
Fix failing test with absence of trimEnd
Rd4dev Aug 4, 2024
c847231
Conditional new line additions; with next commits replace them with a…
Rd4dev Aug 4, 2024
2172905
Replaced appendLine with append to use \n in line
Rd4dev Aug 4, 2024
2ff0bda
Fix Tests with Failure cases and used the public const MIN_THRESHOLD …
Rd4dev Aug 4, 2024
61accfb
Kdoc checks and fix test with list of files
Rd4dev Aug 4, 2024
eef9618
Added Coverage Check Status to entire check and md report
Rd4dev Aug 4, 2024
aed8081
Refactored new lines in tests and added Coverage status to test templ…
Rd4dev Aug 4, 2024
4293d43
Fix failing tests with color codes and new line missing
Rd4dev Aug 5, 2024
d93762e
Updated test failure with appropriate failure type in test cases
Rd4dev Aug 5, 2024
75048d2
Fix failing test cases with missing new line
Rd4dev Aug 5, 2024
a294810
Bumping shard_count to 24 that got overriden with merge
Rd4dev Aug 5, 2024
d1ceedd
Added new tests with failing cases and new types of reports
Rd4dev Aug 5, 2024
464840c
Fix Lint check removed unused imports
Rd4dev Aug 5, 2024
7d875a9
Readding the shard count, removing while local testing
Rd4dev Aug 5, 2024
8c35412
Refactored log report to log only the failed coverage report to avoid…
Rd4dev Aug 5, 2024
d9358fd
Fixed Kdoc issues and redundant quotes
Rd4dev Aug 5, 2024
5e528fe
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Aug 6, 2024
e72eec3
Added the copy of local and shared test to ensure the multiple test f…
Rd4dev Aug 6, 2024
49d2029
Resolve merge conflict with upstream RunCoverageTest
Rd4dev Aug 6, 2024
226f8b6
Added test to verify that the final container is saved to output prot…
Rd4dev Aug 6, 2024
223c266
Save lobby for proto extraction and storage
Rd4dev Aug 6, 2024
8aa42bb
Added test case to verify one single line hit my multiple targets of …
Rd4dev Aug 6, 2024
871a48e
Updated the Final coverage report template as suggested. This introdu…
Rd4dev Aug 7, 2024
2221bad
Updated tests with updated md template and fixed few review comments
Rd4dev Aug 7, 2024
c670ec3
Reverting the shard count change for ci run
Rd4dev Aug 7, 2024
45ee041
Resolve merge conflicts with upstream one to many targets :(
Rd4dev Aug 7, 2024
9b01b54
Save lobby while fixing tests as they take too long
Rd4dev Aug 7, 2024
2f11be3
Fixed test cases with Coverage Reporter and also added test cases cor…
Rd4dev Aug 8, 2024
667ed45
Fix failing test with CoverageRunnerTest due to incorrect target spec…
Rd4dev Aug 8, 2024
09277b6
Fixing test cases part 1 - md report template changes
Rd4dev Aug 8, 2024
0738388
Fix Lint checks majorly formattings
Rd4dev Aug 8, 2024
bdddfd5
Fix tests part 2 - exceptions and templates
Rd4dev Aug 8, 2024
9400e9e
Fix Tests part 3 - remove unnecessary lines
Rd4dev Aug 8, 2024
5d6b16b
Fix test after bumping min threshold to 70
Rd4dev Aug 8, 2024
0f3309c
Fix tests part 4 - with template and min threshold changes :|
Rd4dev Aug 8, 2024
ad5aa58
Fix Lint check Remove needless blank line
Rd4dev Aug 8, 2024
fed6a79
Brought in changes from the exempt-test-targets-incompatible-with-cod…
Rd4dev Aug 8, 2024
d8d121e
Fix Lint check missing space after =
Rd4dev Aug 8, 2024
cba7a13
Triggering ci since many checks seem to fail after update
Rd4dev Aug 8, 2024
dad1370
Remove old implementation for collecting data
Rd4dev Aug 8, 2024
83836bc
Fix failing test cases with changes from pull from exemptions pr
Rd4dev Aug 8, 2024
d1307c9
Added tests for BazelClient and Missing Build declarations inclusions
Rd4dev Aug 9, 2024
2639294
Fix Lint checks max line legth
Rd4dev Aug 9, 2024
013c951
Merge with develop branch
Rd4dev Aug 9, 2024
b8b70ed
Reordering the coverage output
Rd4dev Aug 9, 2024
743024d
Readjusted the bazel client test output
Rd4dev Aug 9, 2024
0801ea5
Updated md template with replacing the file name links with the detai…
Rd4dev Aug 9, 2024
ac2f97e
Moved exempted list too to a details summary as they too might grow big
Rd4dev Aug 9, 2024
f951993
Updated tests to reflect changes in md report with replacement of lin…
Rd4dev Aug 9, 2024
fdf274a
Updated with suggested edits in the review
Rd4dev Aug 9, 2024
dc47fc6
Removed parsing of the pb file in the Coverage Reporter Test
Rd4dev Aug 9, 2024
bc7054b
Fix failing tests and lint checks
Rd4dev Aug 9, 2024
2d4b338
Fixed a flaky test, expected it to be since the order depends on the …
Rd4dev Aug 9, 2024
12e9f3e
Fix Lint check indentation
Rd4dev Aug 9, 2024
28593b5
Merge and resolving with upstream after incompatible files are exempted
Rd4dev Aug 10, 2024
7949695
Resolve conflict with coverage BUILD
Rd4dev Aug 10, 2024
8839a01
Updated tests with source incompatible exemption changes
Rd4dev Aug 10, 2024
a970df2
Fix Tests after merging with upstream exemptions
Rd4dev Aug 10, 2024
ea1be84
Storing the protos to their respective file name paths and updated it…
Rd4dev Aug 10, 2024
fa85aa6
Fix tests with saving proto - yet to confirm test case with changes t…
Rd4dev Aug 10, 2024
3377795
Added log statement for md report path
Rd4dev Aug 10, 2024
73231c5
Fix failing test with additional message missing errors
Rd4dev Aug 10, 2024
7a8f32f
Fix failing tests with high Coverage Exemption
Rd4dev Aug 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions scripts/src/java/org/oppia/android/scripts/common/BazelClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,38 +133,37 @@ class BazelClient(private val rootDirectory: File, private val commandExecutor:
/**
* Runs code coverage for the specified Bazel test target.
*
* Null return typically occurs when the coverage command fails to generate the 'coverage.dat' file
* This can happen due to: Test failures or misconfigurations that prevent the coverage data
* from being generated properly.
* An empty list being returned typically occurs when the coverage command fails to generate any
* 'coverage.dat' file. This can happen due to tests failures or a misconfiguration that prevents
* the coverage data from being properly generated.
*
* @param bazelTestTarget Bazel test target for which code coverage will be run
* @return the generated coverage data as a list of strings
* or null if the coverage data file could not be parsed
* @return the generated coverage data as a list of list of strings (since there may be more than
* one file corresponding to a single test target, e.g. in the case of a sharded test), or an
* empty list if no coverage data was found while running the test
*/
fun runCoverageForTestTarget(bazelTestTarget: String): List<String>? {
fun runCoverageForTestTarget(bazelTestTarget: String): List<List<String>> {
val instrumentation = bazelTestTarget.split(":")[0]
val computeInstrumentation = instrumentation.split("/").let { "//${it[2]}/..." }
val coverageCommandOutputLines = executeBazelCommand(
"coverage",
bazelTestTarget,
"--instrumentation_filter=$computeInstrumentation"
)
return parseCoverageDataFilePath(coverageCommandOutputLines)?.let { path ->
return parseCoverageDataFilePath(bazelTestTarget, coverageCommandOutputLines).map { path ->
File(path).readLines()
}
}

private fun parseCoverageDataFilePath(coverageCommandOutputLines: List<String>): String? {
val regex = ".*coverage\\.dat$".toRegex()
for (line in coverageCommandOutputLines) {
val match = regex.find(line)
val extractedPath = match?.value?.substringAfterLast(",")?.trim()
if (extractedPath != null) {
println("Raw Coverage Data: $extractedPath")
return extractedPath
}
}
return null
private fun parseCoverageDataFilePath(
bazelTestTarget: String,
coverageCommandOutputLines: List<String>
): List<String> {
// Use the test target as the base path for the generated coverage.dat file since the test
// itself may output lines that look like the coverage.dat line (such as in BazelClientTest).
val targetBasePath = bazelTestTarget.removePrefix("//").replace(':', '/')
val coverageDatRegex = "^.+?testlogs/$targetBasePath/[^/]*?/?coverage\\.dat$".toRegex()
return coverageCommandOutputLines.filter(coverageDatRegex::matches).map(String::trim)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kt_jvm_library(
":coverage_reporter",
":coverage_runner",
"//scripts/src/java/org/oppia/android/scripts/common:bazel_client",
"//scripts/src/java/org/oppia/android/scripts/common:proto_string_encoder",
"//scripts/src/java/org/oppia/android/scripts/proto:script_exemptions_java_proto",
],
)
Expand Down Expand Up @@ -42,5 +43,6 @@ kt_jvm_library(
deps = [
"//scripts/src/java/org/oppia/android/scripts/common:bazel_client",
"//scripts/src/java/org/oppia/android/scripts/proto:coverage_java_proto",
"//scripts/src/java/org/oppia/android/scripts/proto:script_exemptions_java_proto",
],
)
Loading
Loading