build: Fix JUnit4TestNotRun errorprone warning
The `chrome_junit_sig` build speed benchmark was failing static analysis
due to an errorprone `JUnit4TestNotRun` warning. This was caused by
adding a public method to a test class without a `@Test` annotation.
This change fixes the warning by adding `@org.junit.Ignore` to the
injected method signature.
Additionally, `timeall.py` is updated to run the non-server build first
in debug mode. This ensures static analysis checks are run, catching
these types of issues earlier.
Bug: 465514549
Change-Id: Ibb3e828df3714e2c0135b5d9e7d2ab7414c3c9a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7247346
Commit-Queue: Peter Wen <[email protected]>
Reviewed-by: Henrique Nakashima <[email protected]>
Auto-Submit: Peter Wen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1557478}
NOKEYCHECK=True
GitOrigin-RevId: 94b5b8f4b3510206462125c7e348ed9dfdc7afdc
diff --git a/build_speed/benchmark.py b/build_speed/benchmark.py
index d104362..4d09eb4 100755
--- a/build_speed/benchmark.py
+++ b/build_speed/benchmark.py
@@ -231,8 +231,9 @@
Benchmark(
name='chrome_junit_sig',
from_string='@Mock Profile mProfile;',
+ # @org.junit.Ignore to avoid the JUnit4TestNotRun errorprone warning.
to_string=
- 'public void NewInterface<sub>Method(){};@Mock Profile mProfile;', # pylint: disable=line-too-long
+ '@org.junit.Ignore public void NewInterface<sub>Method(){};@Mock Profile mProfile;', # pylint: disable=line-too-long
change_file=
'chrome/android/junit/src/org/chromium/chrome/browser/ExampleRobolectricTest.java', # pylint: disable=line-too-long
can_run=True,
diff --git a/build_speed/timeall.py b/build_speed/timeall.py
index d6a8553..14b3f4a 100755
--- a/build_speed/timeall.py
+++ b/build_speed/timeall.py
@@ -148,7 +148,8 @@
incremental_opts = [True, False]
nocomponent_opts = [True, False]
- server_opts = [True, False]
+ # Use False first for --debug to ensure static analysis pass.
+ server_opts = [False, True]
benchmark_options = []
for benchmark, emulator in itertools.product(benchmarks, emulators):
diff --git a/build_speed/timeall_unittest.py b/build_speed/timeall_unittest.py
index 1bdcbe6..5fcc9e1 100755
--- a/build_speed/timeall_unittest.py
+++ b/build_speed/timeall_unittest.py
@@ -227,7 +227,7 @@
self.assertEqual(options.e, '')
self.assertTrue(options.i)
self.assertTrue(options.n)
- self.assertTrue(options.s)
+ self.assertFalse(options.s)
@unittest.mock.patch('random.choice',
return_value='android_31_google_apis_x64_local.textpb')
@@ -248,7 +248,7 @@
self.assertEqual(first_options.e, '')
self.assertTrue(first_options.i)
self.assertTrue(first_options.n)
- self.assertTrue(first_options.s)
+ self.assertFalse(first_options.s)
last_options = benchmark_options[-1]
self.assertEqual(last_options.benchmark, 'cta_test_sig')
@@ -257,7 +257,7 @@
'android_31_google_apis_x64_local.textpb')
self.assertTrue(last_options.i)
self.assertFalse(last_options.n)
- self.assertFalse(last_options.s)
+ self.assertTrue(last_options.s)
if __name__ == '__main__':