36#include "irplib_plugin.h"
38#include "irplib_utils.h"
62#define LINE_LEN_MAX 1023
65#define LINE_SCAN_FMT \
66 "%" CPL_STRINGIFY(LINE_LEN_MAX) "s " \
67 "%" CPL_STRINGIFY(LINE_LEN_MAX) "s " \
68 "%" CPL_STRINGIFY(LINE_LEN_MAX) "s"
71#define DEV_RANDOM "/dev/urandom"
74#define recipe_assert(bool) \
75 ((bool) ? (cpl_msg_debug(cpl_func, \
76 "OK in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s",__LINE__, \
77 cpl_error_get_message(), cpl_error_get_where(), #bool), 0) \
78 : (cpl_msg_error(cpl_func, \
79 "Failure in " __FILE__ " line %d (CPL-error state: '%s' in %s): %s", \
80 __LINE__, cpl_error_get_message(), cpl_error_get_where(), #bool), 1))
88static const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist *,
93static void recipe_parameterlist_set(cpl_parameterlist *);
94static cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin *,
97static void recipe_frameset_load(cpl_frameset *,
const char *);
99static void recipe_sof_test_devfile(cpl_plugin *,
const char *,
size_t,
101static void recipe_sof_test_image_empty(cpl_plugin *,
size_t,
const char *[]);
102static void recipe_sof_test_local(cpl_plugin *);
103static void recipe_sof_test_from_env(cpl_plugin *);
104static void recipe_frameset_empty(cpl_frameset *);
105static void recipe_frameset_test_frame(
const cpl_frame *);
106static void recipe_frameset_test_frameset_diff(
const cpl_frameset *,
107 const cpl_frameset *);
109static cpl_errorstate inistate;
128const char * irplib_parameterlist_get_string(
const cpl_parameterlist * self,
129 const char * instrume,
131 const char * parameter)
133 const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
138 (void)cpl_error_set_where(cpl_func);
142 const char * value = cpl_parameter_get_string(par);
144 if (value == NULL) (void)cpl_error_set_where(cpl_func);
161cpl_boolean irplib_parameterlist_get_bool(
const cpl_parameterlist * self,
162 const char * instrume,
164 const char * parameter)
166 const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
171 (void)cpl_error_set_where(cpl_func);
175 cpl_errorstate prestate = cpl_errorstate_get();
176 const cpl_boolean value = cpl_parameter_get_bool(par);
178 if (!cpl_errorstate_is_equal(prestate))
179 (void)cpl_error_set_where(cpl_func);
197int irplib_parameterlist_get_int(
const cpl_parameterlist * self,
198 const char * instrume,
200 const char * parameter)
202 const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
207 (void)cpl_error_set_where(cpl_func);
211 cpl_errorstate prestate = cpl_errorstate_get();
212 const int value = cpl_parameter_get_int(par);
214 if (!cpl_errorstate_is_equal(prestate))
215 (void)cpl_error_set_where(cpl_func);
232double irplib_parameterlist_get_double(
const cpl_parameterlist * self,
233 const char * instrume,
235 const char * parameter)
237 const cpl_parameter * par = irplib_parameterlist_get(self, instrume,
242 (void)cpl_error_set_where(cpl_func);
246 cpl_errorstate prestate = cpl_errorstate_get();
247 const double value = cpl_parameter_get_double(par);
249 if (!cpl_errorstate_is_equal(prestate))
250 (void)cpl_error_set_where(cpl_func);
271cpl_error_code irplib_parameterlist_set_string(cpl_parameterlist * self,
272 const char * instrume,
274 const char * parameter,
275 const char * defvalue,
277 const char * context,
281 cpl_error_code error;
283 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
286 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
288 par = cpl_parameter_new_value(paramname, CPL_TYPE_STRING, man, context,
292 cpl_ensure_code(par != NULL, cpl_error_get_code());
294 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
295 alias ? alias : parameter);
296 cpl_ensure_code(!error, error);
298 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
299 cpl_ensure_code(!error, error);
301 error = cpl_parameterlist_append(self, par);
302 cpl_ensure_code(!error, error);
304 return CPL_ERROR_NONE;
323cpl_error_code irplib_parameterlist_set_bool(cpl_parameterlist * self,
324 const char * instrume,
326 const char * parameter,
327 cpl_boolean defvalue,
329 const char * context,
333 cpl_error_code error;
335 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
338 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
340 par = cpl_parameter_new_value(paramname, CPL_TYPE_BOOL, man, context,
344 cpl_ensure_code(par != NULL, cpl_error_get_code());
346 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
347 alias ? alias : parameter);
348 cpl_ensure_code(!error, error);
350 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
351 cpl_ensure_code(!error, error);
353 error = cpl_parameterlist_append(self, par);
354 cpl_ensure_code(!error, error);
356 return CPL_ERROR_NONE;
376cpl_error_code irplib_parameterlist_set_int(cpl_parameterlist * self,
377 const char * instrume,
379 const char * parameter,
382 const char * context,
386 cpl_error_code error;
388 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
391 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
393 par = cpl_parameter_new_value(paramname, CPL_TYPE_INT, man, context,
397 cpl_ensure_code(par != NULL, cpl_error_get_code());
399 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
400 alias ? alias : parameter);
401 cpl_ensure_code(!error, error);
403 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
404 cpl_ensure_code(!error, error);
406 error = cpl_parameterlist_append(self, par);
407 cpl_ensure_code(!error, error);
409 return CPL_ERROR_NONE;
428cpl_error_code irplib_parameterlist_set_double(cpl_parameterlist * self,
429 const char * instrume,
431 const char * parameter,
434 const char * context,
438 cpl_error_code error;
440 char * paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe,
443 cpl_ensure_code(paramname != NULL, cpl_error_get_code());
445 par = cpl_parameter_new_value(paramname, CPL_TYPE_DOUBLE, man, context,
449 cpl_ensure_code(par != NULL, cpl_error_get_code());
451 error = cpl_parameter_set_alias(par, CPL_PARAMETER_MODE_CLI,
452 alias ? alias : parameter);
453 cpl_ensure_code(!error, error);
455 error = cpl_parameter_disable(par, CPL_PARAMETER_MODE_ENV);
456 cpl_ensure_code(!error, error);
458 error = cpl_parameterlist_append(self, par);
459 cpl_ensure_code(!error, error);
461 return CPL_ERROR_NONE;
480int irplib_plugin_test(cpl_pluginlist * self,
size_t nstr,
const char *astr[]) {
483 int (*recipe_create) (cpl_plugin *);
484 int (*recipe_exec ) (cpl_plugin *);
485 int (*recipe_deinit) (cpl_plugin *);
487 cpl_boolean is_debug;
490 is_debug = cpl_msg_get_level() <= CPL_MSG_DEBUG ? CPL_TRUE : CPL_FALSE;
493 stream = is_debug ? stdout : fopen(
"/dev/null",
"a");
495 inistate = cpl_errorstate_get();
497 assert( nstr == 0 || astr != NULL );
499 plugin = cpl_pluginlist_get_first(self);
501 if (plugin == NULL) {
502 cpl_msg_warning(cpl_func,
"With an empty pluginlist, "
503 "no tests can be made");
507 cpl_plugin_dump(plugin, stream);
509 recipe_create = cpl_plugin_get_init(plugin);
510 cpl_test( recipe_create != NULL);
512 recipe_exec = cpl_plugin_get_exec(plugin);
513 cpl_test( recipe_exec != NULL);
515 recipe_deinit = cpl_plugin_get_deinit(plugin);
516 cpl_test( recipe_deinit != NULL);
519 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
520 cpl_msg_warning(cpl_func,
"This plugin is not of type recipe, "
521 "cannot test further");
525 if (recipe_create != NULL && recipe_exec != NULL && recipe_deinit != NULL) {
527 cpl_error_code error;
530 cpl_test_zero(recipe_create(plugin));
532 recipe = (cpl_recipe *) plugin;
534 cpl_test_nonnull( recipe->parameters );
536 recipe_parameterlist_set(recipe->parameters);
538 cpl_parameterlist_dump(recipe->parameters, stream);
540 recipe->frames = cpl_frameset_new();
542 if (irplib_plugin_has_sof_from_env(plugin,
"RECIPE_SOF_PATH")) {
544 recipe_sof_test_from_env(plugin);
548 const cpl_msg_severity msg_level = cpl_msg_get_level();
552 if (getenv(
"CPL_MSG_LEVEL") == NULL) cpl_msg_set_level(CPL_MSG_OFF);
554 cpl_msg_info(cpl_func,
"Checking handling of pre-existing CPL error "
555 "state - may produce warning(s)/error(s):");
556 cpl_error_set(cpl_func, CPL_ERROR_EOL);
558 cpl_test( recipe_exec(plugin) );
560 cpl_test_error( CPL_ERROR_EOL );
562 cpl_msg_info(cpl_func,
"Checking handling of empty frameset - "
563 "may produce warning(s)/error(s):");
565 cpl_test( recipe_exec(plugin) );
566 error = cpl_error_get_code();
568 cpl_test_error( error );
571 cpl_msg_info(cpl_func,
"Checking handling of dummy frameset - "
572 "may produce warning(s)/error(s):");
574 cpl_frame * f = cpl_frame_new();
575 error = cpl_frame_set_filename(f,
"/dev/null");
576 cpl_test_eq_error(error, CPL_ERROR_NONE);
577 error = cpl_frame_set_tag(f,
"RECIPE_DUMMY_TAG");
578 cpl_test_eq_error(error, CPL_ERROR_NONE);
579 error = cpl_frameset_insert(recipe->frames, f);
580 cpl_test_eq_error(error, CPL_ERROR_NONE);
583 cpl_test( recipe_exec(plugin) );
584 error = cpl_error_get_code();
586 cpl_test_error( error );
589 error = cpl_frameset_erase_frame(recipe->frames, f);
590 cpl_test_eq_error(error, CPL_ERROR_NONE);
594#ifdef IRPLIB_TEST_RANDOM_SOF
595 recipe_sof_test_devfile(plugin, DEV_RANDOM, nstr, astr);
598 recipe_sof_test_devfile(plugin,
"/dev/null", nstr, astr);
600 recipe_sof_test_devfile(plugin,
".", nstr, astr);
602 recipe_sof_test_image_empty(plugin, nstr, astr);
604 recipe_sof_test_local(plugin);
606 cpl_msg_set_level(msg_level);
610 cpl_frameset_delete(recipe->frames);
612 error = recipe_deinit(plugin);
613 cpl_test_eq_error(error, CPL_ERROR_NONE);
616 if (stream != stdout) fclose(stream);
634static void recipe_parameterlist_set(cpl_parameterlist * self)
637 cpl_parameter * p = cpl_parameterlist_get_first(self);
639 for (; p != NULL; p = cpl_parameterlist_get_next(self)) {
645 if (cpl_parameter_get_default_flag(p))
continue;
647 cpl_msg_debug(cpl_func, __FILE__
" line %u: OK", __LINE__);
649 envvar = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_ENV);
650 svalue = envvar ? getenv(envvar) : NULL;
652 switch (cpl_parameter_get_type(p)) {
653 case CPL_TYPE_BOOL: {
655 = svalue ? atoi(svalue) : cpl_parameter_get_default_bool(p);
656 cpl_parameter_set_bool(p, value);
661 = svalue ? atoi(svalue) : cpl_parameter_get_default_int(p);
662 cpl_parameter_set_int(p, value);
665 case CPL_TYPE_DOUBLE: {
667 = svalue ? atof(svalue) : cpl_parameter_get_default_double(p);
668 cpl_parameter_set_double(p, value);
671 case CPL_TYPE_STRING:
673 const char * s_default = cpl_parameter_get_default_string(p);
676 = svalue ? svalue : (s_default ? s_default :
"");
677 cpl_parameter_set_string(p, value);
699static void recipe_sof_test_devfile(cpl_plugin * plugin,
const char * filename,
700 size_t nstr,
const char *astr[])
702 cpl_recipe * recipe = (cpl_recipe*)plugin;
703 int (*recipe_exec) (cpl_plugin *);
705 cpl_error_code error;
709 if (nstr < 1)
return;
710 if (filename == NULL)
return;
712 cpl_msg_info(cpl_func,
"Testing recipe with %u %s as input ",
713 (
unsigned)nstr, filename);
715 for (i = 0; i < nstr; i++) {
716 cpl_frame * f = cpl_frame_new();
718 error = cpl_frame_set_filename(f, filename);
719 cpl_test_eq_error(error, CPL_ERROR_NONE);
721 error = cpl_frame_set_tag(f, astr[i]);
722 cpl_test_eq_error(error, CPL_ERROR_NONE);
724 error = cpl_frameset_insert(recipe->frames, f);
725 cpl_test_eq_error(error, CPL_ERROR_NONE);
728 copy = cpl_frameset_duplicate(recipe->frames);
730 recipe_exec = cpl_plugin_get_exec(plugin);
731 cpl_test( recipe_exec != NULL);
733 if (recipe_exec != NULL) {
736 cpl_test( recipe_exec(plugin) );
737 error = cpl_error_get_code();
739 cpl_test_error( error );
742 recipe_frameset_test_frameset_diff(recipe->frames, copy);
744 recipe_frameset_empty(recipe->frames);
747 cpl_frameset_delete(copy);
760static void recipe_sof_test_image_empty(cpl_plugin * plugin,
size_t nstr,
763 cpl_recipe * recipe = (cpl_recipe*)plugin;
764 int (*recipe_exec) (cpl_plugin *);
766 cpl_error_code error;
771 if (nstr < 1)
return;
773 cpl_msg_info(cpl_func,
"Testing recipe with %u empty images as input ",
776 iempty = cpl_image_new(13, 17, CPL_TYPE_FLOAT);
777 cpl_test_nonnull(iempty);
779 for (i = 0; i < nstr; i++) {
780 cpl_frame * f = cpl_frame_new();
781 char * rawname = cpl_sprintf(
"%s-raw%05u.fits",
782 cpl_plugin_get_name(plugin),
785 error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
787 cpl_test_eq_error(error, CPL_ERROR_NONE);
789 error = cpl_frame_set_filename(f, rawname);
790 cpl_test_eq_error(error, CPL_ERROR_NONE);
792 error = cpl_frame_set_tag(f, astr[i]);
793 cpl_test_eq_error(error, CPL_ERROR_NONE);
795 error = cpl_frameset_insert(recipe->frames, f);
796 cpl_test_eq_error(error, CPL_ERROR_NONE);
800 cpl_image_delete(iempty);
802 copy = cpl_frameset_duplicate(recipe->frames);
804 recipe_exec = cpl_plugin_get_exec(plugin);
805 cpl_test(recipe_exec != NULL);
807 if (recipe_exec != NULL) {
808 const cpl_frame * frame;
809 cpl_frameset_iterator * iterator = NULL;
815 retstat = recipe_exec(plugin);
816 error = cpl_error_get_code();
819 cpl_test_zero(retstat);
823 cpl_test_error( error );
825 recipe_frameset_test_frameset_diff(recipe->frames, copy);
827 for (frame = irplib_frameset_get_first_const(&iterator, recipe->frames);
829 frame = irplib_frameset_get_next_const(iterator))
831 cpl_test_zero( remove(cpl_frame_get_filename(frame)) );
833 cpl_frameset_iterator_delete(iterator);
835 recipe_frameset_empty(recipe->frames);
838 cpl_frameset_delete(copy);
853cpl_boolean irplib_plugin_has_sof_from_env(
const cpl_plugin * plugin,
854 const char * envname)
856 const char * recipename = cpl_plugin_get_name(plugin);
857 const char * sof_path = envname ? getenv(envname) : NULL;
858 cpl_frameset * frames;
860 const cpl_frame * ffirst;
862 cpl_ensure(plugin != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
863 cpl_ensure(envname != NULL, CPL_ERROR_NULL_INPUT, CPL_FALSE);
864 cpl_ensure(recipename != NULL, CPL_ERROR_DATA_NOT_FOUND, CPL_FALSE);
865 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
867 if (sof_path == NULL)
return CPL_FALSE;
869 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
871 frames = cpl_frameset_new();
872 recipe_frameset_load(frames, sof_name);
874 ffirst = cpl_frameset_get_position_const(frames, 0);
877 cpl_frameset_delete(frames);
879 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
881 return ffirst ? CPL_TRUE : CPL_FALSE;
893static void recipe_sof_test_from_env(cpl_plugin * plugin)
895 cpl_recipe * recipe = (cpl_recipe*)plugin;
896 const char * recipename = cpl_plugin_get_name(plugin);
897 const char * var_name =
"RECIPE_SOF_PATH";
898 const char * sof_path = getenv(var_name);
902 if (sof_path == NULL) {
903 cpl_msg_warning(cpl_func,
"Environment variable %s is unset: "
904 "No SOFs to check", var_name);
908 cpl_msg_debug(cpl_func,
"Checking for SOFs in %s", sof_path);
910 cpl_test_nonnull( recipename );
911 if (recipename == NULL)
return;
913 sof_name = cpl_sprintf(
"%s/%s.sof", sof_path, recipename);
915 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
917 recipe_frameset_load(recipe->frames, sof_name);
919 if (!cpl_frameset_is_empty(recipe->frames)) {
921 int (*recipe_exec ) (cpl_plugin *);
922 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
924 recipe_exec = cpl_plugin_get_exec(plugin);
925 cpl_test(recipe_exec != NULL);
927 if (recipe_exec != NULL) {
928 cpl_error_code error;
929 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
932 cpl_test_zero( recipe_exec(plugin) );
934 cpl_test_error(CPL_ERROR_NONE);
936 error = cpl_dfs_update_product_header(recipe->frames);
937 cpl_test_eq_error(error, CPL_ERROR_NONE);
939 recipe_frameset_test_frameset_diff(recipe->frames, copy);
941 recipe_frameset_empty(recipe->frames);
944 cpl_frameset_delete(copy);
963static void recipe_sof_test_local(cpl_plugin * plugin)
965 cpl_recipe * recipe = (cpl_recipe*)plugin;
966 const char * recipename = cpl_plugin_get_name(plugin);
967 char * sof_name = cpl_sprintf(
"%s.sof", recipename);
969 cpl_msg_debug(cpl_func,
"Checking for SOF %s", sof_name);
971 recipe_frameset_load(recipe->frames, sof_name);
973 if (!cpl_frameset_is_empty(recipe->frames)) {
975 int (*recipe_exec ) (cpl_plugin *);
976 cpl_frameset * copy = cpl_frameset_duplicate(recipe->frames);
978 recipe_exec = cpl_plugin_get_exec(plugin);
979 cpl_test(recipe_exec != NULL);
981 if (recipe_exec != NULL) {
982 cpl_error_code error;
984 cpl_msg_info(cpl_func,
"Checking handling of SOF: %s", sof_name);
987 cpl_test_zero( recipe_exec(plugin) );
989 cpl_test_error(CPL_ERROR_NONE);
991 error = cpl_dfs_update_product_header(recipe->frames);
992 cpl_test_eq_error( error, CPL_ERROR_NONE );
994 recipe_frameset_test_frameset_diff(recipe->frames, copy);
996 recipe_frameset_empty(recipe->frames);
999 cpl_frameset_delete(copy);
1026static void recipe_frameset_load(cpl_frameset * set,
const char *name)
1030 char line[LINE_LEN_MAX + 1];
1031 char path[LINE_LEN_MAX + 1], group[LINE_LEN_MAX + 1], tag[LINE_LEN_MAX + 1];
1034 assert( set != NULL );
1035 assert( name != NULL );
1037 fp = fopen(name,
"r");
1039 cpl_msg_debug(cpl_func,
"Unable to open SOF file '%s'", name);
1044 for (line_number = 0; fgets(line, LINE_LEN_MAX, fp); line_number++) {
1046 cpl_frame_group grp;
1050 if (line[0] ==
'#')
continue;
1052 n = sscanf(line, LINE_SCAN_FMT, path, tag, group);
1055 cpl_msg_warning(cpl_func,
"Spurious line no. %d in %s: %s",
1056 line_number, name, line);
1061 frame = cpl_frame_new();
1064 cpl_frame_set_filename(frame, path);
1067 cpl_frame_set_tag(frame, n == 1 ?
"" : tag);
1069 cpl_frameset_insert(set, frame);
1072 if (n < 3)
continue;
1074 if (!strcmp(group, CPL_FRAME_GROUP_RAW_ID))
1075 grp = CPL_FRAME_GROUP_RAW;
1076 else if (!strcmp(group, CPL_FRAME_GROUP_CALIB_ID))
1077 grp = CPL_FRAME_GROUP_CALIB;
1078 else if (!strcmp(group, CPL_FRAME_GROUP_PRODUCT_ID))
1079 grp = CPL_FRAME_GROUP_PRODUCT;
1081 grp = CPL_FRAME_GROUP_NONE;
1083 cpl_frame_set_group(frame, grp);
1105const cpl_parameter * irplib_parameterlist_get(
const cpl_parameterlist * self,
1106 const char * instrume,
1107 const char * recipe,
1108 const char * parameter)
1112 const cpl_parameter * par;
1115 cpl_ensure(instrume != NULL, CPL_ERROR_NULL_INPUT, NULL);
1116 cpl_ensure(recipe != NULL, CPL_ERROR_NULL_INPUT, NULL);
1117 cpl_ensure(parameter != NULL, CPL_ERROR_NULL_INPUT, NULL);
1119 paramname = cpl_sprintf(
"%s.%s.%s", instrume, recipe, parameter);
1121 par = cpl_parameterlist_find_const(self, paramname);
1123 if (par == NULL) (void)cpl_error_set_message(cpl_func,
1124 cpl_error_get_code()
1125 ? cpl_error_get_code()
1126 : CPL_ERROR_DATA_NOT_FOUND,
1129 cpl_free(paramname);
1163static void recipe_frameset_empty(cpl_frameset * self)
1168 cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT);
1172 n = cpl_frameset_get_size(self);
1173 for (i = 0; i < n; ++i)
1175 cpl_frame * f = cpl_frameset_get_position(self, n-1-i);
1176 cpl_frameset_erase_frame(self, f);
1202static void recipe_frameset_test_frame(
const cpl_frame * self)
1205 cpl_msg_info(cpl_func,
"Validating new frame: %s",
1206 cpl_frame_get_filename(self));
1208 cpl_test_nonnull(self);
1211 cpl_test_nonnull(cpl_frame_get_tag(self));
1214 cpl_test_eq(cpl_frame_get_group(self), CPL_FRAME_GROUP_PRODUCT);
1216 if (cpl_frame_get_type(self) != CPL_FRAME_TYPE_PAF) {
1218 cpl_test_fits(cpl_frame_get_filename(self));
1221 cpl_test_nonnull(cpl_frame_get_filename(self));
1247static void recipe_frameset_test_frameset_diff(
const cpl_frameset * self,
1248 const cpl_frameset * other)
1251 cpl_frameset_iterator * it1 = NULL;
1252 cpl_frameset_iterator * it2 = NULL;
1253 const cpl_frame * frame = irplib_frameset_get_first_const(&it2, other);
1256 for (;frame != NULL; frame = irplib_frameset_get_next_const(it2)) {
1257 const char * file = cpl_frame_get_filename(frame);
1260 cpl_test_nonnull(cpl_frame_get_filename(frame));
1264 cpl_frameset_iterator_delete(it2);
1266 if (frame != NULL)
return;
1268 frame = irplib_frameset_get_first_const(&it1, self);
1270 for (;frame != NULL; frame = irplib_frameset_get_next_const(it1)) {
1271 const cpl_frame * cmp;
1272 const char * file = cpl_frame_get_filename(frame);
1275 cpl_test_nonnull(cpl_frame_get_filename(frame));
1279 cmp = irplib_frameset_get_first_const(&it2, other);
1280 for (;cmp != NULL; cmp = irplib_frameset_get_next_const(it2)) {
1281 const char * cfile = cpl_frame_get_filename(cmp);
1283 if (!strcmp(file, cfile))
break;
1286 cpl_frameset_iterator_delete(it2);
1291 cpl_test_eq(cpl_frame_get_group(frame), CPL_FRAME_GROUP_PRODUCT);
1292 recipe_frameset_test_frame(frame);
1296 cpl_frameset_iterator_delete(it1);