/* Copyright (c) 2012, 2016, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of The Linux Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // System dependencies #include // Camera dependencies #include "mm_qcamera_unit_test.h" #include "mm_camera_dbg.h" #define MM_QCAMERA_APP_UTEST_MAX_MAIN_LOOP 4 #define MM_QCAM_APP_TEST_NUM 128 #define MM_QCAMERA_APP_WAIT_TIME 1000000000 extern int system_dimension_set(int cam_id); extern int stopPreview(int cam_id); extern int takePicture_yuv(int cam_id); extern int takePicture_rdi(int cam_id); extern int startRdi(int cam_id); extern int stopRdi(int cam_id); extern int startStats(int cam_id); extern int stopStats(int cam_id); /* * 1. open back * 2. open front * 3. start back * 4. start front * 5. stop back * 6. stop front * 7. close back * 8. close front * 9. take picture * a. start recording * b. stop recording * c. take picture rdi */ static mm_app_tc_t mm_app_tc[MM_QCAM_APP_TEST_NUM]; static int num_test_cases = 0; struct test_case_params { uint16_t launch; uint16_t preview; uint16_t recording; uint16_t snapshot; }; /* Test case 12436857 :*/ int mm_app_dtc_0(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 0...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL stop camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera\n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } sleep(1); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGD(" startPreview() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera \n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 12436587 :*/ int mm_app_dtc_1(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 1...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); LOGE("DUAL stop camera Preview for front \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGD(" startPreview() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera\n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL close back camera \n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 12436578 :*/ int mm_app_dtc_2(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 2...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); LOGE("DUAL stop camera Preview for front \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGD(" startPreview() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera \n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL close front camera\n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 241395768 : 1357 * 3, This is performed three times * And for each iteration 9 is performed thrice */ int mm_app_dtc_3(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j,k; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview and snapshot on back Camera and RDI on Front camera 3...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() frontcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(10*1000); for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++) { LOGE("DUAL open back camera %d \n",k); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { LOGE("DUAL take picture for back \n"); if ( MM_CAMERA_OK != (rc = takePicture_yuv(back_camera))) { LOGE(" TakePicture() err=%d\n", rc); break; } mm_camera_app_wait(); } usleep(10*1000); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGE(" stopPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera\n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } usleep(20*1000); } LOGE("DUAL stop camera Preview for Rdi \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGD(" stopRdi() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera \n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 2413ab5768 : 1357 * 3, This is performed three times * And for each iteration ab is performed thrice */ int mm_app_dtc_4(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j,k; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 4...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() frontcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(20*1000); for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++){ LOGE("DUAL open back camera %d \n",k); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } usleep(30*1000); for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { LOGE("DUAL start camera record for back \n"); if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) { LOGE(" StartVideorecording() err=%d\n", rc); break; } mm_camera_app_wait(); usleep(15*1000); LOGE("DUAL stop camera record for back \n"); if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) { LOGE(" Stopvideorecording() err=%d\n", rc); break; } } usleep(10*1000); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGE(" stopPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera\n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } usleep(20*1000); } LOGE("DUAL stop camera Preview for Rdi \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGD(" stopRdi() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera \n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 24135768 : 1357 * 3, This is performed three times*/ int mm_app_dtc_5(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j,k; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 5...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() frontcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); for (k = 0; k < 4 ; k++) { LOGE("DUAL open back camera %d \n",k); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGE(" stopPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera\n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } sleep(1); } LOGE("DUAL stop camera Preview for Rdi \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGD(" stopRdi() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera \n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 13246857 : 2468 * 3, This is performed three times*/ int mm_app_dtc_6(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j,k; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera 6...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); for (k = 0; k < 4 ; k++) { LOGE("DUAL open front camera %d \n",k); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL stop camera Preview for front \n"); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera\n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } sleep(1); } LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGD(" startPreview() err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera \n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /*Multi Threaded Test Cases*/ static void *front_thread(void *data) { int front_camera = 1; int rc = MM_CAMERA_OK; int i,j,k,m; struct test_case_params params = *((struct test_case_params *)data); for (i = 0; i < params.launch; i++) { LOGE("DUAL open front camera %d\n",i); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } for (j = 0; j < params.preview; j++) { LOGE("DUAL start camera Rdi for front %d ,%d \n",i,j); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(20*1000); for (k = 0; k < params.snapshot; k++) { LOGE("DUAL take picture for front %d,%d,%d \n",i,j,k); if ( MM_CAMERA_OK != (rc = takePicture_rdi(front_camera))) { LOGE(" TakePicture() err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(30*1000); } LOGE("DUAL stop camera Rdi for front %d,%d\n",i,j); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); } LOGE("DUAL close front camera %d\n",i); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } } end: LOGE("DUAL front thread close %d",rc); return NULL; } static void *back_thread(void *data) { int rc = MM_CAMERA_OK; int back_camera = 0; int i,j,k,m; struct test_case_params params = *((struct test_case_params *)data); for (i = 0; i < params.launch; i++) { LOGE("DUAL open back camera %d\n",i); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } for (j = 0; j < params.preview; j++) { LOGE("DUAL start camera Preview for back %d, %d\n",i,j); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(20*1000); for (k = 0; k < params.snapshot; k++) { LOGE("DUAL take picture for back %d, %d, %d\n",i,j,k); if ( MM_CAMERA_OK != (rc = takePicture_yuv(back_camera))) { LOGE(" TakePicture() err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(30*1000); } for (m = 0; m < params.recording; m++) { LOGE("DUAL start record for back %d, %d, %d\n",i,j,m); if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) { LOGE(" StartVideorecording() err=%d\n", rc); break; } mm_camera_app_wait(); usleep(10*1000); LOGE("DUAL stop camera record for back \n"); if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) { LOGE(" Stopvideorecording() err=%d\n", rc); break; } usleep(10*1000); } LOGE("DUAL stop camera Preview for back %d, %d\n",i,j); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGD(" startPreview() err=%d\n", rc); goto end; } usleep(10*1000); } LOGE("DUAL close back camera %d\n",i); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } } end: LOGE("DUAL back thread close %d",rc); return NULL; } /* Test case m13572468 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_7(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params params; memset(¶ms, 0, sizeof(struct test_case_params)); params.launch = 5; params.preview = 5; printf("\n Verifying Preview on back Camera and RDI on Front camera 7...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, ¶ms); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, ¶ms); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case m139572468 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_8(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params bparams, fparams; memset(&bparams, 0, sizeof(struct test_case_params)); memset(&fparams, 0, sizeof(struct test_case_params)); bparams.launch = 5; bparams.preview = 5; bparams.snapshot= 5; fparams.launch = 5; fparams.preview = 5; printf("\n Verifying Preview on back Camera and RDI on Front camera 8...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) printf("\nPassed\n"); else printf("\nFailed\n"); LOGD("END, rc = %d\n", rc); return rc; } /* Test case m1395724c68 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_9(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params bparams, fparams; memset(&bparams, 0, sizeof(struct test_case_params)); memset(&fparams, 0, sizeof(struct test_case_params)); bparams.launch = 5; bparams.preview = 5; bparams.snapshot= 5; fparams.launch = 5; fparams.preview = 5; fparams.snapshot = 5; printf("\n Verifying Preview on back Camera and RDI on Front camera 9...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case m13ab572468 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_10(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params bparams, fparams; memset(&bparams, 0, sizeof(struct test_case_params)); memset(&fparams, 0, sizeof(struct test_case_params)); bparams.launch = 5; bparams.preview = 5; bparams.recording= 5; fparams.launch = 5; fparams.preview = 5; printf("\n Verifying Preview on back Camera and RDI on Front camera 10...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case m13ab5724c68 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_11(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params bparams, fparams; memset(&bparams, 0, sizeof(struct test_case_params)); memset(&fparams, 0, sizeof(struct test_case_params)); bparams.launch = 5; bparams.preview = 5; bparams.recording= 5; fparams.launch = 5; fparams.preview = 5; fparams.snapshot = 5; printf("\n Verifying Preview on back Camera and RDI on Front camera 11...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case m1728 : Open & start in 2 concurrent pthread*/ int mm_app_dtc_12(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int result = 0; pthread_t back_thread_id, front_thread_id; struct test_case_params bparams, fparams; memset(&bparams, 0, sizeof(struct test_case_params)); memset(&fparams, 0, sizeof(struct test_case_params)); bparams.launch = 15; fparams.launch = 15; printf("\n Verifying Preview on back Camera and RDI on Front camera 12...\n"); LOGE("start back DUAL "); rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams); LOGE("start front DUAL "); rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams); sleep(1); LOGE("stop back DUAL "); rc = pthread_join(back_thread_id, NULL); LOGE("stop front DUAL "); rc = pthread_join(front_thread_id, NULL); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* Test case 2413(ab)5768 * Test the dual camera usecase. We startPreview on front camera, * but backend will allocate RDI buffers and start front camera in * RDI streaming mode. It then diverts RDI frames, converts them into YUV 420 * through C2D and generate preview data in the buffers allocated here. * Back camera will use the pixel interface as usual. */ int mm_app_dtc_13(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j,k; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n 13. Verifying Preview + Recording on back Camera and Preview(through RDI) on Front camera\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for front \n"); if( MM_CAMERA_OK != (rc = startPreview(front_camera))) { LOGE(" front camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); usleep(20*1000); for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++){ LOGE("DUAL open back camera %d \n",k); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } usleep(30*1000); for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { LOGE("DUAL start camera record for back Iteration %d \n", j); if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) { LOGE(" StartVideorecording() err=%d\n", rc); break; } mm_camera_app_wait(); usleep(10*1000*1000); LOGE("DUAL stop camera record for back Iteration %d\n", j); if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) { LOGE(" Stopvideorecording() err=%d\n", rc); break; } } usleep(10*1000); LOGE("DUAL stop camera Preview for back \n"); if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) { LOGE(" stopPreview() backcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close back camera\n"); if( mm_app_close(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } usleep(20*1000); } LOGE("DUAL stop camera Preview for Rdi \n"); if( MM_CAMERA_OK != (rc = stopPreview(front_camera))) { LOGE(" stopPreview() frontcamera err=%d\n", rc); goto end; } usleep(10*1000); LOGE("DUAL close front camera \n"); if( mm_app_close(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /*Below 6 are reference test cases just to test the open path for dual camera*/ int mm_app_dtc_1243(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera Preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_2134(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera Preview for front \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera Rdi for back \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_2143(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_2413(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_1234(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL open back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL open front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL start camera rdi for front \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_1324(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); LOGE("DUAL start back camera \n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start camera preview for back \n"); if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } //mm_camera_app_wait(); sleep(1); LOGE("DUAL start front camera \n"); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } LOGE("DUAL start rdi preview \n"); if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); sleep(1); LOGE("DUAL end \n"); end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /* single camera test cases*/ int mm_app_dtc_s_0(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } if( MM_CAMERA_OK != (rc = startPreview(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); if(mm_app_open(front_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() front camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(front_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } if( MM_CAMERA_OK != (rc = startRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } mm_camera_app_wait(); if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) { LOGE(" startPreview() backcamera err=%d\n", rc); goto end; } if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) { LOGD(" startPreview() err=%d\n", rc); goto end; } if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_s_1(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; printf("\n Verifying Snapshot on front and back camera...\n"); for(i = 0; i < cam_apps->num_cameras; i++) { if( mm_app_open(i) != MM_CAMERA_OK) { LOGE("mm_app_open() err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } if( MM_CAMERA_OK != (rc = startPreview(my_cam_app.cam_open))) { LOGE(" startPreview() err=%d\n", rc); break; } for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { if( MM_CAMERA_OK != (rc = takePicture_yuv(my_cam_app.cam_open))) { LOGE(" TakePicture() err=%d\n", rc); break; } /*if(mm_camera_app_timedwait() == ETIMEDOUT) { LOGE(" Snapshot/Preview Callback not received in time or qbuf Faile\n"); break; }*/ mm_camera_app_wait(); result++; } if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) { LOGD(" startPreview() err=%d\n", rc); break; } if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } if(result != MM_QCAMERA_APP_INTERATION) { printf(" Snapshot Start/Stop Fails for Camera %d in %d iteration", i,j); rc = -1; break; } result = 0; } end: if(rc == 0) { printf("\t***Passed***\n"); }else{ printf("\t***Failed***\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_s_2(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; printf("\n Verifying Video on front and back camera...\n"); for(i = 0; i < cam_apps->num_cameras; i++) { if( mm_app_open(i) != MM_CAMERA_OK) { LOGE("mm_app_open() err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } if( MM_CAMERA_OK != (rc = startPreview(my_cam_app.cam_open))) { LOGE(" startPreview() err=%d\n", rc); break; } for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { if( MM_CAMERA_OK != (rc = startRecording(my_cam_app.cam_open))) { LOGE(" StartVideorecording() err=%d\n", rc); break; } /*if(mm_camera_app_timedwait() == ETIMEDOUT) { LOGE(" Video Callback not received in time\n"); break; }*/ mm_camera_app_wait(); if( MM_CAMERA_OK != (rc = stopRecording(my_cam_app.cam_open))) { LOGE(" Stopvideorecording() err=%d\n", rc); break; } result++; } if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) { LOGD(" startPreview() err=%d\n", rc); break; } if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } if(result != MM_QCAMERA_APP_INTERATION) { printf(" Video Start/Stop Fails for Camera %d in %d iteration", i,j); rc = -1; break; } result = 0; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_dtc_s_3(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; printf("\n Verifying RDI Stream on front and back camera...\n"); if(cam_apps->num_cameras == 0) { LOGE("Query Failed: Num of cameras = %d\n", cam_apps->num_cameras); rc = -1; goto end; } for(i = 0; i < cam_apps->num_cameras; i++) { if( mm_app_open(i) != MM_CAMERA_OK) { LOGE("mm_app_open() err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) { if( MM_CAMERA_OK != (rc = startRdi(my_cam_app.cam_open))) { LOGE(" StartVideorecording() err=%d\n", rc); break; } /*if(mm_camera_app_timedwait() == ETIMEDOUT) { LOGE(" Video Callback not received in time\n"); break; }*/ mm_camera_app_wait(); if( MM_CAMERA_OK != (rc = stopRdi(my_cam_app.cam_open))) { LOGE(" Stopvideorecording() err=%d\n", rc); break; } result++; } if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } if(result != MM_QCAMERA_APP_INTERATION) { printf(" Video Start/Stop Fails for Camera %d in %d iteration", i,j); rc = -1; break; } result = 0; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } /*Stats Test Case*/ int mm_app_dtc_s_5(mm_camera_app_t *cam_apps) { int rc = MM_CAMERA_OK; int i,j; int result = 0; int front_camera = 1; int back_camera = 0; printf("\n Verifying Preview on back Camera and RDI on Front camera...\n"); if(mm_app_open(back_camera) != MM_CAMERA_OK) { LOGE("mm_app_open() back camera err=%d\n", rc); rc = -1; goto end; } if(system_dimension_set(back_camera) != MM_CAMERA_OK){ LOGE("system_dimension_set() err=%d\n", rc); rc = -1; goto end; } if( MM_CAMERA_OK != (rc = startStats(back_camera))) { LOGE(" back camera startPreview() err=%d\n", rc); goto end; } mm_camera_app_wait(); if( MM_CAMERA_OK != (rc = stopStats(my_cam_app.cam_open))) { LOGD(" startPreview() err=%d\n", rc); goto end; } if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) { LOGE("mm_app_close() err=%d\n", rc); rc = -1; goto end; } end: if(rc == 0) { printf("\nPassed\n"); }else{ printf("\nFailed\n"); } LOGD("END, rc = %d\n", rc); return rc; } int mm_app_gen_dual_test_cases() { int tc = 0; memset(mm_app_tc, 0, sizeof(mm_app_tc)); if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_0; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_1; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_2; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_3; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_4; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_5; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_6; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_7; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_8; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_9; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_10; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_11; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_12; if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_13; return tc; } int mm_app_dual_test_entry(mm_camera_app_t *cam_app) { int rc = MM_CAMERA_OK; int i, tc = 0; int cam_id = 0; tc = mm_app_gen_dual_test_cases(); LOGD("Running %d test cases\n",tc); for(i = 0; i < tc; i++) { mm_app_tc[i].r = mm_app_tc[i].f(cam_app); if(mm_app_tc[i].r != MM_CAMERA_OK) { printf(" test case %d error = %d, abort unit testing engine!!!!\n", i, mm_app_tc[i].r); rc = mm_app_tc[i].r; goto end; } } end: printf("nTOTAL_TSET_CASE = %d, NUM_TEST_RAN = %d, rc=%d\n", tc, i, rc); return rc; }