[trunk] Properly handle number of components to run kakadu test suite.

Update issue 266
This commit is contained in:
Mathieu Malaterre 2014-03-10 13:05:20 +00:00
parent b01c1240cf
commit 856fc0652f
2 changed files with 22 additions and 28 deletions

View File

@ -115,13 +115,13 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
char s[255]; char s[255];
char *outFilename, *ptr; char *outFilename, *ptr;
const char token = '.'; const char token = '.';
int posToken = 0; size_t posToken = 0;
int decod_format; int decod_format;
/*printf("inFilename = %s\n", inFilename);*/ /*printf("inFilename = %s\n", inFilename);*/
if ((ptr = strrchr(inFilename, token)) != NULL) if ((ptr = strrchr(inFilename, token)) != NULL)
{ {
posToken = (int) (strlen(inFilename) - strlen(ptr)); posToken = strlen(inFilename) - strlen(ptr);
/*printf("Position of %c character inside inFilename = %d\n", token, posToken);*/ /*printf("Position of %c character inside inFilename = %d\n", token, posToken);*/
} }
else else
@ -132,14 +132,10 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
return outFilename; return outFilename;
} }
outFilename = (char*)malloc((size_t)(posToken + 7) * sizeof(char)); /*6*/ outFilename = (char*)malloc((posToken + 7) * sizeof(char)); /*6*/
strncpy(outFilename, inFilename, (size_t)posToken);
outFilename[posToken] = '\0';
strncpy(outFilename, inFilename, posToken);
strcat(outFilename, separator); strcat(outFilename, separator);
sprintf(s, "%i", indexF); sprintf(s, "%i", indexF);
strcat(outFilename, s); strcat(outFilename, s);
@ -504,7 +500,7 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
{ {
char *MSElistvalues = NULL; char *PEAKlistvalues= NULL; char *MSElistvalues = NULL; char *PEAKlistvalues= NULL;
char *separatorList = NULL; char *separatorList = NULL;
int sizemembasefile, sizememtestfile; size_t sizemembasefile, sizememtestfile;
int index, flagM=0, flagP=0; int index, flagM=0, flagP=0;
const char optlist[] = "b:t:n:m:p:s:d"; const char optlist[] = "b:t:n:m:p:s:d";
int c; int c;
@ -525,19 +521,15 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
switch (c) switch (c)
{ {
case 'b': case 'b':
sizemembasefile = (int)strlen(opj_optarg)+1; sizemembasefile = strlen(opj_optarg) + 1;
param->base_filename = (char*) malloc((size_t)sizemembasefile); param->base_filename = (char*) malloc(sizemembasefile);
param->base_filename[0] = '\0'; strcpy(param->base_filename, opj_optarg);
strncpy(param->base_filename, opj_optarg, strlen(opj_optarg));
param->base_filename[strlen(opj_optarg)] = '\0';
/*printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );*/ /*printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );*/
break; break;
case 't': case 't':
sizememtestfile = (int) strlen(opj_optarg) + 1; sizememtestfile = strlen(opj_optarg) + 1;
param->test_filename = (char*) malloc((size_t)sizememtestfile); param->test_filename = (char*) malloc(sizememtestfile);
param->test_filename[0] = '\0'; strcpy(param->test_filename, opj_optarg);
strncpy(param->test_filename, opj_optarg, strlen(opj_optarg));
param->test_filename[strlen(opj_optarg)] = '\0';
/*printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);*/ /*printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);*/
break; break;
case 'n': case 'n':
@ -600,11 +592,9 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
if( (strlen(separatorList) ==2) || (strlen(separatorList) ==4) ) if( (strlen(separatorList) ==2) || (strlen(separatorList) ==4) )
{ {
/* keep original string*/ /* keep original string*/
int sizeseplist = (int)strlen(separatorList)+1; size_t sizeseplist = strlen(separatorList)+1;
char* separatorList2 = (char*)malloc( (size_t)sizeseplist ); char* separatorList2 = (char*)malloc( sizeseplist );
separatorList2[0] = '\0'; strcpy(separatorList2, separatorList);
strncpy(separatorList2, separatorList, strlen(separatorList));
separatorList2[strlen(separatorList)] = '\0';
/*printf("separatorList2 = %s [%d / %d]\n", separatorList2, strlen(separatorList2), sizeseplist);*/ /*printf("separatorList2 = %s [%d / %d]\n", separatorList2, strlen(separatorList2), sizeseplist);*/
if (strlen(separatorList) == 2) /* one separator behind b or t*/ if (strlen(separatorList) == 2) /* one separator behind b or t*/

View File

@ -516,14 +516,19 @@ foreach(kdu_file ${kdu_j2k_conf_files})
-o ${TEMP}/${filenameInput}.ppm -o ${TEMP}/${filenameInput}.ppm
) )
if("${kdu_file}" STREQUAL "a6_mono_colr")
set(kdu_test_args "-n 4 -s b_t_")
else()
set(kdu_test_args "-n 1")
endif()
add_test(NAME ETS-KDU-${filenameInput}-compare2ref add_test(NAME ETS-KDU-${filenameInput}-compare2ref
COMMAND compare_images COMMAND compare_images
-b ${BASELINE_CONF}/${filenameRef} -b ${BASELINE_CONF}/${filenameRef}
-t ${TEMP}/${filenameInput}.ppm -t ${TEMP}/${filenameInput}.ppm
-n 3 ${kdu_test_args}
-p 4:4:4 -p 4:4:4
-m 4:4:4 -m 4:4:4
-s b_t_
) )
set_tests_properties(ETS-KDU-${filenameInput}-compare2ref set_tests_properties(ETS-KDU-${filenameInput}-compare2ref
@ -534,9 +539,8 @@ foreach(kdu_file ${kdu_j2k_conf_files})
COMMAND compare_images COMMAND compare_images
-b ${BASELINE_NR}/opj_${filenameRef} -b ${BASELINE_NR}/opj_${filenameRef}
-t ${TEMP}/${filenameInput}.ppm -t ${TEMP}/${filenameInput}.ppm
-n 3 ${kdu_test_args}
-d -d
-s b_t_
) )
set_tests_properties(NR-KDU-${filenameInput}-compare2base set_tests_properties(NR-KDU-${filenameInput}-compare2base