Fix run-unittest.sh script Refs/for/tizen
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 14 Jul 2022 05:15:16 +0000 (14:15 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 14 Jul 2022 05:15:16 +0000 (14:15 +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: Icb5810440da3649d9631738f219df820e2d819eb
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/capi-content-mime-type.spec

index 99bcab1..9d60725 100644 (file)
@@ -74,19 +74,33 @@ 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"
     chmod -r /usr/bin/tizen-unittests/capi-content-mime-type/test_in_accessible.png
+    /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
+    set_perm
 }
 
 test_main() {
     echo "test_main start"
+    export "GCOV_PREFIX=/tmp"
     su - owner -c '/usr/bin/mime-type-unit-test'
 }
 
 teardown() {
     echo "teardown start"
     chmod +r /usr/bin/tizen-unittests/capi-content-mime-type/test_in_accessible.png
+    set_perm
 }
 
 main() {