Ignore:
Timestamp:
Jan 23, 2013, 10:30:23 PM (8 years ago)
Author:
jordan
Message:

(libT) rename-test tracers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rename-test.c

    r13854 r13855  
    55#include <stdio.h>
    66
    7 #include <unistd.h> /* sync() */
     7#include <sys/types.h> /* stat() */
     8#include <sys/stat.h> /* stat() */
     9#include <unistd.h> /* stat(), sync() */
    810
    911#include "transmission.h"
     
    465467  tr_file_index_t i;
    466468  const tr_stat * st;
     469  tr_file_stat * fst;
    467470
    468471  for (i=0; i<tor->info.fileCount; ++i)
    469472    {
     473      int rv;
    470474      uint64_t j;
    471475      FILE * fp;
     
    473477      char * dirname;
    474478      const tr_file * file = &tor->info.files[i];
     479      struct stat sb;
    475480
    476481      path = tr_buildPath (tor->downloadDir, file->name, NULL);
     
    481486        fputc ('\0', fp);
    482487      fclose (fp);
    483       sync ();
    484488
    485489      tr_free (dirname);
    486490      tr_free (path);
    487     }
    488 
     491
     492      path = tr_torrentFindFile (tor, i);
     493      assert (path != NULL);
     494      rv = stat (path, &sb);
     495      assert (rv == 0);
     496      fprintf (stderr, "%s:%d file %s size is %zu\n", __FILE__, __LINE__, path, (size_t)sb.st_size);
     497      tr_free (path);
     498    }
     499
     500  sync ();
    489501  verify_and_block_until_done (tor);
    490502  st = tr_torrentStat (tor);
     503fprintf (stderr, "%s:%d leftUntilDone %zu\n", __FILE__, __LINE__, (size_t)st->leftUntilDone);
     504fst = tr_torrentFiles (tor, NULL);
     505for (i=0; i<3; ++i)
     506  fprintf (stderr, "%s:%d %d %zu\n", __FILE__, __LINE__, (int)i, (size_t)fst[i].bytesCompleted);
    491507  assert (st->leftUntilDone == 0);
    492508
     
    503519      fputc ('\1', fp);
    504520      fclose (fp);
    505       sync ();
    506521
    507522      tr_free (newpath);
    508523      tr_free (oldpath);
    509524
     525      sync ();
    510526      verify_and_block_until_done (tor);
    511527      st = tr_torrentStat (tor);
    512528      assert (st->leftUntilDone == tor->info.pieceSize);
     529fprintf (stderr, "%s:%d leftUntilDone %zu\n", __FILE__, __LINE__, (size_t)st->leftUntilDone);
    513530    }
    514531}
Note: See TracChangeset for help on using the changeset viewer.