diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/wifitests/coverage.sh | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/tests/wifitests/coverage.sh b/tests/wifitests/coverage.sh index bf50dee80..c81af5611 100755 --- a/tests/wifitests/coverage.sh +++ b/tests/wifitests/coverage.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash -if [[ ! ( ($# == 1) || ($# == 2 && ($2 == "HTML" || $2 == "XML" || $2 == "CSV"))) ]]; then - echo "$0: usage: coverage.sh OUTPUT_DIR [REPORT_TYPE]" - echo "REPORT_TYPE [HTML | XML | CSV] : the type of the report (default is HTML)" +if [[ ! ($# == 1) ]]; then + echo "$0: usage: coverage.sh OUTPUT_DIR" exit 1 fi @@ -11,32 +10,38 @@ if [ -z $ANDROID_BUILD_TOP ]; then exit 1 fi -REPORTER_JAR=$ANDROID_BUILD_TOP/prebuilts/sdk/tools/jack-jacoco-reporter.jar +cd "$(dirname $0)" #cd to directory containing this script + + +REPORTER_JAR=$ANDROID_HOST_OUT/framework/jacoco-cli.jar OUTPUT_DIR=$1 -if [[ $# == 2 ]]; then - REPORT_TYPE=$2 -else - REPORT_TYPE="HTML" -fi echo "Running tests and generating coverage report" echo "Output dir: $OUTPUT_DIR" -echo "Report type: $REPORT_TYPE" REMOTE_COVERAGE_OUTPUT_FILE=/data/data/com.android.server.wifi.test/files/coverage.ec COVERAGE_OUTPUT_FILE=$OUTPUT_DIR/wifi_coverage.ec -COVERAGE_METADATA_FILE=$ANDROID_BUILD_TOP/out/target/common/obj/APPS/FrameworksWifiTests_intermediates/coverage.em set -e # fail early - -echo "+ EMMA_INSTRUMENT_STATIC=true mmma -j32 $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/tests" -# NOTE Don't actually run the command above since this shell doesn't inherit functions from the -# caller. -EMMA_INSTRUMENT_STATIC=true make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk MODULES-IN-frameworks-opt-net-wifi-tests - set -x # print commands +# build this module so we can run its tests, and +# build system/core so we can invoke `adb`, and +# build jacoco-report-classes.jar so we can generate the report +make \ + EMMA_INSTRUMENT=true \ + EMMA_INSTRUMENT_FRAMEWORK=false \ + EMMA_INSTRUMENT_STATIC=true \ + ANDROID_COMPILE_WITH_JACK=false \ + SKIP_BOOT_JARS_CHECK=true \ + -j32 \ + -C $ANDROID_BUILD_TOP \ + -f build/core/main.mk \ + MODULES-IN-frameworks-opt-net-wifi-tests \ + MODULES-IN-system-core \ + FrameworksWifiTests + adb root adb wait-for-device @@ -51,9 +56,12 @@ mkdir -p $OUTPUT_DIR adb pull $REMOTE_COVERAGE_OUTPUT_FILE $COVERAGE_OUTPUT_FILE java -jar $REPORTER_JAR \ - --report-dir $OUTPUT_DIR \ - --metadata-file $COVERAGE_METADATA_FILE \ - --coverage-file $COVERAGE_OUTPUT_FILE \ - --report-type $REPORT_TYPE \ - --source-dir $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/tests/wifitests/src \ - --source-dir $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/service/java + report \ + -classfiles $ANDROID_PRODUCT_OUT/../../common/obj/APPS/FrameworksWifiTests_intermediates/jacoco/report-resources/jacoco-report-classes.jar \ + -html $OUTPUT_DIR \ + -sourcefiles $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/tests/wifitests/src -sourcefiles $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/service/java \ + -name wifi-coverage \ + $COVERAGE_OUTPUT_FILE + +echo Created report at $OUTPUT_DIR/index.html + |