commit | a094e977bc646b3a5b66421ac688a1bb6e95ab32 | [log] [tgz] |
---|---|---|
author | Jack He <siyuanh@google.com> | Mon Apr 13 02:48:23 2020 -0700 |
committer | Jack He <siyuanh@google.com> | Tue Apr 14 19:23:51 2020 +0000 |
tree | 394e0ed99cd17544b339350d82a030335ff7fe71 | |
parent | 1ac34f7325999c071b0269a7c212e7c5644ff4a5 [diff] |
Cert: Generate backing process code coverage report after test run * Generate line-by-line coverage report after test run using llvm-profdata and llvm-cov in JSON format * Iteratively merge coverage report to the same file for the backing processes of both cert stack and stack under test even when they are using the same binary * Since we cannot run a method after all tests, we have to iteratively merge coverage report into a common file after each test run * llvm-cov and llvm-profdata tool is packaged together with the test ZIP as they have to be the same version when indexing .profraw data Outputs: * Two indexed data files per test run: - GdDevice_cert_stock_backing_process_coverage.profdata - GdDevice_stack_under_test_backing_process_coverage.profdata * Two reports per test run: - GdDevice_cert_stock_backing_process_coverage.json - GdDevice_stack_under_test_backing_process_coverage.json * Two summaries per test run: - GdDevice_cert_stock_backing_process_coverage_summary.txt - GdDevice_stack_under_test_backing_process_coverage_summary.txt * Two raw data files per test class - GdDevice_cert_stock_backing_process_coverage.profraw - GdDevice_stack_under_test_backing_process_coverage.profraw Performance Analysis: * File Sizes: - profraw: around 6MB, 2 generated per test class - profdata: around 400KB, 2 generated per test class - coverage report: around 40MB, 2 generated per test run * Each coverage report takes about 2 seconds and hence 4 seconds per test class. 11 test classes would result in 44 seconds for the whole test suite * Hence, additional 80MB storage and about 50 seconds run time per test run Bug: 153384476 Test: gd/cert/run --host Change-Id: If488f1d1816fb1f9379729ace9d2b0e1a0343233
Just build AOSP - Fluoride is there by default.
Instructions for Ubuntu, tested on 14.04 with Clang 3.5.0 and 16.10 with Clang 3.8.0
mkdir ~/fluoride cd ~/fluoride git clone https://android.googlesource.com/platform/packages/modules/Bluetooth/system
Install dependencies (require sudo access):
cd ~/fluoride/bt build/install_deps.sh
Then fetch third party dependencies:
cd ~/fluoride/bt mkdir third_party cd third_party git clone https://github.com/google/googletest.git git clone https://android.googlesource.com/platform/external/aac git clone https://android.googlesource.com/platform/external/libchrome git clone https://android.googlesource.com/platform/external/libldac git clone https://android.googlesource.com/platform/external/modp_b64 git clone https://android.googlesource.com/platform/external/tinyxml2
And third party dependencies of third party dependencies:
cd fluoride/bt/third_party/libchrome/base/third_party mkdir valgrind cd valgrind curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h?format=TEXT | base64 -d > valgrind.h curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h
NOTE: If packages/modules/Bluetooth/system is checked out under AOSP, then create symbolic links instead of downloading sources
cd packages/modules/Bluetooth/system mkdir third_party cd third_party ln -s ../../../external/aac aac ln -s ../../../external/libchrome libchrome ln -s ../../../external/libldac libldac ln -s ../../../external/modp_b64 modp_b64 ln -s ../../../external/tinyxml2 tinyxml2 ln -s ../../../external/googletest googletest
cd ~/fluoride/bt gn gen out/Default
cd ~/fluoride/bt ninja -C out/Default all
This will build all targets (the shared library, executables, tests, etc) and put them in out/Default. To build an individual target, replace "all" with the target of your choice, e.g. ninja -C out/Default net_test_osi
.
cd ~/fluoride/bt/out/Default LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride
Follows the Chromium project Eclipse Setup Instructions until "Optional: Building inside Eclipse" section (don't do that section, we will set it up differently)
Generate Eclipse settings:
cd packages/modules/Bluetooth/system gn gen --ide=eclipse out/Default
In Eclipse, do File->Import->C/C++->C/C++ Project Settings, choose the XML location under packages/modules/Bluetooth/system/out/Default
Right click on the project. Go to Preferences->C/C++ Build->Builder Settings. Uncheck "Use default build command", but instead using "ninja -C out/Default"
Goto Behaviour tab, change clean command to "-t clean"