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]"
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 --assemblies "/src/$1/bin/$BUILD_CONF/*/$1.dll" \
75 sdb shell mount -o remount,rw /
76 sdb shell "rm -f $TARGET_ASSEMBLY_PATH/*.ni.dll"
77 sdb shell "rm -fr $TARGET_COV_PATH"
78 sdb shell "mkdir -p $TARGET_COV_PATH"
79 sdb push $MINICOVER_PATH/MiniCover.HitServices.dll $TARGET_ASSEMBLY_PATH
80 sdb shell chsmack -a '_' $TARGET_ASSEMBLY_PATH/MiniCover.HitServices.dll
84 PROJECT_DIR=$(check_module $1)
85 sdb push $PROJECT_DIR/bin/$BUILD_CONF/*/$1.dll $TARGET_ASSEMBLY_PATH
86 sdb shell chsmack -a '_' $TARGET_ASSEMBLY_PATH/$1.dll
90 rm -fr $COV_REPORT_PATH
91 mkdir -p $COV_REPORT_PATH
92 sdb pull $TARGET_COV_PATH
97 PROJECT_DIR=$(check_module $1)
98 dotnet $MINICOVER_PATH/dotnet-minicover.dll xmlreport \
99 --threshold 85 --output $1.xml
100 dotnet $COV_TOOL_PATH/coverage/ReportGenerator_4.8.0/netcoreapp2.0/ReportGenerator.dll \
101 -reporttypes:lcov -reports:$1.xml -targetdir:$COV_REPORT_PATH/$1
102 java -jar $COV_TOOL_PATH/coverage/jgenhtml-1.5.jar \
103 $COV_REPORT_PATH/$1/lcov.info -o $COV_REPORT_PATH/$1 --no-branch-coverage
124 update_coverage_tools
126 cmd=$1; [ $# -gt 0 ] && shift;
128 instrument|--instrument|-i) cmd_instrument $@ ;;
129 replace |--replace |-c) cmd_replace $@ ;;
130 report|--report| -r) cmd_report $@ ;;