Ignore:
Timestamp:
07/03/17 16:42:17 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
9cdbedb
Parents:
8e11beb
Message:

Update test suite for pcapng

Also added a new test for set_capture_length(). Setting the caplen
for pcapng is a bit more complicated than most formats, so I
needed a test for that format anyway. Figured I may as well add
tests for some of the other truncatable formats as well.

I've also added a 'complex.pcapng' test trace -- I haven't written
any tests that use it but it is useful for checking if you can
still read the full variety of pcapng records.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test-convert.c

    r86bec15 r568a341  
    7474        if (!strcmp(type,"pcap"))
    7575                return "pcap:traces/100_packets.pcap";
     76        if (!strcmp(type,"pcapng"))
     77                return "pcapng:traces/100_packets.pcapng";
    7678        if (!strcmp(type,"wtf"))
    7779                return "wtf:traces/wed.wtf";
     
    204206                        break;
    205207                }
    206                 count ++;
    207                 trace_write_packet(outtrace,packet);
     208                if (trace_write_packet(outtrace,packet) > 0)
     209                        count ++;
    208210                iferrout(outtrace);
    209211                if (count>100)
     
    241243        while(trace_read_packet(trace,packet)>0) {
    242244                int err;
     245
     246                if (IS_LIBTRACE_META_PACKET(packet))
     247                        continue;
     248
    243249                ++count;
    244                 if ((err=trace_read_packet(trace2,packet2))<1) {
    245                         printf("premature EOF on destination, %i from %s, %i from %s\n",count,lookup_uri(argv[1]),count-1,lookup_out_uri(argv[2]));
    246                         iferr(trace2);
    247                         error=1;
    248                         break;
    249                 }
     250                do {
     251                        if ((err=trace_read_packet(trace2,packet2))<1) {
     252                                printf("premature EOF on destination, %i from %s, %i from %s\n",count,lookup_uri(argv[1]),count-1,lookup_out_uri(argv[2]));
     253                                iferr(trace2);
     254                                error=1;
     255                                break;
     256                        }
     257                } while (IS_LIBTRACE_META_PACKET(packet2));
     258
    250259                /* The capture length might be snapped down to the wire length */
    251260                if (length_changed(packet, packet2)) {
Note: See TracChangeset for help on using the changeset viewer.