IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38494


Ignore:
Timestamp:
Jun 19, 2015, 9:01:56 AM (11 years ago)
Author:
eugene
Message:

add a test of output with repeated tries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150616/Ohana/src/libdvo/src/dvo_catalog_split.c

    r38441 r38494  
    11# include <dvo.h>
    2 # define OHANA_MEMCHECK 0
     2# define OHANA_MEMCHECK 1
    33
    44// return options:
     
    9292  Matrix matrix;
    9393 
    94   if (OHANA_MEMCHECK) ohana_memcheck_func (TRUE);
     94  // if (OHANA_MEMCHECK) ohana_memcheck (TRUE);
    9595 
    9696  /* rewind file pointers and truncate (file is still open) */
     
    128128  int isCompressed = output_is_compressed (start, Nrows, Ntotal, catalog->catcompress);
    129129
    130   if (OHANA_MEMCHECK) ohana_memcheck_func (TRUE);
     130  // if (OHANA_MEMCHECK) ohana_memcheck (TRUE);
    131131
    132132  if (isCompressed) {
     
    149149  }
    150150
    151   if (OHANA_MEMCHECK) ohana_memcheck_func (TRUE);
     151  // if (OHANA_MEMCHECK) ohana_memcheck (TRUE);
    152152
    153153  // write the table data
     
    169169  fullsize += outtable->datasize + outtable->header->datasize;
    170170
    171   if (OHANA_MEMCHECK) ohana_memcheck_func (TRUE);
     171  // XXX test of repeated failure
     172  {
     173    Matrix myMatrix;
     174
     175    // write the PHU matrix; this is probably a NOP, do I have to keep it in?
     176    gfits_create_matrix (&catalog->header, &myMatrix);
     177
     178    int niter;
     179    for (niter = 0; niter < 5; niter ++) {
     180      char name[1024];
     181      snprintf (name, 1024, "%s.v.%d", catalog->filename, niter);
     182      FILE *f = fopen (name, "w");
     183
     184      myAssert (gfits_fwrite_header  (f, &catalog->header), "failed to write header");
     185      myAssert (gfits_fwrite_matrix  (f, &myMatrix), "failed to write matrix");
     186      myAssert (gfits_fwrite_Theader (f, outtable->header), "can't write table header");
     187      myAssert (gfits_fwrite_table (f, outtable), "can't write table data");
     188      myAssert (!fflush (f), "failed to flush");
     189      myAssert (!fclose (f), "failed to close");
     190      int fd = fileno(f);
     191      myAssert (fsync(fd), "failed to sync");
     192      fprintf (stderr, "wrote to %s\n", name);
     193    }
     194    gfits_free_matrix (&myMatrix);
     195  }
     196
     197  // if (OHANA_MEMCHECK) ohana_memcheck (TRUE);
    172198
    173199  // since we init'ed the structures above, these operations are safe whether or not we compressed the table
Note: See TracChangeset for help on using the changeset viewer.