Fix function name of dynamic loading.
[platform/core/api/system-settings.git] / unittest2.sh
1 #!/bin/bash
2
3 RPATH=$1
4
5 SPECPATH=`find . -name *.spec`
6
7 APP=`cat $SPECPATH  | grep Name: | awk '{ print $2 }'`
8 VER1=`cat $SPECPATH  | grep "^Version:" | awk '{ print $2 }'`
9 REL=`cat $SPECPATH  | grep Release: | awk '{ print $2 }'`
10 VER=$VER1-$REL
11 ARCH=$2
12 VERSHORT=${VER%-*}              # 1.2.3
13
14
15
16 if [ -z $RPATH ]; then
17         echo "argument error : 1st arg is path "
18         echo "usage) ./unittest.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS capi-system-system-settings 0.0.3-3 armv7l"
19         exit 1
20 fi
21
22 if [ -z $ARCH ]; then
23         echo "argument error : 3th arg is Version"
24         echo "usage) ./unittest.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS capi-system-system-settings 0.0.3-3 armv7l"
25         exit 1
26 fi
27
28 sudo gbs build -A $ARCH --include-all --define "run_tests 1" || exit 1
29 # ex ) ./unittest.sh /home/mjpark/GBS-ROOT/local/repos/slp/armv7l/RPMS capi-system-system-settings 0.0.3-3 armv7l
30
31 RPM_ROOT=$RPATH
32
33 SDB=/usr/bin/sdb
34 $SDB root on
35 $SDB shell mount -o remount,rw /
36 $SDB push $RPM_ROOT/$APP-$VER.$ARCH.rpm /opt
37 $SDB push $RPM_ROOT/$APP-debuginfo-$VER.$ARCH.rpm /opt
38 $SDB push $RPM_ROOT/$APP-debugsource-$VER.$ARCH.rpm /opt
39
40 $SDB shell rpm -Uvh --force --nodeps /opt/$APP-$VER.$ARCH.rpm
41 $SDB shell rpm -Uvh --force --nodeps /opt/$APP-debuginfo-$VER.$ARCH.rpm
42 $SDB shell rpm -Uvh --force --nodeps /opt/$APP-debugsource-$VER.$ARCH.rpm
43
44 echo "UNIT TEST----------------------------------------------------"
45 export GCOV_PREFIX=/opt
46 $SDB shell G_DEBUG=fatal-criticals GCOV_PREFIX=/usr/src/packages GCOV_PREFIX_STRIP=3 /usr/local/bin/system-setting-unittest
47
48 echo "COVERAGE TEST----------------------------------------------------"
49 sdb pull /usr/src/packages/BUILD/$APP-$VERSHORT/CMakeFiles > /dev/null 2>&1
50 lcov -c -d $APP.dir/ -o $APP.info > /dev/null 2>&1
51
52 VAR1="/usr/src/packages/BUILD/$APP-$VERSHORT"
53 PWD=`pwd`
54 sed -i "s#$VAR1#$PWD#g" $APP.info
55
56 genhtml $APP.info -o out
57 find . -name "*.dir" -type d -prune -exec rm -rf '{}' '+'
58 rm $APP.info
59