Fix run-unittest.sh script 41/277841/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 14 Jul 2022 05:13:47 +0000 (14:13 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 14 Jul 2022 05:13:47 +0000 (14:13 +0900)
For code coverage measurement, the permission of directories and files should be
changed for applications.
The script sets the smack label as "System::Run" to files.

Change-Id: I68d6b3b2f41958695b8c8de2d1bc336bfd14c066
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/capi-appfw-component-manager.spec

index c831a81..b3b0e24 100644 (file)
@@ -92,17 +92,31 @@ find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
 
 cat << EOF > run-unittest.sh
 #!/bin/sh
+GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
+PAKCAGE="%{name}-%{version}"
+
+set_perm() {
+    ## Sets the permission for applications
+    /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" &> /dev/null
+    /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" -t &> /dev/null
+    /usr/bin/chmod -R 777 /tmp/home/
+}
+
 setup() {
     echo "setup start"
+    /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
+    set_perm
 }
 
 test_main() {
     echo "test_main start"
+    export "GCOV_PREFIX=/tmp"
     /usr/bin/component-manager-unit-test
 }
 
 teardown() {
     echo "teardown start"
+    set_perm
 }
 
 main() {