43 #include "irplib_plugin.h"
63 #define LINE_LEN_MAX 1024
67 #define DEV_RANDOM "/dev/urandom"
70 #define recipe_assert(bool) \
71 ((bool) ? (cpl_msg_debug(cpl_func, \
72 "OK in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s",__LINE__, \
73 cpl_error_get_message(), cpl_error_get_where(), #bool), 0) \
74 : (cpl_msg_error(cpl_func, \
75 "Failure in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s", \
76 __LINE__, cpl_error_get_message(), cpl_error_get_where(), #bool), 1))
84 static const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *,
89 static void recipe_parameterlist_set(cpl_parameterlist *);
90 static cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin *,
93 static void recipe_frameset_load(cpl_frameset *,
const char *);
95 static void recipe_sof_test_devfile(cpl_plugin *,
const char *,
size_t,
97 static void recipe_sof_test_image_empty(cpl_plugin *,
size_t,
const char *[]);
98 static void recipe_sof_test_local(cpl_plugin *);
99 static void recipe_sof_test_from_env(cpl_plugin *);
100 static void recipe_frameset_empty(cpl_frameset *);
101 static void recipe_frameset_test_frame(
const cpl_frame *);
102 static void recipe_frameset_test_frameset_diff(
const cpl_frameset *,
103 const cpl_frameset *);
105 static cpl_errorstate inistate;
124 const char * irplib_parameterlist_get_string(
const cpl_parameterlist *
self,
125 const char * instrume,
127 const char * parameter)
130 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
134 cpl_ensure(par != NULL, cpl_error_get_code(), NULL);
136 value = cpl_parameter_get_string(par);
138 if (value == NULL) (void)cpl_error_set_where(cpl_func);
155 cpl_boolean irplib_parameterlist_get_bool(
const cpl_parameterlist *
self,
156 const char * instrume,
158 const char * parameter)
161 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
163 cpl_errorstate prestate = cpl_errorstate_get();
167 cpl_ensure(par != NULL, cpl_error_get_code(), CPL_FALSE);
169 value = cpl_parameter_get_bool(par);
171 if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
189 int irplib_parameterlist_get_int(
const cpl_parameterlist *
self,
190 const char * instrume,
192 const char * parameter)
195 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
197 cpl_errorstate prestate = cpl_errorstate_get();
201 cpl_ensure(par != NULL, cpl_error_get_code(), 0);
203 value = cpl_parameter_get_int(par);
205 if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
221 double irplib_parameterlist_get_double(
const cpl_parameterlist *
self,
222 const char * instrume,
224 const char * parameter)
227 const cpl_parameter * par = irplib_parameterlist_get(
self, instrume,
229 cpl_errorstate prestate = cpl_errorstate_get();
233 cpl_ensure(par != NULL, cpl_error_get_code(), 0.0);
235 value = cpl_parameter_get_double(par);
237 if (!cpl_errorstate_is_equal(prestate)) (void)cpl_error_set_where(cpl_func);
257 cpl_error_code irplib_parameterlist_set_string(cpl_parameterlist *
self,
258 const char * instrume,
260 const char * parameter,
261 const char * defvalue,
263 const char * context,
267 cpl_error_code error;
269 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
272 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
274 par = cpl_parameter_new_value(paramname, CPL_TYPE_STRING, man, context,
278 cpl_ensure_code(par != NULL, cpl_error_get_code());
280 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
281 alias ? alias : parameter);
282 cpl_ensure_code(!error, error);
284 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
285 cpl_ensure_code(!error, error);
287 error = cpl_parameterlist_append(
self, par);
288 cpl_ensure_code(!error, error);
290 return CPL_ERROR_NONE;
309 cpl_error_code irplib_parameterlist_set_bool(cpl_parameterlist *
self,
310 const char * instrume,
312 const char * parameter,
313 cpl_boolean defvalue,
315 const char * context,
319 cpl_error_code error;
321 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
324 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
326 par = cpl_parameter_new_value(paramname, CPL_TYPE_BOOL, man, context,
330 cpl_ensure_code(par != NULL, cpl_error_get_code());
332 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
333 alias ? alias : parameter);
334 cpl_ensure_code(!error, error);
336 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
337 cpl_ensure_code(!error, error);
339 error = cpl_parameterlist_append(
self, par);
340 cpl_ensure_code(!error, error);
342 return CPL_ERROR_NONE;
362 cpl_error_code irplib_parameterlist_set_int(cpl_parameterlist *
self,
363 const char * instrume,
365 const char * parameter,
368 const char * context,
372 cpl_error_code error;
374 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
377 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
379 par = cpl_parameter_new_value(paramname, CPL_TYPE_INT, man, context,
383 cpl_ensure_code(par != NULL, cpl_error_get_code());
385 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
386 alias ? alias : parameter);
387 cpl_ensure_code(!error, error);
389 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
390 cpl_ensure_code(!error, error);
392 error = cpl_parameterlist_append(
self, par);
393 cpl_ensure_code(!error, error);
395 return CPL_ERROR_NONE;
414 cpl_error_code irplib_parameterlist_set_double(cpl_parameterlist *
self,
415 const char * instrume,
417 const char * parameter,
420 const char * context,
424 cpl_error_code error;
426 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
429 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
431 par = cpl_parameter_new_value(paramname, CPL_TYPE_DOUBLE, man, context,
435 cpl_ensure_code(par != NULL, cpl_error_get_code());
437 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
438 alias ? alias : parameter);
439 cpl_ensure_code(!error, error);
441 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
442 cpl_ensure_code(!error, error);
444 error = cpl_parameterlist_append(
self, par);
445 cpl_ensure_code(!error, error);
447 return CPL_ERROR_NONE;
466 int irplib_plugin_test(cpl_pluginlist *
self,
size_t nstr,
const char *astr[]) {
470 int (*recipe_create) (cpl_plugin *);
471 int (*recipe_exec ) (cpl_plugin *);
472 int (*recipe_deinit) (cpl_plugin *);
473 cpl_error_code error;
475 cpl_boolean is_debug;
478 is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG ? CPL_TRUE : CPL_FALSE;
481 stream = is_debug ? stdout : fopen(
"/dev/null",
"a");
483 inistate = cpl_errorstate_get();
485 assert( nstr == 0 || astr != NULL );
487 plugin = cpl_pluginlist_get_first(
self);
489 if (plugin == NULL) {
490 cpl_msg_warning(cpl_func,
"With an empty pluginlist, "
491 "no tests can be made");
495 cpl_plugin_dump(plugin, stream);
497 recipe_create = cpl_plugin_get_init(plugin);
498 cpl_test( recipe_create != NULL);
500 recipe_exec = cpl_plugin_get_exec(plugin);
501 cpl_test( recipe_exec != NULL);
503 recipe_deinit = cpl_plugin_get_deinit(plugin);
504 cpl_test( recipe_deinit != NULL);
507 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
508 cpl_msg_warning(cpl_func,
"This plugin is not of type recipe, "
509 "cannot test further");
513 if (recipe_create != NULL && recipe_exec != NULL && recipe_deinit != NULL) {
515 cpl_test_zero(recipe_create(plugin));
517 recipe = (cpl_recipe *) plugin;
519 cpl_test_nonnull( recipe->parameters );
521 recipe_parameterlist_set(recipe->parameters);
523 cpl_parameterlist_dump(recipe->parameters, stream);
525 recipe->frames = cpl_frameset_new();
527 if (irplib_plugin_has_sof_from_env(plugin,
"RECIPE_SOF_PATH")) {
529 recipe_sof_test_from_env(plugin);
533 const cpl_msg_severity msg_level = cpl_msg_get_level();
537 if (getenv(
"CPL_MSG_LEVEL") == NULL) cpl_msg_set_level(CPL_MSG_OFF);
539 cpl_msg_info(cpl_func,
"Checking handling of pre-existing CPL error "
540 "state - may produce warning(s)/error(s):");
541 cpl_error_set(cpl_func, CPL_ERROR_EOL);
543 cpl_test( recipe_exec(plugin) );
545 cpl_test_error( CPL_ERROR_EOL );
547 cpl_msg_info(cpl_func,
"Checking handling of empty frameset - "
548 "may produce warning(s)/error(s):");
550 cpl_test( recipe_exec(plugin) );
551 error = cpl_error_get_code();
553 cpl_test_error( error );
556 cpl_msg_info(cpl_func,
"Checking handling of dummy frameset - "
557 "may produce warning(s)/error(s):");
559 cpl_frame * f = cpl_frame_new();
560 error = cpl_frame_set_filename(f,
"/dev/null");
561 cpl_test_eq_error(error, CPL_ERROR_NONE);
562 error = cpl_frame_set_tag(f,
"RECIPE_DUMMY_TAG");
563 cpl_test_eq_error(error, CPL_ERROR_NONE);
564 error = cpl_frameset_insert(recipe->frames, f);
565 cpl_test_eq_error(error, CPL_ERROR_NONE);
568 cpl_test( recipe_exec(plugin) );
569 error = cpl_error_get_code();
571 cpl_test_error( error );
574 error = cpl_frameset_erase_frame(recipe->frames, f);
575 cpl_test_eq_error(error, CPL_ERROR_NONE);
579 #ifdef IRPLIB_TEST_RANDOM_SOF
580 recipe_sof_test_devfile(plugin, DEV_RANDOM, nstr, astr);
583 recipe_sof_test_devfile(plugin,
"/dev/null", nstr, astr);
585 recipe_sof_test_devfile(plugin,
".", nstr, astr);
587 recipe_sof_test_image_empty(plugin, nstr, astr);
589 recipe_sof_test_local(plugin);
591 cpl_msg_set_level(msg_level);
595 cpl_frameset_delete(recipe->frames);
597 error = recipe_deinit(plugin);
598 cpl_test_eq_error(error, CPL_ERROR_NONE);
601 if (stream != stdout) fclose(stream);
619 static void recipe_parameterlist_set(cpl_parameterlist *
self)
622 cpl_parameter * p = cpl_parameterlist_get_first(
self);
624 for (; p != NULL; p = cpl_parameterlist_get_next(
self)) {
630 if (cpl_parameter_get_default_flag(p))
continue;
632 cpl_msg_debug(cpl_func, __FILE__
" line %u: OK", __LINE__);
634 envvar = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_ENV);
635 svalue = envvar ? getenv(envvar) : NULL;
637 switch (cpl_parameter_get_type(p)) {
638 case CPL_TYPE_BOOL: {
640 = svalue ? atoi(svalue) : cpl_parameter_get_default_bool(p);
641 cpl_parameter_set_bool(p, value);
646 = svalue ? atoi(svalue) : cpl_parameter_get_default_int(p);
647 cpl_parameter_set_int(p, value);
650 case CPL_TYPE_DOUBLE: {
652 = svalue ? atof(svalue) : cpl_parameter_get_default_double(p);
653 cpl_parameter_set_double(p, value);
656 case CPL_TYPE_STRING:
658 const char * s_default = cpl_parameter_get_default_string(p);
661 = svalue ? svalue : (s_default ? s_default :
"");
662 cpl_parameter_set_string(p, value);
684 static void recipe_sof_test_devfile(cpl_plugin * plugin,
const char * filename,
685 size_t nstr,
const char *astr[])
687 cpl_recipe * recipe = (cpl_recipe*)plugin;
688 int (*recipe_exec) (cpl_plugin *);
690 cpl_error_code error;
694 if (nstr < 1)
return;
695 if (filename == NULL)
return;
697 cpl_msg_info(cpl_func,
"Testing recipe with %u %s as input ",
698 (
unsigned)nstr, filename);
700 for (i = 0; i < nstr; i++) {
701 cpl_frame * f = cpl_frame_new();
703 error = cpl_frame_set_filename(f, filename);
704 cpl_test_eq_error(error, CPL_ERROR_NONE);
706 error = cpl_frame_set_tag(f, astr[i]);
707 cpl_test_eq_error(error, CPL_ERROR_NONE);
709 error = cpl_frameset_insert(recipe->frames, f);
710 cpl_test_eq_error(error, CPL_ERROR_NONE);
713 copy = cpl_frameset_duplicate(recipe->frames);
715 recipe_exec = cpl_plugin_get_exec(plugin);
716 cpl_test( recipe_exec != NULL);
718 if (recipe_exec != NULL) {
721 cpl_test( recipe_exec(plugin) );
722 error = cpl_error_get_code();
724 cpl_test_error( error );
727 recipe_frameset_test_frameset_diff(recipe->frames, copy);
729 recipe_frameset_empty(recipe->frames);
732 cpl_frameset_delete(copy);
745 static void recipe_sof_test_image_empty(cpl_plugin * plugin,
size_t nstr,
748 cpl_recipe * recipe = (cpl_recipe*)plugin;
749 int (*recipe_exec) (cpl_plugin *);
751 cpl_error_code error;
758 if (nstr < 1)
return;
760 cpl_msg_info(cpl_func,
"Testing recipe with %u empty images as input ",
763 iempty = cpl_image_new(13, 17, CPL_TYPE_FLOAT);
764 cpl_test_nonnull(iempty);
766 for (i = 0; i < nstr; i++) {
767 cpl_frame * f = cpl_frame_new();
768 char * rawname = cpl_sprintf(
"%s-raw%05u.fits",
769 cpl_plugin_get_name(plugin),
772 error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
774 cpl_test_eq_error(error, CPL_ERROR_NONE);
776 error = cpl_frame_set_filename(f, rawname);
777 cpl_test_eq_error(error, CPL_ERROR_NONE);
779 error = cpl_frame_set_tag(f, astr[i]);
780 cpl_test_eq_error(error, CPL_ERROR_NONE);
782 error = cpl_frameset_insert(recipe->frames, f);
783 cpl_test_eq_error(error, CPL_ERROR_NONE);
787 cpl_image_delete(iempty);
789 copy = cpl_frameset_duplicate(recipe->frames);
791 recipe_exec = cpl_plugin_get_exec(plugin);
792 cpl_test(recipe_exec != NULL);
794 if (recipe_exec != NULL) {
799 retstat = recipe_exec(plugin);
800 error = cpl_error_get_code();
803 cpl_test_zero(retstat);
807 cpl_test_error( error );
809 recipe_frameset_test_frameset_diff(recipe->frames, copy);
811 for (frame = cpl_frameset_get_first(recipe->frames); frame != NULL;
812 frame = cpl_frameset_get_next(recipe->frames))
814 cpl_test_zero(
remove(cpl_frame_get_filename(frame)) );
817 recipe_frameset_empty(recipe->frames);
820 cpl_frameset_delete(copy);
835 cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin * plugin,
836 const char * envname)
838 const char * recipename = cpl_plugin_get_name(plugin);
839 const char * sof_path = envname ? getenv(envname) : NULL;
840 cpl_frameset * frames;
842 const cpl_frame * ffirst;
844 cpl_ensure(plugin != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
845 cpl_ensure(envname != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
846 cpl_ensure(recipename != NULL, CPL_ERROR_DATA_NOT_FOUND, CPL_FALSE);
847 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
849 if (sof_path == NULL)
return CPL_FALSE;
851 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
853 frames = cpl_frameset_new();
854 recipe_frameset_load(frames, sof_name);
856 ffirst = cpl_frameset_get_position_const(frames, 0);
859 cpl_frameset_delete(frames);
861 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
863 return ffirst ? CPL_TRUE : CPL_FALSE;
875 static void recipe_sof_test_from_env(cpl_plugin * plugin)
877 cpl_recipe * recipe = (cpl_recipe*)plugin;
878 const char * recipename = cpl_plugin_get_name(plugin);
879 const char * var_name =
"RECIPE_SOF_PATH";
880 const char * sof_path = getenv(var_name);
881 cpl_error_code error;
885 if (sof_path == NULL) {
886 cpl_msg_warning(cpl_func,
"Environment variable %s is unset: "
887 "No SOFs to check", var_name);
891 cpl_msg_debug(cpl_func,
"Checking for SOFs in %s", sof_path);
893 cpl_test_nonnull( recipename );
894 if (recipename == NULL)
return;
896 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
898 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
900 recipe_frameset_load(recipe->frames, sof_name);
902 if (!cpl_frameset_is_empty(recipe->frames)) {
904 int (*recipe_exec ) (cpl_plugin *);
905 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
907 recipe_exec = cpl_plugin_get_exec(plugin);
908 cpl_test(recipe_exec != NULL);
910 if (recipe_exec != NULL) {
911 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
914 cpl_test_zero( recipe_exec(plugin) );
916 cpl_test_error(CPL_ERROR_NONE);
918 error = cpl_dfs_update_product_header(recipe->frames);
919 cpl_test_eq_error(error, CPL_ERROR_NONE);
921 recipe_frameset_test_frameset_diff(recipe->frames, copy);
923 recipe_frameset_empty(recipe->frames);
926 cpl_frameset_delete(copy);
945 static void recipe_sof_test_local(cpl_plugin * plugin)
947 cpl_recipe * recipe = (cpl_recipe*)plugin;
948 const char * recipename = cpl_plugin_get_name(plugin);
949 cpl_error_code error;
950 char * sof_name = cpl_sprintf(
"%s.sof", recipename);
952 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
954 recipe_frameset_load(recipe->frames, sof_name);
956 if (!cpl_frameset_is_empty(recipe->frames)) {
958 int (*recipe_exec ) (cpl_plugin *);
959 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
961 recipe_exec = cpl_plugin_get_exec(plugin);
962 cpl_test(recipe_exec != NULL);
964 if (recipe_exec != NULL) {
966 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
969 cpl_test_zero( recipe_exec(plugin) );
971 cpl_test_error(CPL_ERROR_NONE);
973 error = cpl_dfs_update_product_header(recipe->frames);
974 cpl_test_eq_error( error, CPL_ERROR_NONE );
976 recipe_frameset_test_frameset_diff(recipe->frames, copy);
978 recipe_frameset_empty(recipe->frames);
981 cpl_frameset_delete(copy);
1008 static void recipe_frameset_load(cpl_frameset *
set,
const char *name)
1012 char line[LINE_LEN_MAX];
1013 char path[LINE_LEN_MAX], group[LINE_LEN_MAX], tag[LINE_LEN_MAX];
1016 assert(
set != NULL );
1017 assert( name != NULL );
1019 fp = fopen(name,
"r");
1021 cpl_msg_debug(cpl_func,
"Unable to open SOF file '%s'", name);
1026 for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) {
1029 cpl_frame_group grp;
1033 if (line[0] ==
'#')
continue;
1035 snprintf(scan_fmt, 49,
"%%%ds %%%ds %%%ds", LINE_LEN_MAX - 1,
1036 LINE_LEN_MAX - 1, LINE_LEN_MAX - 1);
1037 n = sscanf(line, scan_fmt, path, tag, group);
1040 cpl_msg_warning(cpl_func,
"Spurious line no. %d in %s: %s",
1041 line_number, name, line);
1046 frame = cpl_frame_new();
1049 cpl_frame_set_filename(frame, path);
1052 cpl_frame_set_tag(frame, n == 1 ?
"" : tag);
1054 cpl_frameset_insert(
set, frame);
1057 if (n < 3)
continue;
1059 if (!strcmp(group, CPL_FRAME_GROUP_RAW_ID))
1060 grp = CPL_FRAME_GROUP_RAW;
1061 else if (!strcmp(group, CPL_FRAME_GROUP_CALIB_ID))
1062 grp = CPL_FRAME_GROUP_CALIB;
1063 else if (!strcmp(group, CPL_FRAME_GROUP_PRODUCT_ID))
1064 grp = CPL_FRAME_GROUP_PRODUCT;
1066 grp = CPL_FRAME_GROUP_NONE;
1068 cpl_frame_set_group(frame, grp);
1090 const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *
self,
1091 const char * instrume,
1092 const char * recipe,
1093 const char * parameter)
1097 const cpl_parameter * par;
1100 cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL);
1101 cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL);
1102 cpl_ensure(parameter != NULL, CPL_ERROR_NULL_INPUT, NULL);
1104 paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe, parameter);
1106 par = cpl_parameterlist_find_const(
self, paramname);
1108 if (par == NULL) (void)cpl_error_set_message(cpl_func,
1109 cpl_error_get_code()
1110 ? cpl_error_get_code()
1111 : CPL_ERROR_DATA_NOT_FOUND,
1114 cpl_free(paramname);
1148 static void recipe_frameset_empty(cpl_frameset *
self)
1153 cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
1157 for (f = cpl_frameset_get_first(
self); f != NULL;
1158 f = cpl_frameset_get_first(
self))
1160 cpl_frameset_erase_frame(
self, f);
1186 static void recipe_frameset_test_frame(
const cpl_frame *
self)
1189 cpl_msg_info(cpl_func,
"Validating new frame: %s",
1190 cpl_frame_get_filename(
self));
1192 cpl_test_nonnull(
self);
1195 cpl_test_nonnull(cpl_frame_get_tag(
self));
1198 cpl_test_eq(cpl_frame_get_group(
self), CPL_FRAME_GROUP_PRODUCT);
1200 if (cpl_frame_get_type(
self) != CPL_FRAME_TYPE_PAF) {
1202 cpl_test_fits(cpl_frame_get_filename(
self));
1205 cpl_test_nonnull(cpl_frame_get_filename(
self));
1231 static void recipe_frameset_test_frameset_diff(
const cpl_frameset *
self,
1232 const cpl_frameset * other)
1235 const cpl_frame * frame = cpl_frameset_get_first_const(other);
1238 for (;frame != NULL; frame = cpl_frameset_get_next_const(other)) {
1239 const char * file = cpl_frame_get_filename(frame);
1242 cpl_test_nonnull(cpl_frame_get_filename(frame));
1246 if (frame != NULL)
return;
1248 frame = cpl_frameset_get_first_const(
self);
1250 for (;frame != NULL; frame = cpl_frameset_get_next_const(
self)) {
1251 const cpl_frame * cmp = cpl_frameset_get_first_const(other);
1252 const char * file = cpl_frame_get_filename(frame);
1255 cpl_test_nonnull(cpl_frame_get_filename(frame));
1259 for (;cmp != NULL; cmp = cpl_frameset_get_next_const(other)) {
1260 const char * cfile = cpl_frame_get_filename(cmp);
1262 if (!strcmp(file, cfile))
break;
1268 cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT);
1269 recipe_frameset_test_frame(frame);