summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-09-22 16:40:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-22 16:40:02 +0000
commitf9026b3669aa3da8e913e7076ea7d89f300a129e (patch)
tree2e291d6d82073bf017123ab7db2f7cae7738876b /scripts
parent7ab39b2a637df56c5a2ad28aee38e8e2749fa6e9 (diff)
parentcbe2394ef0c8717cdfc13f6134ec7e957326d5b9 (diff)
downloadandroid_development-f9026b3669aa3da8e913e7076ea7d89f300a129e.tar.gz
android_development-f9026b3669aa3da8e913e7076ea7d89f300a129e.tar.bz2
android_development-f9026b3669aa3da8e913e7076ea7d89f300a129e.zip
am cbe2394e: am 217d230a: Merge "Add acov for coverage gathering/reporting."
* commit 'cbe2394ef0c8717cdfc13f6134ec7e957326d5b9': Add acov for coverage gathering/reporting.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/acov46
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/acov b/scripts/acov
new file mode 100755
index 000000000..d6095a881
--- /dev/null
+++ b/scripts/acov
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# acov is a tool for gathering coverage information from a device and generating
+# a report from that information. To use:
+#
+# 1. sudo apt-get install lcov
+# 2. Build application/library with coverage information.
+# 3. Push the new binaries to the device.
+# 4. Run tests with the additional environment variables:
+# * GCOV_PREFIX=/data/local/tmp/gcov
+# * GCOV_PREFIX_STRIP=`echo $(ANDROID_BUILD_TOP) | grep -o / | wc -l`
+# 5. Run `acov`.
+#
+# acov will pull all coverage information from the device, push it to the right
+# directories, run lcov, and display the coverage report (currently by opening
+# it in your browser).
+#
+
+which lcov
+if [ $? -ne 0 ]; then
+ echo 'lcov not found: running `sudo apt-get install lcov`'
+ sudo apt-get install lcov
+fi
+
+cd $ANDROID_BUILD_TOP
+FILE=cov.info
+DIR=$(mktemp -d covreport-XXXXXX)
+adb pull /data/local/tmp/gcov
+lcov -c -d $ANDROID_PRODUCT_OUT -o $DIR/$FILE
+echo "Generating coverage report at $DIR"
+genhtml -q -o $DIR $DIR/$FILE
+xdg-open $DIR/index.html >/dev/null