3 SCRIPT_DIR=$(dirname $(readlink -f $0))
8 SLN_FILE=$ROOTDIR/$SLN_NAME.sln
10 COV_TOOL_PATH=$ROOTDIR/tools/coverage
11 COV_REPORT_PATH=$ROOTDIR/Artifacts/coverage
12 MINICOVER_PATH=$COV_TOOL_PATH/coverage/minicover_linux
13 TARGET_ASSEMBLY_PATH=/usr/share/dotnet.tizen/framework
14 TARGET_COV_PATH=/home/owner/share/cov
18 echo "Usage: $0 [command] [module] [exclude-sources]"
20 echo " instrument|--instrument|-i : Instrument assemblies to record code coverage."
21 echo " replace |--replace |-c : Replace runtime assemblies with intrumented."
22 echo " report|--report|-r : Generate report files."
27 echo "No module specified." 1>&2
31 local PROJECT_DIR=$ROOTDIR/src/$1
33 if [ ! -f $PROJECT_DIR/$1.csproj ]; then
34 echo "No such found $1 module." 1>&2
41 update_coverage_tools() {
42 echo "## Update Coverage Tools ##"
43 if [ -d $COV_TOOL_PATH ]; then
44 pushd $COV_TOOL_PATH > /dev/null
46 git reset --hard origin/master
49 git clone https://github.sec.samsung.net/RS8-DotNetTctTools/CSharpCoverageTool $COV_TOOL_PATH
54 find $ROOTDIR/src -maxdepth 1 \
55 -type d ! -name "*.Design" \
56 -not -path $ROOTDIR/src | sort | sed "s:$ROOTDIR/src/::"
60 PROJECT_DIR=$(check_module $1)
61 dotnet build -c $BUILD_CONF $PROJECT_DIR/$1.csproj
65 PROJECT_DIR=$(check_module $1)
66 dotnet $MINICOVER_PATH/dotnet-minicover.dll instrument \
68 --sources "/src/$1/**/*.cs" \
69 --exclude-sources $2 \
70 --assemblies "/src/$1/bin/$BUILD_CONF/*/$1.dll" \
76 sdb shell mount -o remount,rw /
77 sdb shell "rm -f $TARGET_ASSEMBLY_PATH/*.ni.dll"
78 sdb shell "rm -fr $TARGET_COV_PATH"
79 sdb shell "mkdir -p $TARGET_COV_PATH"
80 sdb push $MINICOVER_PATH/MiniCover.HitServices.dll $TARGET_ASSEMBLY_PATH
81 sdb shell chsmack -a '_' $TARGET_ASSEMBLY_PATH/MiniCover.HitServices.dll
85 PROJECT_DIR=$(check_module $1)
86 sdb push $PROJECT_DIR/bin/$BUILD_CONF/*/$1.dll $TARGET_ASSEMBLY_PATH
87 sdb shell chsmack -a '_' $TARGET_ASSEMBLY_PATH/$1.dll
91 rm -fr $COV_REPORT_PATH
92 mkdir -p $COV_REPORT_PATH
93 sdb pull $TARGET_COV_PATH
98 PROJECT_DIR=$(check_module $1)
99 dotnet $MINICOVER_PATH/dotnet-minicover.dll xmlreport \
100 --threshold 85 --output $1.xml
101 dotnet $COV_TOOL_PATH/coverage/ReportGenerator_4.8.0/netcoreapp2.0/ReportGenerator.dll \
102 -reporttypes:lcov -reports:$1.xml -targetdir:$COV_REPORT_PATH/$1
103 java -jar $COV_TOOL_PATH/coverage/jgenhtml-1.5.jar \
104 $COV_REPORT_PATH/$1/lcov.info -o $COV_REPORT_PATH/$1 --no-branch-coverage
125 update_coverage_tools
127 cmd=$1; [ $# -gt 0 ] && shift;
129 instrument|--instrument|-i) cmd_instrument $@ ;;
130 replace |--replace |-c) cmd_replace $@ ;;
131 report|--report| -r) cmd_report $@ ;;