mm_qcamera_dual_test.c revision 6f83d735d8e3b918da42e6b559fcd0efb78133e5
1/*
2Copyright (c) 2012, The Linux Foundation. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are
6met:
7    * Redistributions of source code must retain the above copyright
8      notice, this list of conditions and the following disclaimer.
9    * Redistributions in binary form must reproduce the above
10      copyright notice, this list of conditions and the following
11      disclaimer in the documentation and/or other materials provided
12      with the distribution.
13    * Neither the name of The Linux Foundation nor the names of its
14      contributors may be used to endorse or promote products derived
15      from this software without specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30#include <pthread.h>
31#include "mm_camera_dbg.h"
32#include <errno.h>
33#include <sys/ioctl.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <fcntl.h>
37#include <poll.h>
38#include "mm_qcamera_unit_test.h"
39
40#define MM_QCAMERA_APP_UTEST_MAX_MAIN_LOOP 4
41#define MM_QCAM_APP_TEST_NUM 128
42
43#define MM_QCAMERA_APP_WAIT_TIME 1000000000
44
45extern int system_dimension_set(int cam_id);
46extern int stopPreview(int cam_id);
47extern int takePicture_yuv(int cam_id);
48extern int takePicture_rdi(int cam_id);
49extern int startRdi(int cam_id);
50extern int stopRdi(int cam_id);
51extern int startStats(int cam_id);
52extern int stopStats(int cam_id);
53
54
55/*
56* 1. open back
57* 2. open front
58* 3. start back
59* 4. start front
60* 5. stop back
61* 6. stop front
62* 7. close back
63* 8. close front
64* 9. take picture
65* a. start recording
66* b. stop recording
67* c. take picture rdi
68*/
69static mm_app_tc_t mm_app_tc[MM_QCAM_APP_TEST_NUM];
70static int num_test_cases = 0;
71struct test_case_params {
72  uint16_t launch;
73  uint16_t preview;
74  uint16_t recording;
75  uint16_t snapshot;
76};
77
78/*  Test case 12436857 :*/
79
80int mm_app_dtc_0(mm_camera_app_t *cam_apps)
81{
82        int rc = MM_CAMERA_OK;
83        int i,j;
84        int result = 0;
85        int front_camera = 1;
86        int back_camera = 0;
87
88        printf("\n Verifying Preview on back Camera and RDI on Front camera 0...\n");
89        CDBG_ERROR("DUAL open back camera \n");
90        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
91                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
92                rc = -1;
93                goto end;
94        }
95        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
96                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
97                rc = -1;
98                goto end;
99        }
100
101        CDBG_ERROR("DUAL open front camera \n");
102        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
103                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
104                rc = -1;
105                goto end;
106        }
107
108        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
109                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
110                rc = -1;
111                goto end;
112        }
113
114        CDBG_ERROR("DUAL start camera Rdi for front \n");
115        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
116               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
117                goto end;
118        }
119        mm_camera_app_wait();
120        sleep(1);
121
122        CDBG_ERROR("DUAL start camera Preview for back \n");
123        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
124                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
125                goto end;
126        }
127        mm_camera_app_wait();
128        sleep(1);
129
130        CDBG_ERROR("DUAL stop camera Rdi for front \n");
131        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
132                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
133                goto end;
134        }
135        usleep(10*1000);
136
137        CDBG_ERROR("DUAL close front camera\n");
138        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
139                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
140                rc = -1;
141                goto end;
142        }
143        sleep(1);
144        CDBG_ERROR("DUAL stop camera Preview for back \n");
145        if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
146                CDBG("%s: startPreview() err=%d\n", __func__, rc);
147                goto end;
148        }
149        usleep(10*1000);
150        CDBG_ERROR("DUAL close back camera \n");
151        if( mm_app_close(back_camera) != MM_CAMERA_OK) {
152                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
153                rc = -1;
154                goto end;
155        }
156        CDBG_ERROR("DUAL end \n");
157
158end:
159        if(rc == 0) {
160                printf("\nPassed\n");
161        }else{
162                printf("\nFailed\n");
163        }
164        CDBG("%s:END, rc = %d\n", __func__, rc);
165        return rc;
166}
167
168/*  Test case 12436587 :*/
169
170int mm_app_dtc_1(mm_camera_app_t *cam_apps)
171{
172        int rc = MM_CAMERA_OK;
173        int i,j;
174        int result = 0;
175        int front_camera = 1;
176        int back_camera = 0;
177
178        printf("\n Verifying Preview on back Camera and RDI on Front camera 1...\n");
179        CDBG_ERROR("DUAL open back camera \n");
180        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
181                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
182                rc = -1;
183                goto end;
184        }
185        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
186                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
187                rc = -1;
188                goto end;
189        }
190
191        CDBG_ERROR("DUAL open front camera \n");
192        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
193                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
194                rc = -1;
195                goto end;
196        }
197
198        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
199                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
200                rc = -1;
201                goto end;
202        }
203
204        CDBG_ERROR("DUAL start camera Rdi for front \n");
205        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
206               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
207                goto end;
208        }
209        mm_camera_app_wait();
210        sleep(1);
211
212        CDBG_ERROR("DUAL start camera Preview for back \n");
213
214        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
215                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
216                goto end;
217        }
218        mm_camera_app_wait();
219        sleep(1);
220        CDBG_ERROR("DUAL end \n");
221
222        CDBG_ERROR("DUAL stop camera Preview for front \n");
223        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
224                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
225                goto end;
226        }
227        usleep(10*1000);
228        CDBG_ERROR("DUAL stop camera Preview for back \n");
229        if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
230                CDBG("%s: startPreview() err=%d\n", __func__, rc);
231                goto end;
232        }
233        usleep(10*1000);
234        CDBG_ERROR("DUAL close front camera\n");
235        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
236                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
237                rc = -1;
238                goto end;
239        }
240        CDBG_ERROR("DUAL close back camera \n");
241        if( mm_app_close(back_camera) != MM_CAMERA_OK) {
242                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
243                rc = -1;
244                goto end;
245        }
246
247end:
248        if(rc == 0) {
249                printf("\nPassed\n");
250        }else{
251                printf("\nFailed\n");
252        }
253        CDBG("%s:END, rc = %d\n", __func__, rc);
254        return rc;
255}
256
257/*  Test case 12436578 :*/
258
259int mm_app_dtc_2(mm_camera_app_t *cam_apps)
260{
261        int rc = MM_CAMERA_OK;
262        int i,j;
263        int result = 0;
264        int front_camera = 1;
265        int back_camera = 0;
266
267        printf("\n Verifying Preview on back Camera and RDI on Front camera 2...\n");
268        CDBG_ERROR("DUAL open back camera \n");
269        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
270                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
271                rc = -1;
272                goto end;
273        }
274        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
275                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
276                rc = -1;
277                goto end;
278        }
279
280        CDBG_ERROR("DUAL open front camera \n");
281        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
282                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
283                rc = -1;
284                goto end;
285        }
286
287        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
288                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
289                rc = -1;
290                goto end;
291        }
292
293        CDBG_ERROR("DUAL start camera Rdi for front \n");
294        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
295               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
296                goto end;
297        }
298        mm_camera_app_wait();
299        sleep(1);
300
301        CDBG_ERROR("DUAL start camera Preview for back \n");
302
303        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
304                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
305                goto end;
306        }
307        mm_camera_app_wait();
308        sleep(1);
309        CDBG_ERROR("DUAL end \n");
310
311        CDBG_ERROR("DUAL stop camera Preview for front \n");
312        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
313                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
314                goto end;
315        }
316        usleep(10*1000);
317        CDBG_ERROR("DUAL stop camera Preview for back \n");
318        if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
319                CDBG("%s: startPreview() err=%d\n", __func__, rc);
320                goto end;
321        }
322        usleep(10*1000);
323        CDBG_ERROR("DUAL close back camera \n");
324        if( mm_app_close(back_camera) != MM_CAMERA_OK) {
325                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
326                rc = -1;
327                goto end;
328        }
329        CDBG_ERROR("DUAL close front camera\n");
330        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
331                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
332                rc = -1;
333                goto end;
334        }
335
336end:
337        if(rc == 0) {
338                printf("\nPassed\n");
339        }else{
340                printf("\nFailed\n");
341        }
342        CDBG("%s:END, rc = %d\n", __func__, rc);
343        return rc;
344}
345
346/*  Test case 241395768 : 1357 * 3, This is performed three times
347* And for each iteration 9 is performed thrice */
348
349int mm_app_dtc_3(mm_camera_app_t *cam_apps)
350{
351        int rc = MM_CAMERA_OK;
352        int i,j,k;
353        int result = 0;
354        int front_camera = 1;
355        int back_camera = 0;
356
357        printf("\n Verifying Preview and snapshot on back Camera and RDI on Front camera 3...\n");
358        CDBG_ERROR("DUAL open front camera \n");
359        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
360                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
361                rc = -1;
362                goto end;
363        }
364        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
365                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
366                rc = -1;
367                goto end;
368        }
369
370        CDBG_ERROR("DUAL start camera Preview for front \n");
371
372        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
373                CDBG_ERROR("%s: startPreview() frontcamera err=%d\n", __func__, rc);
374                goto end;
375        }
376        mm_camera_app_wait();
377        usleep(10*1000);
378
379        for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++) {
380          CDBG_ERROR("DUAL open back camera %d \n",k);
381          if(mm_app_open(back_camera) != MM_CAMERA_OK) {
382                  CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
383                  rc = -1;
384                  goto end;
385          }
386
387          if(system_dimension_set(back_camera) != MM_CAMERA_OK){
388                  CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
389                  rc = -1;
390                  goto end;
391          }
392
393          CDBG_ERROR("DUAL start camera Preview for back \n");
394          if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
395                 CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
396                  goto end;
397          }
398
399          for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
400              CDBG_ERROR("DUAL take picture for back \n");
401              if ( MM_CAMERA_OK != (rc = takePicture_yuv(back_camera))) {
402                  CDBG_ERROR("%s: TakePicture() err=%d\n", __func__, rc);
403                  break;
404              }
405              mm_camera_app_wait();
406
407          }
408          usleep(10*1000);
409          CDBG_ERROR("DUAL stop camera Preview for back \n");
410          if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
411                  CDBG_ERROR("%s: stopPreview() backcamera err=%d\n", __func__, rc);
412                  goto end;
413          }
414          usleep(10*1000);
415
416          CDBG_ERROR("DUAL close back camera\n");
417          if( mm_app_close(back_camera) != MM_CAMERA_OK) {
418                  CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
419                  rc = -1;
420                  goto end;
421          }
422          usleep(20*1000);
423        }
424        CDBG_ERROR("DUAL stop camera Preview for Rdi \n");
425        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
426                CDBG("%s: stopRdi() err=%d\n", __func__, rc);
427                goto end;
428        }
429        usleep(10*1000);
430        CDBG_ERROR("DUAL close front camera \n");
431        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
432                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
433                rc = -1;
434                goto end;
435        }
436        CDBG_ERROR("DUAL end \n");
437
438end:
439        if(rc == 0) {
440                printf("\nPassed\n");
441        }else{
442                printf("\nFailed\n");
443        }
444        CDBG("%s:END, rc = %d\n", __func__, rc);
445        return rc;
446}
447
448/*  Test case 2413ab5768 : 1357 * 3, This is performed three times
449* And for each iteration ab is performed thrice */
450
451int mm_app_dtc_4(mm_camera_app_t *cam_apps)
452{
453        int rc = MM_CAMERA_OK;
454        int i,j,k;
455        int result = 0;
456        int front_camera = 1;
457        int back_camera = 0;
458
459        printf("\n Verifying Preview on back Camera and RDI on Front camera 4...\n");
460        CDBG_ERROR("DUAL open front camera \n");
461        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
462                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
463                rc = -1;
464                goto end;
465        }
466        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
467                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
468                rc = -1;
469                goto end;
470        }
471
472        CDBG_ERROR("DUAL start camera Preview for front \n");
473
474        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
475                CDBG_ERROR("%s: startPreview() frontcamera err=%d\n", __func__, rc);
476                goto end;
477        }
478        mm_camera_app_wait();
479        usleep(20*1000);
480
481        for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++){
482          CDBG_ERROR("DUAL open back camera %d \n",k);
483          if(mm_app_open(back_camera) != MM_CAMERA_OK) {
484                 CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
485                 rc = -1;
486                 goto end;
487          }
488
489          if(system_dimension_set(back_camera) != MM_CAMERA_OK){
490                 CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
491                 rc = -1;
492                 goto end;
493          }
494
495          CDBG_ERROR("DUAL start camera Preview for back \n");
496          if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
497                CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
498                 goto end;
499          }
500          usleep(30*1000);
501
502          for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
503             CDBG_ERROR("DUAL start camera record for back \n");
504             if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) {
505                 CDBG_ERROR("%s: StartVideorecording() err=%d\n", __func__, rc);
506                 break;
507             }
508
509             mm_camera_app_wait();
510             usleep(15*1000);
511             CDBG_ERROR("DUAL stop camera record for back \n");
512             if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) {
513                 CDBG_ERROR("%s: Stopvideorecording() err=%d\n", __func__, rc);
514                 break;
515             }
516          }
517          usleep(10*1000);
518
519          CDBG_ERROR("DUAL stop camera Preview for back \n");
520          if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
521                 CDBG_ERROR("%s: stopPreview() backcamera err=%d\n", __func__, rc);
522                 goto end;
523          }
524          usleep(10*1000);
525
526          CDBG_ERROR("DUAL close back camera\n");
527          if( mm_app_close(back_camera) != MM_CAMERA_OK) {
528                 CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
529                 rc = -1;
530                 goto end;
531          }
532          usleep(20*1000);
533        }
534        CDBG_ERROR("DUAL stop camera Preview for Rdi \n");
535        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
536                CDBG("%s: stopRdi() err=%d\n", __func__, rc);
537                goto end;
538        }
539        usleep(10*1000);
540        CDBG_ERROR("DUAL close front camera \n");
541        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
542                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
543                rc = -1;
544                goto end;
545        }
546        CDBG_ERROR("DUAL end \n");
547
548end:
549        if(rc == 0) {
550                printf("\nPassed\n");
551        }else{
552                printf("\nFailed\n");
553        }
554        CDBG("%s:END, rc = %d\n", __func__, rc);
555        return rc;
556}
557
558/*  Test case 24135768 : 1357 * 3, This is performed three times*/
559
560int mm_app_dtc_5(mm_camera_app_t *cam_apps)
561{
562        int rc = MM_CAMERA_OK;
563        int i,j,k;
564        int result = 0;
565        int front_camera = 1;
566        int back_camera = 0;
567
568        printf("\n Verifying Preview on back Camera and RDI on Front camera 5...\n");
569        CDBG_ERROR("DUAL open front camera \n");
570        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
571                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
572                rc = -1;
573                goto end;
574        }
575        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
576                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
577                rc = -1;
578                goto end;
579        }
580
581        CDBG_ERROR("DUAL start camera Preview for front \n");
582
583        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
584                CDBG_ERROR("%s: startPreview() frontcamera err=%d\n", __func__, rc);
585                goto end;
586        }
587        mm_camera_app_wait();
588        sleep(1);
589
590        for (k = 0; k < 4 ; k++) {
591          CDBG_ERROR("DUAL open back camera %d \n",k);
592          if(mm_app_open(back_camera) != MM_CAMERA_OK) {
593                  CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
594                  rc = -1;
595                  goto end;
596          }
597
598          if(system_dimension_set(back_camera) != MM_CAMERA_OK){
599                  CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
600                  rc = -1;
601                  goto end;
602          }
603
604          CDBG_ERROR("DUAL start camera Preview for back \n");
605          if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
606                 CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
607                  goto end;
608          }
609          mm_camera_app_wait();
610          sleep(1);
611
612          CDBG_ERROR("DUAL stop camera Preview for back \n");
613          if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
614                  CDBG_ERROR("%s: stopPreview() backcamera err=%d\n", __func__, rc);
615                  goto end;
616          }
617          usleep(10*1000);
618
619          CDBG_ERROR("DUAL close back camera\n");
620          if( mm_app_close(back_camera) != MM_CAMERA_OK) {
621                  CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
622                  rc = -1;
623                  goto end;
624          }
625          sleep(1);
626        }
627        CDBG_ERROR("DUAL stop camera Preview for Rdi \n");
628        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
629                CDBG("%s: stopRdi() err=%d\n", __func__, rc);
630                goto end;
631        }
632        usleep(10*1000);
633        CDBG_ERROR("DUAL close front camera \n");
634        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
635                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
636                rc = -1;
637                goto end;
638        }
639        CDBG_ERROR("DUAL end \n");
640
641end:
642        if(rc == 0) {
643                printf("\nPassed\n");
644        }else{
645                printf("\nFailed\n");
646        }
647        CDBG("%s:END, rc = %d\n", __func__, rc);
648        return rc;
649}
650
651/*  Test case 13246857 : 2468 * 3, This is performed three times*/
652
653int mm_app_dtc_6(mm_camera_app_t *cam_apps)
654{
655        int rc = MM_CAMERA_OK;
656        int i,j,k;
657        int result = 0;
658        int front_camera = 1;
659        int back_camera = 0;
660
661        printf("\n Verifying Preview on back Camera and RDI on Front camera 6...\n");
662        CDBG_ERROR("DUAL open back camera \n");
663        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
664                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
665                rc = -1;
666                goto end;
667        }
668        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
669                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
670                rc = -1;
671                goto end;
672        }
673
674        CDBG_ERROR("DUAL start camera Preview for back \n");
675
676        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
677                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
678                goto end;
679        }
680        mm_camera_app_wait();
681        sleep(1);
682
683        for (k = 0; k < 4 ; k++) {
684        CDBG_ERROR("DUAL open front camera %d \n",k);
685        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
686                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
687                rc = -1;
688                goto end;
689        }
690
691        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
692                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
693                rc = -1;
694                goto end;
695        }
696
697        CDBG_ERROR("DUAL start camera Rdi for front \n");
698        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
699               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
700                goto end;
701        }
702        mm_camera_app_wait();
703        sleep(1);
704
705        CDBG_ERROR("DUAL stop camera Preview for front \n");
706        if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
707                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
708                goto end;
709        }
710        usleep(10*1000);
711
712        CDBG_ERROR("DUAL close front camera\n");
713        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
714                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
715                rc = -1;
716                goto end;
717        }
718        sleep(1);
719        }
720        CDBG_ERROR("DUAL stop camera Preview for back \n");
721        if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
722                CDBG("%s: startPreview() err=%d\n", __func__, rc);
723                goto end;
724        }
725        usleep(10*1000);
726        CDBG_ERROR("DUAL close back camera \n");
727        if( mm_app_close(back_camera) != MM_CAMERA_OK) {
728                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
729                rc = -1;
730                goto end;
731        }
732        CDBG_ERROR("DUAL end \n");
733
734end:
735        if(rc == 0) {
736                printf("\nPassed\n");
737        }else{
738                printf("\nFailed\n");
739        }
740        CDBG("%s:END, rc = %d\n", __func__, rc);
741        return rc;
742}
743
744/*Multi Threaded Test Cases*/
745static void *front_thread(void *data)
746{
747        int front_camera = 1;
748        int rc = MM_CAMERA_OK;
749        int i,j,k,m;
750        struct test_case_params params
751          = *((struct test_case_params *)data);
752        for (i = 0; i < params.launch; i++) {
753          CDBG_ERROR("DUAL open front camera %d\n",i);
754          if(mm_app_open(front_camera) != MM_CAMERA_OK) {
755            CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
756            rc = -1;
757            goto end;
758          }
759
760          if(system_dimension_set(front_camera) != MM_CAMERA_OK){
761            CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
762            rc = -1;
763            goto end;
764          }
765
766          for (j = 0; j < params.preview; j++) {
767            CDBG_ERROR("DUAL start camera Rdi for front %d ,%d \n",i,j);
768            if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
769              CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
770              goto end;
771            }
772            mm_camera_app_wait();
773            usleep(20*1000);
774            for (k = 0; k < params.snapshot; k++) {
775              CDBG_ERROR("DUAL take picture for front %d,%d,%d \n",i,j,k);
776              if ( MM_CAMERA_OK != (rc = takePicture_rdi(front_camera))) {
777                CDBG_ERROR("%s: TakePicture() err=%d\n", __func__, rc);
778                goto end;
779              }
780              mm_camera_app_wait();
781              usleep(30*1000);
782            }
783            CDBG_ERROR("DUAL stop camera Rdi for front %d,%d\n",i,j);
784            if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
785              CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
786              goto end;
787            }
788            usleep(10*1000);
789          }
790
791          CDBG_ERROR("DUAL close front camera %d\n",i);
792          if( mm_app_close(front_camera) != MM_CAMERA_OK) {
793            CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
794            rc = -1;
795            goto end;
796          }
797        }
798end:
799        CDBG_ERROR("DUAL front thread close %d",rc);
800        return NULL;
801}
802
803static void *back_thread(void *data)
804{
805        int rc = MM_CAMERA_OK;
806        int back_camera = 0;
807        int i,j,k,m;
808        struct test_case_params params
809          = *((struct test_case_params *)data);
810        for (i = 0; i < params.launch; i++) {
811          CDBG_ERROR("DUAL open back camera %d\n",i);
812          if(mm_app_open(back_camera) != MM_CAMERA_OK) {
813            CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
814            rc = -1;
815            goto end;
816          }
817          if(system_dimension_set(back_camera) != MM_CAMERA_OK){
818            CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
819            rc = -1;
820            goto end;
821          }
822
823          for (j = 0; j < params.preview; j++) {
824            CDBG_ERROR("DUAL start camera Preview for back %d, %d\n",i,j);
825            if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
826              CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
827              goto end;
828            }
829            mm_camera_app_wait();
830            usleep(20*1000);
831            for (k = 0; k < params.snapshot; k++) {
832              CDBG_ERROR("DUAL take picture for back %d, %d, %d\n",i,j,k);
833              if ( MM_CAMERA_OK != (rc = takePicture_yuv(back_camera))) {
834                CDBG_ERROR("%s: TakePicture() err=%d\n", __func__, rc);
835                goto end;
836              }
837              mm_camera_app_wait();
838              usleep(30*1000);
839            }
840
841            for (m = 0; m < params.recording; m++) {
842              CDBG_ERROR("DUAL start record for back %d, %d, %d\n",i,j,m);
843              if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) {
844                CDBG_ERROR("%s: StartVideorecording() err=%d\n", __func__, rc);
845                break;
846              }
847
848              mm_camera_app_wait();
849              usleep(10*1000);
850              CDBG_ERROR("DUAL stop camera record for back \n");
851              if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) {
852                CDBG_ERROR("%s: Stopvideorecording() err=%d\n", __func__, rc);
853                break;
854              }
855              usleep(10*1000);
856            }
857            CDBG_ERROR("DUAL stop camera Preview for back %d, %d\n",i,j);
858            if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
859              CDBG("%s: startPreview() err=%d\n", __func__, rc);
860              goto end;
861            }
862            usleep(10*1000);
863          }
864
865          CDBG_ERROR("DUAL close back camera %d\n",i);
866          if( mm_app_close(back_camera) != MM_CAMERA_OK) {
867            CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
868            rc = -1;
869            goto end;
870          }
871        }
872end:
873        CDBG_ERROR("DUAL back thread close %d",rc);
874        return NULL;
875}
876
877/*  Test case m13572468 : Open & start  in 2 concurrent pthread*/
878int mm_app_dtc_7(mm_camera_app_t *cam_apps)
879{
880        int rc = MM_CAMERA_OK;
881        int result = 0;
882        pthread_t back_thread_id, front_thread_id;
883        struct test_case_params params;
884        memset(&params, 0, sizeof(struct test_case_params));
885        params.launch = 5;
886        params.preview = 5;
887        printf("\n Verifying Preview on back Camera and RDI on Front camera 7...\n");
888
889        CDBG_ERROR("start back DUAL ");
890        rc = pthread_create(&back_thread_id, NULL, back_thread, &params);
891        CDBG_ERROR("start front DUAL ");
892        rc = pthread_create(&front_thread_id, NULL, front_thread, &params);
893        sleep(1);
894        CDBG_ERROR("stop back DUAL ");
895        rc = pthread_join(back_thread_id, NULL);
896        CDBG_ERROR("stop front DUAL ");
897        rc = pthread_join(front_thread_id, NULL);
898        CDBG_ERROR("DUAL end \n");
899
900end:
901        if(rc == 0) {
902          printf("\nPassed\n");
903        }else{
904          printf("\nFailed\n");
905        }
906        CDBG("%s:END, rc = %d\n", __func__, rc);
907        return rc;
908}
909
910/*  Test case m139572468 : Open & start in 2 concurrent pthread*/
911int mm_app_dtc_8(mm_camera_app_t *cam_apps)
912{
913        int rc = MM_CAMERA_OK;
914        int result = 0;
915
916        pthread_t back_thread_id, front_thread_id;
917        struct test_case_params bparams, fparams;
918        memset(&bparams, 0, sizeof(struct test_case_params));
919        memset(&fparams, 0, sizeof(struct test_case_params));
920        bparams.launch = 5;
921        bparams.preview = 5;
922        bparams.snapshot= 5;
923        fparams.launch = 5;
924        fparams.preview = 5;
925        printf("\n Verifying Preview on back Camera and RDI on Front camera 8...\n");
926
927        CDBG_ERROR("start back DUAL ");
928        rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams);
929        CDBG_ERROR("start front DUAL ");
930        rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams);
931        sleep(1);
932        CDBG_ERROR("stop back DUAL ");
933        rc = pthread_join(back_thread_id, NULL);
934        CDBG_ERROR("stop front DUAL ");
935        rc = pthread_join(front_thread_id, NULL);
936        CDBG_ERROR("DUAL end \n");
937
938end:
939        if(rc == 0)
940          printf("\nPassed\n");
941        else
942          printf("\nFailed\n");
943        CDBG("%s:END, rc = %d\n", __func__, rc);
944        return rc;
945}
946
947/*  Test case m1395724c68 : Open & start in 2 concurrent pthread*/
948int mm_app_dtc_9(mm_camera_app_t *cam_apps)
949{
950        int rc = MM_CAMERA_OK;
951        int result = 0;
952
953        pthread_t back_thread_id, front_thread_id;
954        struct test_case_params bparams, fparams;
955        memset(&bparams, 0, sizeof(struct test_case_params));
956        memset(&fparams, 0, sizeof(struct test_case_params));
957        bparams.launch = 5;
958        bparams.preview = 5;
959        bparams.snapshot= 5;
960        fparams.launch = 5;
961        fparams.preview = 5;
962        fparams.snapshot = 5;
963        printf("\n Verifying Preview on back Camera and RDI on Front camera 9...\n");
964
965        CDBG_ERROR("start back DUAL ");
966        rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams);
967        CDBG_ERROR("start front DUAL ");
968        rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams);
969        sleep(1);
970        CDBG_ERROR("stop back DUAL ");
971        rc = pthread_join(back_thread_id, NULL);
972        CDBG_ERROR("stop front DUAL ");
973        rc = pthread_join(front_thread_id, NULL);
974        CDBG_ERROR("DUAL end \n");
975
976end:
977        if(rc == 0) {
978          printf("\nPassed\n");
979        }else{
980          printf("\nFailed\n");
981        }
982        CDBG("%s:END, rc = %d\n", __func__, rc);
983        return rc;
984}
985
986/*  Test case m13ab572468 : Open & start in 2 concurrent pthread*/
987int mm_app_dtc_10(mm_camera_app_t *cam_apps)
988{
989        int rc = MM_CAMERA_OK;
990        int result = 0;
991
992        pthread_t back_thread_id, front_thread_id;
993        struct test_case_params bparams, fparams;
994        memset(&bparams, 0, sizeof(struct test_case_params));
995        memset(&fparams, 0, sizeof(struct test_case_params));
996        bparams.launch = 5;
997        bparams.preview = 5;
998        bparams.recording= 5;
999        fparams.launch = 5;
1000        fparams.preview = 5;
1001        printf("\n Verifying Preview on back Camera and RDI on Front camera 10...\n");
1002
1003        CDBG_ERROR("start back DUAL ");
1004        rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams);
1005        CDBG_ERROR("start front DUAL ");
1006        rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams);
1007        sleep(1);
1008        CDBG_ERROR("stop back DUAL ");
1009        rc = pthread_join(back_thread_id, NULL);
1010        CDBG_ERROR("stop front DUAL ");
1011        rc = pthread_join(front_thread_id, NULL);
1012        CDBG_ERROR("DUAL end \n");
1013end:
1014        if(rc == 0) {
1015          printf("\nPassed\n");
1016        }else{
1017          printf("\nFailed\n");
1018        }
1019        CDBG("%s:END, rc = %d\n", __func__, rc);
1020        return rc;
1021}
1022
1023/*  Test case m13ab5724c68 : Open & start in 2 concurrent pthread*/
1024int mm_app_dtc_11(mm_camera_app_t *cam_apps)
1025{
1026        int rc = MM_CAMERA_OK;
1027        int result = 0;
1028
1029        pthread_t back_thread_id, front_thread_id;
1030        struct test_case_params bparams, fparams;
1031        memset(&bparams, 0, sizeof(struct test_case_params));
1032        memset(&fparams, 0, sizeof(struct test_case_params));
1033        bparams.launch = 5;
1034        bparams.preview = 5;
1035        bparams.recording= 5;
1036        fparams.launch = 5;
1037        fparams.preview = 5;
1038        fparams.snapshot = 5;
1039        printf("\n Verifying Preview on back Camera and RDI on Front camera 11...\n");
1040
1041        CDBG_ERROR("start back DUAL ");
1042        rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams);
1043        CDBG_ERROR("start front DUAL ");
1044        rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams);
1045        sleep(1);
1046        CDBG_ERROR("stop back DUAL ");
1047        rc = pthread_join(back_thread_id, NULL);
1048        CDBG_ERROR("stop front DUAL ");
1049        rc = pthread_join(front_thread_id, NULL);
1050        CDBG_ERROR("DUAL end \n");
1051
1052end:
1053        if(rc == 0) {
1054                printf("\nPassed\n");
1055        }else{
1056                printf("\nFailed\n");
1057        }
1058        CDBG("%s:END, rc = %d\n", __func__, rc);
1059        return rc;
1060}
1061
1062/*  Test case m1728 : Open & start in 2 concurrent pthread*/
1063int mm_app_dtc_12(mm_camera_app_t *cam_apps)
1064{
1065        int rc = MM_CAMERA_OK;
1066        int result = 0;
1067
1068        pthread_t back_thread_id, front_thread_id;
1069        struct test_case_params bparams, fparams;
1070        memset(&bparams, 0, sizeof(struct test_case_params));
1071        memset(&fparams, 0, sizeof(struct test_case_params));
1072        bparams.launch = 15;
1073        fparams.launch = 15;
1074        printf("\n Verifying Preview on back Camera and RDI on Front camera 12...\n");
1075
1076        CDBG_ERROR("start back DUAL ");
1077        rc = pthread_create(&back_thread_id, NULL, back_thread, &bparams);
1078        CDBG_ERROR("start front DUAL ");
1079        rc = pthread_create(&front_thread_id, NULL, front_thread, &fparams);
1080        sleep(1);
1081        CDBG_ERROR("stop back DUAL ");
1082        rc = pthread_join(back_thread_id, NULL);
1083        CDBG_ERROR("stop front DUAL ");
1084        rc = pthread_join(front_thread_id, NULL);
1085        CDBG_ERROR("DUAL end \n");
1086
1087end:
1088        if(rc == 0) {
1089                printf("\nPassed\n");
1090        }else{
1091                printf("\nFailed\n");
1092        }
1093        CDBG("%s:END, rc = %d\n", __func__, rc);
1094        return rc;
1095}
1096
1097/*  Test case 2413(ab)5768
1098 *  Test the dual camera usecase. We startPreview on front camera,
1099 *  but backend will allocate RDI buffers and start front camera in
1100 *  RDI streaming mode. It then diverts RDI frames, converts them into YUV 420
1101 *  through C2D and generate preview data in the buffers allocated here.
1102 *  Back camera will use the pixel interface as usual.
1103 */
1104
1105int mm_app_dtc_13(mm_camera_app_t *cam_apps)
1106{
1107        int rc = MM_CAMERA_OK;
1108        int i,j,k;
1109        int result = 0;
1110        int front_camera = 1;
1111        int back_camera = 0;
1112
1113        printf("\n 13. Verifying Preview + Recording on back Camera and Preview(through RDI) on Front camera\n");
1114        CDBG_ERROR("DUAL open front camera \n");
1115        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1116                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1117                rc = -1;
1118                goto end;
1119        }
1120        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1121                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1122                rc = -1;
1123                goto end;
1124        }
1125
1126        CDBG_ERROR("DUAL start camera Preview for front \n");
1127        if( MM_CAMERA_OK != (rc = startPreview(front_camera))) {
1128               CDBG_ERROR("%s: front camera startPreview() err=%d\n", __func__, rc);
1129               goto end;
1130        }
1131        mm_camera_app_wait();
1132        usleep(20*1000);
1133
1134        for (k = 0; k < MM_QCAMERA_APP_INTERATION ; k++){
1135          CDBG_ERROR("DUAL open back camera %d \n",k);
1136          if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1137                 CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1138                 rc = -1;
1139                 goto end;
1140          }
1141
1142          if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1143                 CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1144                 rc = -1;
1145                 goto end;
1146          }
1147
1148          CDBG_ERROR("DUAL start camera Preview for back \n");
1149          if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1150                CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1151                 goto end;
1152          }
1153          usleep(30*1000);
1154
1155          for (j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
1156             CDBG_ERROR("DUAL start camera record for back Iteration %d \n", j);
1157             if ( MM_CAMERA_OK != (rc = startRecording(back_camera))) {
1158                 CDBG_ERROR("%s: StartVideorecording() err=%d\n", __func__, rc);
1159                 break;
1160             }
1161
1162             mm_camera_app_wait();
1163             usleep(10*1000*1000);
1164             CDBG_ERROR("DUAL stop camera record for back Iteration %d\n", j);
1165             if ( MM_CAMERA_OK != (rc = stopRecording(back_camera))) {
1166                 CDBG_ERROR("%s: Stopvideorecording() err=%d\n", __func__, rc);
1167                 break;
1168             }
1169          }
1170          usleep(10*1000);
1171
1172          CDBG_ERROR("DUAL stop camera Preview for back \n");
1173          if( MM_CAMERA_OK != (rc = stopPreview(back_camera))) {
1174                 CDBG_ERROR("%s: stopPreview() backcamera err=%d\n", __func__, rc);
1175                 goto end;
1176          }
1177          usleep(10*1000);
1178
1179          CDBG_ERROR("DUAL close back camera\n");
1180          if( mm_app_close(back_camera) != MM_CAMERA_OK) {
1181                 CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1182                 rc = -1;
1183                 goto end;
1184          }
1185          usleep(20*1000);
1186        }
1187        CDBG_ERROR("DUAL stop camera Preview for Rdi \n");
1188        if( MM_CAMERA_OK != (rc = stopPreview(front_camera))) {
1189                CDBG_ERROR("%s: stopPreview() frontcamera err=%d\n", __func__, rc);
1190                goto end;
1191        }
1192        usleep(10*1000);
1193        CDBG_ERROR("DUAL close front camera \n");
1194        if( mm_app_close(front_camera) != MM_CAMERA_OK) {
1195                CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1196                rc = -1;
1197                goto end;
1198        }
1199        CDBG_ERROR("DUAL end \n");
1200
1201end:
1202        if(rc == 0) {
1203                printf("\nPassed\n");
1204        }else{
1205                printf("\nFailed\n");
1206        }
1207        CDBG("%s:END, rc = %d\n", __func__, rc);
1208        return rc;
1209}
1210
1211/*Below 6  are reference test cases just to test the open path for dual camera*/
1212int mm_app_dtc_1243(mm_camera_app_t *cam_apps)
1213{
1214        int rc = MM_CAMERA_OK;
1215        int i,j;
1216        int result = 0;
1217        int front_camera = 1;
1218        int back_camera = 0;
1219
1220        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1221        CDBG_ERROR("DUAL open back camera \n");
1222        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1223                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1224                rc = -1;
1225                goto end;
1226        }
1227        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1228                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1229                rc = -1;
1230                goto end;
1231        }
1232
1233        CDBG_ERROR("DUAL open front camera \n");
1234        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1235                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1236                rc = -1;
1237                goto end;
1238        }
1239
1240        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1241                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1242                rc = -1;
1243                goto end;
1244        }
1245
1246        CDBG_ERROR("DUAL start camera Rdi for front \n");
1247        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1248               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1249                goto end;
1250        }
1251        mm_camera_app_wait();
1252        sleep(1);
1253
1254        CDBG_ERROR("DUAL start camera Preview for back \n");
1255
1256        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1257                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1258                goto end;
1259        }
1260        mm_camera_app_wait();
1261        sleep(1);
1262        CDBG_ERROR("DUAL end \n");
1263
1264end:
1265        if(rc == 0) {
1266                printf("\nPassed\n");
1267        }else{
1268                printf("\nFailed\n");
1269        }
1270        CDBG("%s:END, rc = %d\n", __func__, rc);
1271        return rc;
1272}
1273
1274int mm_app_dtc_2134(mm_camera_app_t *cam_apps)
1275{
1276        int rc = MM_CAMERA_OK;
1277        int i,j;
1278        int result = 0;
1279        int front_camera = 1;
1280        int back_camera = 0;
1281
1282        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1283        CDBG_ERROR("DUAL open front camera \n");
1284        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1285                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1286                rc = -1;
1287                goto end;
1288        }
1289        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1290                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1291                rc = -1;
1292                goto end;
1293        }
1294
1295        CDBG_ERROR("DUAL open back camera \n");
1296        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1297                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1298                rc = -1;
1299                goto end;
1300        }
1301
1302        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1303                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1304                rc = -1;
1305                goto end;
1306        }
1307
1308        CDBG_ERROR("DUAL start camera Preview for front \n");
1309        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1310               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1311                goto end;
1312        }
1313        mm_camera_app_wait();
1314        sleep(1);
1315
1316        CDBG_ERROR("DUAL start camera Rdi for back \n");
1317
1318        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1319                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1320                goto end;
1321        }
1322        mm_camera_app_wait();
1323        sleep(1);
1324        CDBG_ERROR("DUAL end \n");
1325
1326end:
1327        if(rc == 0) {
1328                printf("\nPassed\n");
1329        }else{
1330                printf("\nFailed\n");
1331        }
1332        CDBG("%s:END, rc = %d\n", __func__, rc);
1333        return rc;
1334}
1335int mm_app_dtc_2143(mm_camera_app_t *cam_apps)
1336{
1337        int rc = MM_CAMERA_OK;
1338        int i,j;
1339        int result = 0;
1340        int front_camera = 1;
1341        int back_camera = 0;
1342
1343        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1344        CDBG_ERROR("DUAL open front camera \n");
1345        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1346                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1347                rc = -1;
1348                goto end;
1349        }
1350        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1351                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1352                rc = -1;
1353                goto end;
1354        }
1355
1356        CDBG_ERROR("DUAL open back camera \n");
1357        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1358                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1359                rc = -1;
1360                goto end;
1361        }
1362
1363        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1364                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1365                rc = -1;
1366                goto end;
1367        }
1368
1369        CDBG_ERROR("DUAL start camera rdi for front \n");
1370        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1371               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1372                goto end;
1373        }
1374        mm_camera_app_wait();
1375        sleep(1);
1376
1377        CDBG_ERROR("DUAL start camera preview for back \n");
1378
1379        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1380                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1381                goto end;
1382        }
1383        mm_camera_app_wait();
1384        sleep(1);
1385        CDBG_ERROR("DUAL end \n");
1386
1387end:
1388        if(rc == 0) {
1389                printf("\nPassed\n");
1390        }else{
1391                printf("\nFailed\n");
1392        }
1393        CDBG("%s:END, rc = %d\n", __func__, rc);
1394        return rc;
1395}
1396
1397int mm_app_dtc_2413(mm_camera_app_t *cam_apps)
1398{
1399        int rc = MM_CAMERA_OK;
1400        int i,j;
1401        int result = 0;
1402        int front_camera = 1;
1403        int back_camera = 0;
1404
1405        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1406        CDBG_ERROR("DUAL open front camera \n");
1407        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1408                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1409                rc = -1;
1410                goto end;
1411        }
1412        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1413                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1414                rc = -1;
1415                goto end;
1416        }
1417
1418        CDBG_ERROR("DUAL start camera rdi for front \n");
1419        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1420               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1421                goto end;
1422        }
1423        mm_camera_app_wait();
1424        sleep(1);
1425
1426        CDBG_ERROR("DUAL open back camera \n");
1427        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1428                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1429                rc = -1;
1430                goto end;
1431        }
1432
1433        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1434                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1435                rc = -1;
1436                goto end;
1437        }
1438
1439        CDBG_ERROR("DUAL start camera preview for back \n");
1440
1441        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1442                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1443                goto end;
1444        }
1445        mm_camera_app_wait();
1446        sleep(1);
1447        CDBG_ERROR("DUAL end \n");
1448
1449end:
1450        if(rc == 0) {
1451                printf("\nPassed\n");
1452        }else{
1453                printf("\nFailed\n");
1454        }
1455        CDBG("%s:END, rc = %d\n", __func__, rc);
1456        return rc;
1457}
1458
1459int mm_app_dtc_1234(mm_camera_app_t *cam_apps)
1460{
1461        int rc = MM_CAMERA_OK;
1462        int i,j;
1463        int result = 0;
1464        int front_camera = 1;
1465        int back_camera = 0;
1466
1467        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1468        CDBG_ERROR("DUAL open back camera \n");
1469        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1470                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1471                rc = -1;
1472                goto end;
1473        }
1474        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1475                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1476                rc = -1;
1477                goto end;
1478        }
1479        CDBG_ERROR("DUAL open front camera \n");
1480        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1481                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1482                rc = -1;
1483                goto end;
1484        }
1485
1486        if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1487                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1488                rc = -1;
1489                goto end;
1490        }
1491
1492        CDBG_ERROR("DUAL start camera preview for back \n");
1493        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1494               CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1495                goto end;
1496        }
1497        mm_camera_app_wait();
1498        sleep(1);
1499
1500        CDBG_ERROR("DUAL start camera rdi for front \n");
1501
1502        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1503                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1504                goto end;
1505        }
1506        mm_camera_app_wait();
1507        sleep(1);
1508        CDBG_ERROR("DUAL end \n");
1509
1510end:
1511        if(rc == 0) {
1512                printf("\nPassed\n");
1513        }else{
1514                printf("\nFailed\n");
1515        }
1516        CDBG("%s:END, rc = %d\n", __func__, rc);
1517        return rc;
1518}
1519
1520int mm_app_dtc_1324(mm_camera_app_t *cam_apps)
1521{
1522        int rc = MM_CAMERA_OK;
1523        int i,j;
1524        int result = 0;
1525        int front_camera = 1;
1526        int back_camera = 0;
1527
1528        printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1529        CDBG_ERROR("DUAL start back camera \n");
1530        if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1531                CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1532                rc = -1;
1533                goto end;
1534        }
1535        if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1536                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1537                rc = -1;
1538                goto end;
1539        }
1540        CDBG_ERROR("DUAL start camera preview for back \n");
1541        if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1542                CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1543                goto end;
1544        }
1545        //mm_camera_app_wait();
1546        sleep(1);
1547        CDBG_ERROR("DUAL start front camera \n");
1548        if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1549                CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1550                rc = -1;
1551                goto end;
1552        }
1553
1554       if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1555                CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1556                rc = -1;
1557                goto end;
1558        }
1559        CDBG_ERROR("DUAL start rdi preview \n");
1560
1561        if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1562                CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1563                goto end;
1564        }
1565        mm_camera_app_wait();
1566        sleep(1);
1567        CDBG_ERROR("DUAL end \n");
1568
1569end:
1570        if(rc == 0) {
1571          printf("\nPassed\n");
1572        }else{
1573          printf("\nFailed\n");
1574        }
1575        CDBG("%s:END, rc = %d\n", __func__, rc);
1576        return rc;
1577}
1578
1579/* single camera test cases*/
1580int mm_app_dtc_s_0(mm_camera_app_t *cam_apps)
1581{
1582    int rc = MM_CAMERA_OK;
1583    int i,j;
1584    int result = 0;
1585    int front_camera = 1;
1586    int back_camera = 0;
1587
1588    printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1589
1590    if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1591        CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1592        rc = -1;
1593        goto end;
1594    }
1595    if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1596    CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1597        rc = -1;
1598        goto end;
1599    }
1600
1601    if( MM_CAMERA_OK != (rc = startPreview(back_camera))) {
1602        CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1603        goto end;
1604    }
1605
1606    mm_camera_app_wait();
1607    if(mm_app_open(front_camera) != MM_CAMERA_OK) {
1608        CDBG_ERROR("%s:mm_app_open() front camera err=%d\n",__func__, rc);
1609        rc = -1;
1610        goto end;
1611    }
1612    if(system_dimension_set(front_camera) != MM_CAMERA_OK){
1613        CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1614        rc = -1;
1615        goto end;
1616    }
1617
1618    if( MM_CAMERA_OK != (rc = startRdi(front_camera))) {
1619        CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1620        goto end;
1621    }
1622    mm_camera_app_wait();
1623
1624    if( MM_CAMERA_OK != (rc = stopRdi(front_camera))) {
1625        CDBG_ERROR("%s: startPreview() backcamera err=%d\n", __func__, rc);
1626        goto end;
1627    }
1628
1629    if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) {
1630        CDBG("%s: startPreview() err=%d\n", __func__, rc);
1631        goto end;
1632    }
1633
1634    if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) {
1635        CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1636        rc = -1;
1637        goto end;
1638    }
1639end:
1640    if(rc == 0) {
1641        printf("\nPassed\n");
1642    }else{
1643        printf("\nFailed\n");
1644    }
1645    CDBG("%s:END, rc = %d\n", __func__, rc);
1646    return rc;
1647}
1648
1649int mm_app_dtc_s_1(mm_camera_app_t *cam_apps)
1650{
1651    int rc = MM_CAMERA_OK;
1652    int i,j;
1653    int result = 0;
1654
1655    printf("\n Verifying Snapshot on front and back camera...\n");
1656    for(i = 0; i < cam_apps->num_cameras; i++) {
1657        if( mm_app_open(i) != MM_CAMERA_OK) {
1658            CDBG_ERROR("%s:mm_app_open() err=%d\n",__func__, rc);
1659            rc = -1;
1660            goto end;
1661        }
1662        if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){
1663            CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1664            rc = -1;
1665            goto end;
1666        }
1667
1668        if( MM_CAMERA_OK != (rc = startPreview(my_cam_app.cam_open))) {
1669                CDBG_ERROR("%s: startPreview() err=%d\n", __func__, rc);
1670                break;
1671        }
1672        for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
1673            if( MM_CAMERA_OK != (rc = takePicture_yuv(my_cam_app.cam_open))) {
1674                CDBG_ERROR("%s: TakePicture() err=%d\n", __func__, rc);
1675                break;
1676            }
1677            /*if(mm_camera_app_timedwait() == ETIMEDOUT) {
1678                CDBG_ERROR("%s: Snapshot/Preview Callback not received in time or qbuf Faile\n", __func__);
1679                break;
1680            }*/
1681            mm_camera_app_wait();
1682            result++;
1683        }
1684        if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) {
1685            CDBG("%s: startPreview() err=%d\n", __func__, rc);
1686            break;
1687        }
1688        if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) {
1689            CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1690            rc = -1;
1691            goto end;
1692        }
1693        if(result != MM_QCAMERA_APP_INTERATION) {
1694            printf("%s: Snapshot Start/Stop Fails for Camera %d in %d iteration", __func__, i,j);
1695            rc = -1;
1696            break;
1697        }
1698
1699        result = 0;
1700    }
1701end:
1702    if(rc == 0) {
1703        printf("\t***Passed***\n");
1704    }else{
1705        printf("\t***Failed***\n");
1706    }
1707    CDBG("%s:END, rc = %d\n", __func__, rc);
1708    return rc;
1709}
1710
1711int mm_app_dtc_s_2(mm_camera_app_t *cam_apps)
1712{
1713    int rc = MM_CAMERA_OK;
1714    int i,j;
1715    int result = 0;
1716
1717    printf("\n Verifying Video on front and back camera...\n");
1718    for(i = 0; i < cam_apps->num_cameras; i++) {
1719        if( mm_app_open(i) != MM_CAMERA_OK) {
1720            CDBG_ERROR("%s:mm_app_open() err=%d\n",__func__, rc);
1721            rc = -1;
1722            goto end;
1723        }
1724        if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){
1725            CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1726            rc = -1;
1727            goto end;
1728        }
1729
1730        if( MM_CAMERA_OK != (rc = startPreview(my_cam_app.cam_open))) {
1731            CDBG_ERROR("%s: startPreview() err=%d\n", __func__, rc);
1732            break;
1733        }
1734        for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
1735            if( MM_CAMERA_OK != (rc = startRecording(my_cam_app.cam_open))) {
1736                CDBG_ERROR("%s: StartVideorecording() err=%d\n", __func__, rc);
1737                break;
1738            }
1739
1740            /*if(mm_camera_app_timedwait() == ETIMEDOUT) {
1741            CDBG_ERROR("%s: Video Callback not received in time\n", __func__);
1742            break;
1743            }*/
1744            mm_camera_app_wait();
1745            if( MM_CAMERA_OK != (rc = stopRecording(my_cam_app.cam_open))) {
1746                CDBG_ERROR("%s: Stopvideorecording() err=%d\n", __func__, rc);
1747                break;
1748            }
1749            result++;
1750        }
1751        if( MM_CAMERA_OK != (rc = stopPreview(my_cam_app.cam_open))) {
1752            CDBG("%s: startPreview() err=%d\n", __func__, rc);
1753            break;
1754        }
1755        if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) {
1756            CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1757            rc = -1;
1758            goto end;
1759        }
1760        if(result != MM_QCAMERA_APP_INTERATION) {
1761            printf("%s: Video Start/Stop Fails for Camera %d in %d iteration", __func__, i,j);
1762            rc = -1;
1763            break;
1764        }
1765
1766        result = 0;
1767    }
1768end:
1769    if(rc == 0) {
1770        printf("\nPassed\n");
1771    }else{
1772        printf("\nFailed\n");
1773    }
1774    CDBG("%s:END, rc = %d\n", __func__, rc);
1775    return rc;
1776}
1777
1778int mm_app_dtc_s_3(mm_camera_app_t *cam_apps)
1779{
1780    int rc = MM_CAMERA_OK;
1781    int i,j;
1782    int result = 0;
1783
1784    printf("\n Verifying RDI Stream on front and back camera...\n");
1785    if(cam_apps->num_cameras == 0) {
1786        CDBG_ERROR("%s:Query Failed: Num of cameras = %d\n",__func__, cam_apps->num_cameras);
1787        rc = -1;
1788        goto end;
1789    }
1790    for(i = 0; i < cam_apps->num_cameras; i++) {
1791        if( mm_app_open(i) != MM_CAMERA_OK) {
1792            CDBG_ERROR("%s:mm_app_open() err=%d\n",__func__, rc);
1793            rc = -1;
1794            goto end;
1795        }
1796        if(system_dimension_set(my_cam_app.cam_open) != MM_CAMERA_OK){
1797            CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1798            rc = -1;
1799            goto end;
1800        }
1801        for(j = 0; j < MM_QCAMERA_APP_INTERATION; j++) {
1802            if( MM_CAMERA_OK != (rc = startRdi(my_cam_app.cam_open))) {
1803                CDBG_ERROR("%s: StartVideorecording() err=%d\n", __func__, rc);
1804                break;
1805            }
1806
1807            /*if(mm_camera_app_timedwait() == ETIMEDOUT) {
1808            CDBG_ERROR("%s: Video Callback not received in time\n", __func__);
1809            break;
1810            }*/
1811            mm_camera_app_wait();
1812            if( MM_CAMERA_OK != (rc = stopRdi(my_cam_app.cam_open))) {
1813                CDBG_ERROR("%s: Stopvideorecording() err=%d\n", __func__, rc);
1814                break;
1815            }
1816            result++;
1817        }
1818        if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) {
1819            CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1820            rc = -1;
1821            goto end;
1822        }
1823        if(result != MM_QCAMERA_APP_INTERATION) {
1824            printf("%s: Video Start/Stop Fails for Camera %d in %d iteration", __func__, i,j);
1825            rc = -1;
1826            break;
1827        }
1828
1829        result = 0;
1830    }
1831end:
1832    if(rc == 0) {
1833        printf("\nPassed\n");
1834    }else{
1835        printf("\nFailed\n");
1836    }
1837    CDBG("%s:END, rc = %d\n", __func__, rc);
1838    return rc;
1839}
1840
1841/*Stats Test Case*/
1842int mm_app_dtc_s_5(mm_camera_app_t *cam_apps)
1843{
1844    int rc = MM_CAMERA_OK;
1845    int i,j;
1846    int result = 0;
1847    int front_camera = 1;
1848    int back_camera = 0;
1849
1850    printf("\n Verifying Preview on back Camera and RDI on Front camera...\n");
1851
1852    if(mm_app_open(back_camera) != MM_CAMERA_OK) {
1853        CDBG_ERROR("%s:mm_app_open() back camera err=%d\n",__func__, rc);
1854        rc = -1;
1855        goto end;
1856    }
1857    if(system_dimension_set(back_camera) != MM_CAMERA_OK){
1858    CDBG_ERROR("%s:system_dimension_set() err=%d\n",__func__, rc);
1859        rc = -1;
1860        goto end;
1861    }
1862
1863    if( MM_CAMERA_OK != (rc = startStats(back_camera))) {
1864        CDBG_ERROR("%s: back camera startPreview() err=%d\n", __func__, rc);
1865        goto end;
1866    }
1867
1868    mm_camera_app_wait();
1869
1870    if( MM_CAMERA_OK != (rc = stopStats(my_cam_app.cam_open))) {
1871        CDBG("%s: startPreview() err=%d\n", __func__, rc);
1872        goto end;
1873    }
1874
1875    if( mm_app_close(my_cam_app.cam_open) != MM_CAMERA_OK) {
1876        CDBG_ERROR("%s:mm_app_close() err=%d\n",__func__, rc);
1877        rc = -1;
1878        goto end;
1879    }
1880end:
1881    if(rc == 0) {
1882        printf("\nPassed\n");
1883    }else{
1884        printf("\nFailed\n");
1885    }
1886    CDBG("%s:END, rc = %d\n", __func__, rc);
1887    return rc;
1888}
1889
1890int mm_app_gen_dual_test_cases()
1891{
1892    int tc = 0;
1893    memset(mm_app_tc, 0, sizeof(mm_app_tc));
1894    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_0;
1895    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_1;
1896    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_2;
1897    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_3;
1898    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_4;
1899    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_5;
1900    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_6;
1901    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_7;
1902    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_8;
1903    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_9;
1904    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_10;
1905    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_11;
1906    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_12;
1907    if(tc < MM_QCAM_APP_TEST_NUM) mm_app_tc[tc++].f = mm_app_dtc_13;
1908
1909    return tc;
1910}
1911
1912int mm_app_dual_test_entry(mm_camera_app_t *cam_app)
1913{
1914    int rc = MM_CAMERA_OK;
1915    int i, tc = 0;
1916    int cam_id = 0;
1917
1918    tc = mm_app_gen_dual_test_cases();
1919    CDBG("Running %d test cases\n",tc);
1920    for(i = 0; i < tc; i++) {
1921        mm_app_tc[i].r = mm_app_tc[i].f(cam_app);
1922        if(mm_app_tc[i].r != MM_CAMERA_OK) {
1923            printf("%s: test case %d error = %d, abort unit testing engine!!!!\n",
1924                    __func__, i, mm_app_tc[i].r);
1925            rc = mm_app_tc[i].r;
1926            goto end;
1927        }
1928    }
1929end:
1930    printf("nTOTAL_TSET_CASE = %d, NUM_TEST_RAN = %d, rc=%d\n", tc, i, rc);
1931    return rc;
1932}
1933
1934
1935
1936
1937