Changeset e3a639a for test


Ignore:
Timestamp:
06/23/14 20:13:58 (7 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
ed81f74
Parents:
8c42377 (diff), a63a913 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'upsteam/develop' into develop

Conflicts:

lib/Makefile.am
lib/libtrace_int.h

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/do-tests.sh

    r47e927a r5692bc4  
    7777
    7878echo \* Testing time conversions
    79 do_test ./test-time
     79echo \* ERF
     80do_test ./test-time erf
     81echo \* pcapfile
     82do_test ./test-time pcapfile
     83echo \* pcapfilens
     84do_test ./test-time pcapfilens
     85echo \* legacyatm
     86do_test ./test-time legacyatm
     87echo \* legacypos
     88do_test ./test-time legacypos
     89echo \* legacyeth
     90do_test ./test-time legacyeth
     91echo \* pcap
     92do_test ./test-time pcap
     93echo \* rawerf
     94do_test ./test-time rawerf
     95echo \* tsh
     96do_test ./test-time tsh
    8097
    8198echo \* Testing directions
  • test/test-time.c

    rd5a27e8 r6a38a7e  
    5151struct libtrace_t *trace;
    5252
     53const char *lookup_uri(const char *type) {
     54        if (strchr(type,':'))
     55                return type;
     56        if (!strcmp(type,"erf"))
     57                return "erf:traces/100_packets.erf";
     58        if (!strcmp(type,"rawerf"))
     59                return "rawerf:traces/100_packets.erf";
     60        if (!strcmp(type,"pcap"))
     61                return "pcap:traces/100_packets.pcap";
     62        if (!strcmp(type,"wtf"))
     63                return "wtf:traces/wed.wtf";
     64        if (!strcmp(type,"rtclient"))
     65                return "rtclient:chasm";
     66        if (!strcmp(type,"pcapfile"))
     67                return "pcapfile:traces/100_packets.pcap";
     68        if (!strcmp(type,"pcapfilens"))
     69                return "pcapfile:traces/100_packetsns.pcap";
     70        if (!strcmp(type, "duck"))
     71                return "duck:traces/100_packets.duck";
     72        if (!strcmp(type, "legacyatm"))
     73                return "legacyatm:traces/legacyatm.gz";
     74        if (!strcmp(type, "legacypos"))
     75                return "legacypos:traces/legacypos.gz";
     76        if (!strcmp(type, "legacyeth"))
     77                return "legacyeth:traces/legacyeth.gz";
     78        if (!strcmp(type, "tsh"))
     79                return "tsh:traces/10_packets.tsh.gz";
     80        return type;
     81}
     82
    5383void iferr(libtrace_t *trace)
    5484{
     
    6191
    6292int main(int argc, char *argv[]) {
    63         char *uri = "erf:traces/100_packets.erf";
     93        char *uri = lookup_uri(argv[1]);
    6494        int psize = 0;
    6595        int error = 0;
     
    76106        for (;;) {
    77107                double ts;
     108                double tsdiff;
    78109                struct timeval tv;
    79110                if ((psize = trace_read_packet(trace, packet)) <0) {
     
    88119                tv=trace_get_timeval(packet);
    89120                ts=trace_get_seconds(packet);
    90                 assert((tv.tv_sec+tv.tv_usec/1000000.0)-ts<.000001);
     121                tsdiff = (tv.tv_sec+tv.tv_usec/1000000.0)-ts;
     122                assert(tsdiff > -0.001 && tsdiff < 0.001);
     123
    91124        }
    92125        trace_destroy_packet(packet);
Note: See TracChangeset for help on using the changeset viewer.