+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/bundle_unittests
+}
+
+teardown() {
+ echo "teardown start"
+ set_perm
+}
+
+main() {
+ setup
+ test_main
+ teardown
+}
+
+main "\$*"
+EOF
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
+install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+
+cat << EOF > run-parcel-unittest.sh
+#!/bin/sh
+GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
+PAKCAGE="parcel-%{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/parcel_unittests
+}
+
+teardown() {
+ echo "teardown start"
+ set_perm
+}
+
+main() {
+ setup
+ test_main
+ teardown
+}
+
+main "\$*"
+EOF
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/parcel
+install -m 0755 run-parcel-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/parcel/run-unittest.sh
+