Code coverage of Java |
|||||
Issue descriptionIt would be quite useful if Java can also be included in the code coverage tools. I understand that the underlying technology is quite different, so this wouldn't be easy to implement.
,
Jun 13 2018
+agrieve, who it seems fixed these bots last, and current Clank build sheriffs FYI.
Here is the compile failure from the most recent build - it appears to be in r8 code during dexing:
FAILED: gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar
python ../../build/android/gyp/dex.py --depfile gen/chrome/android/third_party/compositor_animator/compositor_animator_java__dex.d --dex-path gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar --d8-jar-path ../../third_party/r8/lib/d8.jar
Traceback (most recent call last):
File "../../build/android/gyp/dex.py", line 209, in <module>
sys.exit(main(sys.argv[1:]))
File "../../build/android/gyp/dex.py", line 205, in main
depfile_deps=input_paths)
File "/b/build/slave/coverage-phone/build/src/build/android/gyp/util/build_utils.py", line 628, in CallAndWriteDepfileIfStale
pass_changes=True)
File "/b/build/slave/coverage-phone/build/src/build/android/gyp/util/md5_check.py", line 87, in CallAndRecordIfStale
function(*args)
File "/b/build/slave/coverage-phone/build/src/build/android/gyp/util/build_utils.py", line 611, in on_stale_md5
function(*args)
File "../../build/android/gyp/dex.py", line 192, in on_stale_md5_callback
_RunD8(dex_cmd, paths, options.dex_path)
File "../../build/android/gyp/dex.py", line 138, in _RunD8
build_utils.CheckOutput(dex_cmd, print_stderr=False)
File "/b/build/slave/coverage-phone/build/src/build/android/gyp/util/build_utils.py", line 210, in CheckOutput
raise CalledProcessError(cwd, args, stdout + stderr)
util.build_utils.CalledProcessError: Command failed: ( cd /b/build/slave/coverage-phone/build/src/out/Debug; java -jar ../../third_party/r8/lib/d8.jar --output gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar )
Warning in lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar:org/chromium/chrome/browser/compositor/animation/FloatProperty.class:
Type `java.lang.reflect.Array` was not found, it is required for default or static interface methods desugaring of `boolean[][] org.chromium.chrome.browser.compositor.animation.FloatProperty.$VRi()`
Warning in lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar:org/chromium/chrome/browser/compositor/animation/FloatProperty.class:
Type `com.vladium.emma.rt.RT` was not found, it is required for default or static interface methods desugaring of `boolean[][] org.chromium.chrome.browser.compositor.animation.FloatProperty.$VRi()`
Compilation failed with an internal error.
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at com.android.tools.r8.ir.conversion.JarState$LocalsAtOffset.addEnd(JarState.java:111)
at com.android.tools.r8.ir.conversion.JarState.populateLocalsAtTable(JarState.java:363)
at com.android.tools.r8.ir.conversion.JarState.<init>(JarState.java:320)
at com.android.tools.r8.ir.conversion.JarSourceCode.<init>(JarSourceCode.java:209)
at com.android.tools.r8.graph.JarCode.internalBuild(JarCode.java:144)
at com.android.tools.r8.graph.JarCode.internalBuildWithLocals(JarCode.java:126)
at com.android.tools.r8.graph.JarCode.buildIR(JarCode.java:101)
at com.android.tools.r8.graph.DexEncodedMethod.buildIR(DexEncodedMethod.java:221)
at com.android.tools.r8.ir.conversion.IRConverter.rewriteCode(IRConverter.java:523)
at com.android.tools.r8.ir.conversion.IRConverter.convertMethodToDex(IRConverter.java:331)
at com.android.tools.r8.ir.conversion.IRConverter$$Lambda$23/1201004330.accept(Unknown Source)
at com.android.tools.r8.graph.DexClass.forEachMethodThrowing(DexClass.java:133)
at com.android.tools.r8.ir.conversion.IRConverter.lambda$convertClassesToDex$2(IRConverter.java:318)
at com.android.tools.r8.ir.conversion.IRConverter$$Lambda$22/1740000325.call(Unknown Source)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
,
Jun 13 2018
I can take a look at the current failure
,
Jun 13 2018
Hmm, doesn't seem to be caused d8 desugaring - passing the --no-desugaring slightly changes the error:
[18/18] ACTION //chrome/android/third_party/compositor_animator:compositor_animator_java__dex(//build/toolchain/android:android_clang_arm)
FAILED: gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar
python ../../build/android/gyp/dex.py --depfile gen/chrome/android/third_party/compositor_animator/compositor_animator_java__dex.d --dex-path gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar --d8-jar-path ../../third_party/r8/lib/d8.jar
Traceback (most recent call last):
File "../../build/android/gyp/dex.py", line 209, in <module>
sys.exit(main(sys.argv[1:]))
File "../../build/android/gyp/dex.py", line 205, in main
depfile_deps=input_paths)
File "/usr/local/google/code/clankium/src/build/android/gyp/util/build_utils.py", line 628, in CallAndWriteDepfileIfStale
pass_changes=True)
File "/usr/local/google/code/clankium/src/build/android/gyp/util/md5_check.py", line 87, in CallAndRecordIfStale
function(*args)
File "/usr/local/google/code/clankium/src/build/android/gyp/util/build_utils.py", line 611, in on_stale_md5
function(*args)
File "../../build/android/gyp/dex.py", line 192, in on_stale_md5_callback
_RunD8(dex_cmd, paths, options.dex_path)
File "../../build/android/gyp/dex.py", line 138, in _RunD8
build_utils.CheckOutput(dex_cmd, print_stderr=False)
File "/usr/local/google/code/clankium/src/build/android/gyp/util/build_utils.py", line 210, in CheckOutput
raise CalledProcessError(cwd, args, stdout + stderr)
util.build_utils.CalledProcessError: Command failed: ( cd /usr/local/google/code/clankium/src/out/Debug; java -jar ../../third_party/r8/lib/d8.jar --no-desugaring --output gen/chrome/android/third_party/compositor_animator/compositor_animator_java.dex.jar lib.java/chrome/android/third_party/compositor_animator/compositor_animator_java.jar )
Compilation failed with an internal error.
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at com.android.tools.r8.ir.conversion.JarState$LocalsAtOffset.addEnd(JarState.java:111)
at com.android.tools.r8.ir.conversion.JarState.populateLocalsAtTable(JarState.java:363)
at com.android.tools.r8.ir.conversion.JarState.<init>(JarState.java:320)
at com.android.tools.r8.ir.conversion.JarSourceCode.<init>(JarSourceCode.java:209)
at com.android.tools.r8.graph.JarCode.internalBuild(JarCode.java:144)
at com.android.tools.r8.graph.JarCode.internalBuildWithLocals(JarCode.java:126)
at com.android.tools.r8.graph.JarCode.buildIR(JarCode.java:101)
at com.android.tools.r8.graph.DexEncodedMethod.buildIR(DexEncodedMethod.java:221)
at com.android.tools.r8.ir.conversion.IRConverter.rewriteCode(IRConverter.java:523)
at com.android.tools.r8.ir.conversion.IRConverter.convertMethodToDex(IRConverter.java:331)
at com.android.tools.r8.graph.DexClass.forEachMethodThrowing(DexClass.java:133)
at com.android.tools.r8.ir.conversion.IRConverter.lambda$convertClassesToDex$2(IRConverter.java:318)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1430)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
ninja: build stopped: subcommand failed.
,
Jun 13 2018
Not really sure what is happening here. Filed a bug b/110164501 with d8 to see.
,
Aug 30
Fixed here https://r8-review.googlesource.com/c/r8/+/24240. Planning to wait until 1.2 goes to stable and then I'll update the jar from https://mvnrepository.com/artifact/com.android.tools/r8.
,
Sep 11
Issue 863387 has been merged into this issue.
,
Oct 3
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/bf9f06ecd6399fec7931fa6b6af02d6261c10600 commit bf9f06ecd6399fec7931fa6b6af02d6261c10600 Author: Eric Stevenson <estevenson@chromium.org> Date: Wed Oct 03 16:06:54 2018 Android: Update d8 to 1.2.48. Includes fix for supporting asserts and invalid locals information. Bug: 843307 Change-Id: Iec4ecb2981e8c895e728127179d3b0eb54f09b14 Reviewed-on: https://chromium-review.googlesource.com/c/1258963 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Eric Stevenson <estevenson@chromium.org> Cr-Commit-Position: refs/heads/master@{#596239} [modify] https://crrev.com/bf9f06ecd6399fec7931fa6b6af02d6261c10600/DEPS [modify] https://crrev.com/bf9f06ecd6399fec7931fa6b6af02d6261c10600/third_party/r8/README.chromium [modify] https://crrev.com/bf9f06ecd6399fec7931fa6b6af02d6261c10600/third_party/r8/cipd.yaml
,
Oct 3
This is great! I also reached out to clank-team yesterday regarding Java coverage. Do we want to switch to Jacoco or stick with emma? (Jacoco is developed to replace emma)
,
Oct 5
Followed the steps at https://chromium.googlesource.com/chromium/src/+/master/build/android/docs/coverage.md and confirmed that with the d8 fix coverage is working now (locally at least). Seems like we'd want to update to Jacoco if we're planning on making coverage useful for developers. I can probably help with any build changes we need to make to get coverage working.
,
Oct 5
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by awdf@chromium.org
, Jun 13 2018Labels: Hotlist-CodeHealth