mirror of
				https://github.com/mer-hybris/ofono-binder-plugin
				synced 2025-11-04 06:45:38 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			61 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
#
 | 
						|
# This script requires lcov, dirname
 | 
						|
#
 | 
						|
 | 
						|
TESTS="\
 | 
						|
unit_base \
 | 
						|
unit_ext_ims \
 | 
						|
unit_ext_plugin \
 | 
						|
unit_ext_slot \
 | 
						|
unit_sim_settings"
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
LCOV="lcov $LCOV_OPT"
 | 
						|
 | 
						|
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
 | 
						|
EXT_DIR="$TOP_DIR/lib"
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
PLUGIN_BASE_DIR="$TOP_DIR"
 | 
						|
EXT_BASE_DIR="$EXT_DIR"
 | 
						|
 | 
						|
PLUGIN_COV="$COV_DIR/plugin.gcov"
 | 
						|
EXT_COV="$COV_DIR/ext.gcov"
 | 
						|
OUT_COV="$COV_DIR/out.gcov"
 | 
						|
rm -f "$PLUGIN_COV" "$EXT_COV" "$OUT_COV"
 | 
						|
$LCOV -c -d "$TOP_DIR/build/coverage" -b "$PLUGIN_BASE_DIR" -o "$PLUGIN_COV" || exit 1
 | 
						|
$LCOV -c -d "$EXT_DIR/build/coverage" -b "$EXT_BASE_DIR" -o "$EXT_COV" || exit 1
 | 
						|
$LCOV -a "$PLUGIN_COV" -a "$EXT_COV" -o "$OUT_COV" || exit 1
 | 
						|
genhtml $GENHTML_OPT "$OUT_COV" -t "ofono binder plugin" --output-directory "$COV_DIR/report" || exit 1
 |