Move unittest script
authorKwanghoon Son <k.son@samsung.com>
Tue, 25 Apr 2023 08:03:03 +0000 (17:03 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 28 Jun 2023 09:51:32 +0000 (18:51 +0900)
It was generated in the spec file, so it was difficult
to know the actual result and track, so move it to file.

Change-Id: I5cbd5e5d70bd049484b5205984709377de5ffd3f
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
packaging/capi-media-vision.spec
script/run-unittest.sh [new file with mode: 0755]

index f03666eb8fc3236244347f7ccafd78e9290bcea7..39996841064f4d583c879e661ad3fa51097caa6e 100644 (file)
@@ -299,54 +299,8 @@ make %{?jobs:-j%jobs}
 
 %install
 
-cat << EOF > run-unittest.sh
-#!/bin/bash
-setup() {
-    echo "setup start"
-    mkdir /opt/usr/home/owner/media/Others/mv_test
-    pushd /opt/media/USBDriveA1/mv_test
-    tar -xzvf mv_test.tar.gz -C /opt/usr/home/owner/media/Others/mv_test
-    tar -xzvf open_model_zoo.tar.gz -C /opt/usr/home/owner/media/Others/mv_test/open_model_zoo
-    bash /opt/usr/home/owner/media/Others/mv_test/post_install_on_target.sh
-    popd
-}
-
-test_main() {
-    echo "test_main start"
-    /usr/bin/mv_test --gtest_filter=-*TestPoseLandmarkDetectionTflite.MobilenetV1*
-%if "%{enable_ml_face_recognition}" == "1"
-    /usr/bin/test_face_recognition
-%endif
-%if "%{enable_ml_image_classification}" == "1"
-    /usr/bin/test_image_classification
-%endif
-%if "%{enable_ml_object_detection}" == "1"
-    /usr/bin/test_object_detection
-%endif
-%if "%{enable_ml_object_detection_3d}" == "1"
-    /usr/bin/test_object_detection_3d
-%endif
-%if "%{enable_ml_landmark_detection}" == "1"
-    /usr/bin/test_landmark_detection
-%endif
-}
-
-teardown() {
-    echo "teardown start"
-    rm -rf /opt/usr/home/owner/media/Others/mv_test
-}
-
-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}
+install -m 0755 script/run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}
 
 %make_install
 
diff --git a/script/run-unittest.sh b/script/run-unittest.sh
new file mode 100755 (executable)
index 0000000..d5aaec6
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+TEST_RES_HOME=/opt/usr/home/owner/media/Others/mv_test
+
+setup() {
+    echo "setup start"
+    mkdir ${TEST_RES_HOME}
+    pushd /opt/media/USBDriveA1/mv_test
+    tar -xzvf mv_test.tar.gz -C ${TEST_RES_HOME}
+    tar -xzvf open_model_zoo.tar.gz -C ${TEST_RES_HOME}/open_model_zoo
+    bash ${TEST_RES_HOME}/post_install_on_target.sh
+    popd
+}
+
+test_main() {
+    echo "test_main start"
+    /usr/bin/mv_test --gtest_filter=-*TestPoseLandmarkDetectionTflite.MobilenetV1*
+    /usr/bin/test_face_recognition
+    /usr/bin/test_image_classification
+    /usr/bin/test_object_detection
+    /usr/bin/test_object_detection_3d
+    /usr/bin/test_landmark_detection
+}
+
+teardown() {
+    echo "teardown start"
+    rm -rf ${TEST_RES_HOME}
+}
+
+main() {
+    setup
+    test_main
+    teardown
+}
+
+main
\ No newline at end of file