diff options
author | Jim Cownie <james.h.cownie@intel.com> | 2014-05-10 17:02:09 +0000 |
---|---|---|
committer | Jim Cownie <james.h.cownie@intel.com> | 2014-05-10 17:02:09 +0000 |
commit | 18d8473f185999e418dcb62ee4d8a671c2eacee5 (patch) | |
tree | d212f5cac426b2be33035984fc56623f92f5ddde /openmp/testsuite/ompts_standaloneProc.c | |
parent | 281f9d0e97dca0594a15341e3c927e2667773104 (diff) | |
download | bcm5719-llvm-18d8473f185999e418dcb62ee4d8a671c2eacee5.tar.gz bcm5719-llvm-18d8473f185999e418dcb62ee4d8a671c2eacee5.zip |
Add testsuite from OpenUH
llvm-svn: 208472
Diffstat (limited to 'openmp/testsuite/ompts_standaloneProc.c')
-rw-r--r-- | openmp/testsuite/ompts_standaloneProc.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/openmp/testsuite/ompts_standaloneProc.c b/openmp/testsuite/ompts_standaloneProc.c new file mode 100644 index 00000000000..b03052a51e4 --- /dev/null +++ b/openmp/testsuite/ompts_standaloneProc.c @@ -0,0 +1,51 @@ +int main() +{ + int i; /* Loop index */ + int result; /* return value of the program */ + int failed=0; /* Number of failed tests */ + int success=0; /* number of succeeded tests */ + static FILE * logFile; /* pointer onto the logfile */ + static const char * logFileName = "bin/c/<testfunctionname></testfunctionname>.log"; /* name of the logfile */ + + + /* Open a new Logfile or overwrite the existing one. */ + logFile = fopen(logFileName,"w+"); + + printf("######## OpenMP Validation Suite V %s ######\n", OMPTS_VERSION ); + printf("## Repetitions: %3d ####\n",REPETITIONS); + printf("## Loop Count : %6d ####\n",LOOPCOUNT); + printf("##############################################\n"); + printf("Testing <directive></directive>\n\n"); + + fprintf(logFile,"######## OpenMP Validation Suite V %s ######\n", OMPTS_VERSION ); + fprintf(logFile,"## Repetitions: %3d ####\n",REPETITIONS); + fprintf(logFile,"## Loop Count : %6d ####\n",LOOPCOUNT); + fprintf(logFile,"##############################################\n"); + fprintf(logFile,"Testing <directive></directive>\n\n"); + + for ( i = 0; i < REPETITIONS; i++ ) { + fprintf (logFile, "\n\n%d. run of <testfunctionname></testfunctionname> out of %d\n\n",i+1,REPETITIONS); + if(<testfunctionname></testfunctionname>(logFile)){ + fprintf(logFile,"Test successful.\n"); + success++; + } + else { + fprintf(logFile,"Error: Test failed.\n"); + printf("Error: Test failed.\n"); + failed++; + } + } + + if(failed==0){ + fprintf(logFile,"\nDirective worked without errors.\n"); + printf("Directive worked without errors.\n"); + result=0; + } + else{ + fprintf(logFile,"\nDirective failed the test %i times out of %i. %i were successful\n",failed,REPETITIONS,success); + printf("Directive failed the test %i times out of %i.\n%i test(s) were successful\n",failed,REPETITIONS,success); + result = (int) (((double) failed / (double) REPETITIONS ) * 100 ); + } + printf ("Result: %i\n", result); + return result; +} |