Closed Bug 1399396 Opened 9 years ago Closed 1 month ago

Support code coverage builds on Android

Categories

(Testing :: Code Coverage, enhancement)

enhancement

Tracking

(firefox157 fixed)

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: marco, Assigned: nicolas.guichard)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 5 external files)

This should not be too different from Linux. I don't know much about the way tests work on Android though, I don't know if there are problems accessing the gcda files.
(In reply to Marco Castelluccio [:marco] from comment #0) > This should not be too different from Linux. Out of curiosity, what about the Android-specific Java code?
(In reply to Jan Henning [:JanH] from comment #1) > (In reply to Marco Castelluccio [:marco] from comment #0) > > This should not be too different from Linux. > > Out of curiosity, what about the Android-specific Java code? It will be different, this is only about the C/C++ code.
I think given the lack of Mozilla development resources on Android, we should assume Android has a lower priority than desktop and only work on it once we have more coverage on desktop.
Attached patch WIP — — Splinter Review
We will require r17 in order to build the coverage build because of https://github.com/android-ndk/ndk/issues/411. Here's a WIP patch.
We've switched from NDK's clang to our own: https://bugzilla.mozilla.org/show_bug.cgi?id=1435409#c4. I've rebased and re-applied your patch with the new clang, here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=66a501ea5a6f3e937977fb8f0673c56fc876205a. Build is failing with: configure:1496:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main(){return(0);} ^ 1 warning generated. /builds/worker/workspace/build/src/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux -androideabi/bin/ld: error: cannot open /builds/worker/workspace/build/src/clang/lib/clang/6.0.1/lib/linux/libclang_rt.profile-arm-android.a: No such file or directory /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_writeout: error: undefined reference to 'llvm_gcda_start_file' /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_writeout: error: undefined reference to 'llvm_gcda_emit_function' /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_writeout: error: undefined reference to 'llvm_gcda_emit_arcs' /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_writeout: error: undefined reference to 'llvm_gcda_summary_info' /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_writeout: error: undefined reference to 'llvm_gcda_end_file' /tmp/conftest-7071d9.o:conftest.c:function __llvm_gcov_init: error: undefined reference to 'llvm_gcov_init' clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) configure: failed program was: #line 1494 "configure" #include "confdefs.h" main(){return(0);} configure: error: installation or configuration problem: C compiler cannot create executables. It appears we don't have compiler-rt installed in that environment. What are the next steps here?
Flags: needinfo?(mcastelluccio)
We are using the linux64-clang toolchain for this build (cross-compiling), so we only have the linux compiler-rt libraries. We need to find a way to build them for Android too (either in the same toolchain build, or in a new one we define). The script used to build Clang/LLVM/compiler-rt is at build/build-clang/build-clang.py.
Flags: needinfo?(mcastelluccio)
See Also: → 1479800
Depends on: 1435409
See Also: → 1480462
Depends on: 1504147
Blocks: 1608236
Severity: normal → S3

Looks like we had ccov and then removed it? Right now we don't get C++ coverage from Android - e.g. widget/android/nsAppShell.cpp gets zero coverage data.

See Also: → 1536044

Java code coverage was removed in bug 1536044 because it was broken. We
still want to have at least C++ coverage for Android so this removes
the Java leftovers to re-enable the C++ coverage in the next commit.

Assignee: nobody → nicolas.guichard
Status: NEW → ASSIGNED

This only enables code coverage for the C++ bits for now.

For Rust I think we would need to add a -dev toolchain for Android to
be able to build with -Zprofile.

For Java we probably need something like JaCoCo.

x.py takes a single comma-separated --target argument

Instrumenting Rust code to gather test coverage data currently requires
compiling with -Zprofile which requires building our own patched Rust
toolchain.

Depends on: 2055621
Attachment #9621573 - Attachment description: Bug 1399396 - repack_rust.py: fix providing multiple targets. r?nalexander! → Bug 1399396 - repack_rust.py: fix providing multiple targets. r?glandium!
Attachment #9621574 - Attachment description: Bug 1399396 - Add Android Rust dev toolchain. r?nalexander! → Bug 1399396 - Add Android Rust dev toolchain. r?glandium!

I missed something and the coverage-instrumented tests aren't actually being run on mozilla-central pushes yet. target_tasks_mozilla_central in target_tasks.py appears to be filtering them out.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

In my Try runs the tests ran but they didn't once my changes landed in
m-c. It appears they were filtered out here.

Status: REOPENED → RESOLVED
Closed: 1 month ago → 1 month ago
Resolution: --- → FIXED
Regressions: 2070387
Regressions: 2070392
Regressions: 2070393
See Also: → 2077159
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: