Files
libgbinder/unit/coverage/run
gary-wzl77 771444a8ac [gbinder] Add "aidl4" variant of service manager
Introduce "aidl4" variant of service manager to adapt the change
to service related protocol for Android 12.

From Android 12, when reading nullable strong binder, the format of
the `stability` field passed on the wire was changed and evolved to
`struct Category`, which consists of the following members with 4 bytes long.
```
struct Category {
  uint8_t version;
  uint8_t reserved[2];
  Level level;        <- bitmask of Stability::Level
}
```
Please check the following link for details:

  https://cs.android.com/android/platform/superproject/+/android-12.0.0_r3:frameworks/native/libs/binder/include/binder/Stability.h;l=140

To honor the change on AOSP side for Android 12, we need to adapt
the protocol change in Service Manager.
2022-06-22 18:36:51 +08:00

80 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#
# This script requires lcov, dirname
#
TESTS="\
unit_bridge \
unit_buffer \
unit_cleanup \
unit_client \
unit_config \
unit_driver \
unit_eventloop \
unit_fmq \
unit_ipc \
unit_local_object \
unit_local_reply \
unit_local_request \
unit_log \
unit_protocol \
unit_proxy_object \
unit_reader \
unit_remote_object \
unit_remote_reply \
unit_remote_request \
unit_servicemanager \
unit_servicemanager_aidl \
unit_servicemanager_aidl2 \
unit_servicemanager_aidl3 \
unit_servicemanager_aidl4 \
unit_servicemanager_hidl \
unit_servicename \
unit_servicepoll \
unit_writer"
function err() {
echo "*** ERROR!" $1
exit 1
}
# Check the required tools
which lcov >> /dev/null || err "Please install lcov"
which dirname >> /dev/null || err "Please install dirname"
# LCOV 1.10 has branch coverage disabled per default
# Previous versions didn't have the --rc option
if [ ! -z "$(lcov --help | grep ' --rc ')" ] ; then
LCOV_OPT="--rc lcov_branch_coverage=1"
GENHTML_OPT="--branch-coverage"
fi
pushd `dirname $0` > /dev/null
COV_DIR="$PWD"
pushd .. > /dev/null
TEST_DIR="$PWD"
pushd .. > /dev/null
TOP_DIR="$PWD"
popd > /dev/null
popd > /dev/null
popd > /dev/null
make -C "$TOP_DIR" clean
for t in $TESTS ; do
pushd "$TEST_DIR/$t"
make -C "$TEST_DIR/$t" clean coverage || exit 1
build/coverage/$t || exit 1
popd
done
# Sometimes you need this, sometimes that :S
BASE_DIR="$TOP_DIR"
#BASE_DIR="$TOP_DIR/src"
FULL_COV="$COV_DIR/full.gcov"
LIB_COV="$COV_DIR/lib.gcov"
rm -f "$FULL_COV" "$LIB_COV"
lcov $LCOV_OPT -c -d "$TOP_DIR/build/coverage" -b "$BASE_DIR" -o "$FULL_COV" || exit 1
lcov $LCOV_OPT -e "$FULL_COV" "$BASE_DIR/*" -o "$LIB_COV" || exit 1
genhtml $GENHTML_OPT "$LIB_COV" -t "libgbinder" --output-directory "$COV_DIR/report" || exit 1