~tokyocabinet/tokyocabinet/c99-posix-trunk

« back to all changes in this revision

Viewing changes to tcumttest.c

  • Committer: Baptiste Lepilleur
  • Date: 2009-07-30 19:32:25 UTC
  • Revision ID: blep@users.sourceforge.net-20090730193225-pf4qhxsmbm23s0fz
Tags: tokyocabinet-1.4.27
releaseĀ 1.4.27

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
static void usage(void);
48
48
static void iprintf(const char *format, ...);
49
49
static void iputchar(int c);
50
 
static void eprint(const char *func);
 
50
static void eprint(int line, const char *func);
51
51
static int myrand(int range);
52
52
static int myrandnd(int range);
53
53
static int runcombo(int argc, char **argv);
116
116
 
117
117
 
118
118
/* print error message of on-memory database */
119
 
static void eprint(const char *func){
120
 
  fprintf(stderr, "%s: %s: error\n", g_progname, func);
 
119
static void eprint(int line, const char *func){
 
120
  fprintf(stderr, "%s: %d: %s: error\n", g_progname, line, func);
121
121
}
122
122
 
123
123
 
239
239
      targs[i].rnd = rnd;
240
240
      targs[i].id = i;
241
241
      if(pthread_create(threads + i, NULL, threadwrite, targs + i) != 0){
242
 
        eprint("pthread_create");
 
242
        eprint(__LINE__, "pthread_create");
243
243
        targs[i].id = -1;
244
244
        err = true;
245
245
      }
248
248
      if(targs[i].id == -1) continue;
249
249
      void *rv;
250
250
      if(pthread_join(threads[i], &rv) != 0){
251
 
        eprint("pthread_join");
 
251
        eprint(__LINE__, "pthread_join");
252
252
        err = true;
253
253
      } else if(rv){
254
254
        err = true;
270
270
      targs[i].rnd = rnd;
271
271
      targs[i].id = i;
272
272
      if(pthread_create(threads + i, NULL, threadread, targs + i) != 0){
273
 
        eprint("pthread_create");
 
273
        eprint(__LINE__, "pthread_create");
274
274
        targs[i].id = -1;
275
275
        err = true;
276
276
      }
279
279
      if(targs[i].id == -1) continue;
280
280
      void *rv;
281
281
      if(pthread_join(threads[i], &rv) != 0){
282
 
        eprint("pthread_join");
 
282
        eprint(__LINE__, "pthread_join");
283
283
        err = true;
284
284
      } else if(rv){
285
285
        err = true;
301
301
      targs[i].rnd = rnd;
302
302
      targs[i].id = i;
303
303
      if(pthread_create(threads + i, NULL, threadremove, targs + i) != 0){
304
 
        eprint("pthread_create");
 
304
        eprint(__LINE__, "pthread_create");
305
305
        targs[i].id = -1;
306
306
        err = true;
307
307
      }
310
310
      if(targs[i].id == -1) continue;
311
311
      void *rv;
312
312
      if(pthread_join(threads[i], &rv) != 0){
313
 
        eprint("pthread_join");
 
313
        eprint(__LINE__, "pthread_join");
314
314
        err = true;
315
315
      } else if(rv){
316
316
        err = true;
359
359
      targs[i].rratio= rratio;
360
360
      targs[i].id = i;
361
361
      if(pthread_create(threads + i, NULL, threadtypical, targs + i) != 0){
362
 
        eprint("pthread_create");
 
362
        eprint(__LINE__, "pthread_create");
363
363
        targs[i].id = -1;
364
364
        err = true;
365
365
      }
368
368
      if(targs[i].id == -1) continue;
369
369
      void *rv;
370
370
      if(pthread_join(threads[i], &rv) != 0){
371
 
        eprint("pthread_join");
 
371
        eprint(__LINE__, "pthread_join");
372
372
        err = true;
373
373
      } else if(rv){
374
374
        err = true;
531
531
          int msiz;
532
532
          const char *mbuf = tcmapget(map, buf, len, &msiz);
533
533
          if(msiz != vsiz || memcmp(mbuf, vbuf, vsiz)){
534
 
            eprint("(validation)");
 
534
            eprint(__LINE__, "(validation)");
535
535
            err = true;
536
536
          }
537
537
        }
538
538
        tcfree(vbuf);
539
539
      } else {
540
540
        if(map && tcmapget(map, buf, len, &vsiz)){
541
 
          eprint("(validation)");
 
541
          eprint(__LINE__, "(validation)");
542
542
          err = true;
543
543
        }
544
544
      }
559
559
        int msiz;
560
560
        const char *mbuf = tcmapget(map, kbuf, ksiz, &msiz);
561
561
        if(!mbuf || msiz != vsiz || memcmp(mbuf, vbuf, vsiz)){
562
 
          eprint("(validation)");
 
562
          eprint(__LINE__, "(validation)");
563
563
          err = true;
564
564
        }
565
565
        tcfree(vbuf);
566
566
      } else {
567
 
        eprint("(validation)");
 
567
        eprint(__LINE__, "(validation)");
568
568
        err = true;
569
569
      }
570
570
    }