X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-harness.cpp;h=c4a27d19fa7dd2c2d38caf7e79f3035a7a65e20b;hp=645d74b43c0b83905296f3d3c74d06b63ef81140;hb=07a73413cfefa18105d94f952efb62884b8ed9a1;hpb=297230d42fbcc597af042cff10ca65094c97e10a diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp index 645d74b..c4a27d1 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp @@ -27,7 +27,7 @@ namespace TestHarness { -typedef std::map RunningTestCases; +typedef std::map RunningTestCases; const char* basename(const char* path) { @@ -41,9 +41,9 @@ const char* basename(const char* path) return slash; } -int RunTestCase( struct ::testcase_s& testCase ) +int32_t RunTestCase( struct ::testcase_s& testCase ) { - int result = EXIT_STATUS_TESTCASE_FAILED; + int32_t result = EXIT_STATUS_TESTCASE_FAILED; // dont want to catch exception as we want to be able to get // gdb stack trace from the first error @@ -69,11 +69,11 @@ int RunTestCase( struct ::testcase_s& testCase ) } -int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput ) +int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput ) { - int testResult = EXIT_STATUS_TESTCASE_FAILED; + int32_t testResult = EXIT_STATUS_TESTCASE_FAILED; - int pid = fork(); + int32_t pid = fork(); if( pid == 0 ) // Child process { if( suppressOutput ) @@ -84,12 +84,12 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu else { printf("\n"); - for(int i=0; i<80; ++i) printf("#"); + for(int32_t i=0; i<80; ++i) printf("#"); printf("\nTC: %s\n", testCase.name); fflush(stdout); } - int status = RunTestCase( testCase ); + int32_t status = RunTestCase( testCase ); if( ! suppressOutput ) { @@ -107,8 +107,8 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu } else // Parent process { - int status = 0; - int childPid = waitpid(pid, &status, 0); + int32_t status = 0; + int32_t childPid = waitpid(pid, &status, 0); if( childPid == -1 ) { perror("waitpid"); @@ -127,7 +127,7 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu } else if(WIFSIGNALED(status) ) { - int signal = WTERMSIG(status); + int32_t signal = WTERMSIG(status); testResult = EXIT_STATUS_TESTCASE_ABORTED; if( signal == SIGABRT ) { @@ -148,7 +148,7 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu return testResult; } -void OutputStatistics( const char* processName, int numPasses, int numFailures ) +void OutputStatistics( const char* processName, int32_t numPasses, int32_t numFailures ) { FILE* fp=fopen("summary.xml", "a"); if( fp != NULL ) @@ -175,15 +175,15 @@ void OutputStatistics( const char* processName, int numPasses, int numFailures ) } } -int RunAll( const char* processName, ::testcase tc_array[] ) +int32_t RunAll( const char* processName, ::testcase tc_array[] ) { - int numFailures = 0; - int numPasses = 0; + int32_t numFailures = 0; + int32_t numPasses = 0; // Run test cases in child process( to kill output/handle signals ), but run serially. - for( unsigned int i=0; tc_array[i].name; i++) + for( uint32_t i=0; tc_array[i].name; i++) { - int result = RunTestCaseInChildProcess( tc_array[i], false ); + int32_t result = RunTestCaseInChildProcess( tc_array[i], false ); if( result == 0 ) { numPasses++; @@ -200,26 +200,26 @@ int RunAll( const char* processName, ::testcase tc_array[] ) } // Constantly runs up to MAX_NUM_CHILDREN processes -int RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRunFailed) +int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRunFailed) { - int numFailures = 0; - int numPasses = 0; + int32_t numFailures = 0; + int32_t numPasses = 0; RunningTestCases children; - std::vector failedTestCases; + std::vector failedTestCases; // Fork up to MAX_NUM_CHILDREN processes, then // wait. As soon as a proc completes, fork the next. - int nextTestCase = 0; - int numRunningChildren = 0; + int32_t nextTestCase = 0; + int32_t numRunningChildren = 0; while( tc_array[nextTestCase].name || numRunningChildren > 0) { // Create more children (up to the max number or til the end of the array) while( numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name ) { - int pid = fork(); + int32_t pid = fork(); if( pid == 0 ) // Child process { close(STDOUT_FILENO); @@ -242,8 +242,8 @@ int RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRu // Wait for the next child to finish - int status=0; - int childPid = waitpid(-1, &status, 0); + int32_t status=0; + int32_t childPid = waitpid(-1, &status, 0); if( childPid == -1 ) { perror("waitpid"); @@ -254,7 +254,7 @@ int RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRu { if( childPid > 0 ) { - int testResult = WEXITSTATUS(status); + int32_t testResult = WEXITSTATUS(status); if( testResult ) { printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult); @@ -296,12 +296,12 @@ int RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRu if( reRunFailed ) { - for( unsigned int i=0; i