Changeset 568a341


Ignore:
Timestamp:
07/03/17 16:42:17 (3 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.

Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rcaf7841 r568a341  
    7676test/test-plen
    7777test/test-ports
     78test/test-setcaplen
    7879test/test-time
    7980test/test-tracetime-parallel
  • test/Makefile

    r6c84681 r568a341  
    1919BINS = test-pcap-bpf test-event test-time test-dir test-wireless test-errors \
    2020        test-plen test-autodetect test-ports test-fragment test-live \
    21         test-live-snaplen test-vxlan $(BINS_DATASTRUCT) $(BINS_PARALLEL)
     21        test-live-snaplen test-vxlan test-setcaplen $(BINS_DATASTRUCT) $(BINS_PARALLEL)
    2222
    2323.PHONY: all clean distclean install depend test
  • test/do-tests-parallel.sh

    r01619eb r568a341  
    4545do_test ./test-format-parallel rawerf
    4646
     47echo \* Read pcapng
     48do_test ./test-format-parallel pcapng
     49
    4750echo \* Read testing hasher function
    4851do_test ./test-format-parallel-hasher erf
  • test/do-tests.sh

    r3fc3267 r568a341  
    6565do_test ./test-format rawerf
    6666do_test ./test-decode rawerf
     67
     68echo \* Read pcapng
     69do_test ./test-format pcapng
     70do_test ./test-decode pcapng
    6771
    6872
     
    101105echo \* tsh
    102106do_test ./test-time tsh
     107echo \* pcapng
     108do_test ./test-time pcapng
    103109
    104110echo \* Testing directions
     
    181187rm -f traces/*.out.*
    182188do_test ./test-convert erf pcapfile
     189
     190echo " * pcapng -> pcapfile"
     191rm -f traces/*.out.*
     192do_test ./test-convert pcapng pcapfile
     193
     194echo " * pcapng -> erf"
     195rm -f traces/*.out.*
     196do_test ./test-convert pcapng erf
    183197
    184198echo " * pcap (sll) -> erf    raw IP"
     
    209223do_test ./test-convert legacypos pcapfile
    210224
    211 echo " * duck -> duck"
    212 rm -f traces/*.out.*
    213 do_test ./test-convert duck duck
     225# Don't bother with this anymore -- DUCK qualifies as 'meta' so
     226# doesn't get written at the moment.
     227#echo " * duck -> duck"
     228#rm -f traces/*.out.*
     229#do_test ./test-convert duck duck
    214230
    215231echo " * tsh -> pcapfile"
     
    220236rm -f traces/*.out.*
    221237do_test ./test-convert tsh pcap
     238
     239echo \* Testing packet truncation
     240echo " * pcap "
     241rm -f traces/*.out.*
     242do_test ./test-setcaplen pcap pcapfile
     243
     244echo " * pcapfile "
     245rm -f traces/*.out.*
     246do_test ./test-setcaplen pcapfile pcapfile
     247
     248echo " * erf "
     249rm -f traces/*.out.*
     250do_test ./test-setcaplen erf erf
     251
     252echo " * pcapng "
     253rm -f traces/*.out.*
     254do_test ./test-setcaplen pcapng pcapfile
     255
     256echo " * pcapfilens "
     257rm -f traces/*.out.*
     258do_test ./test-setcaplen pcapfilens pcapfile
     259
     260
    222261
    223262echo " * format autodetection - uncompressed"
  • 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)) {
  • test/test-decode.c

    rbcb2402 r568a341  
    6868        if (!strcmp(type,"pcap"))
    6969                return "pcap:traces/100_packets.pcap";
     70        if (!strcmp(type,"pcapng"))
     71                return "pcap:traces/100_packets.pcapng";
    7072        if (!strcmp(type,"wtf"))
    7173                return "wtf:traces/wed.wtf";
  • test/test-format-parallel.c

    r135e3f6 r568a341  
    7070        if (!strcmp(type,"pcap"))
    7171                return "pcap:traces/100_packets.pcap";
     72        if (!strcmp(type,"pcapng"))
     73                return "pcap:traces/100_packets.pcapng";
    7274        if (!strcmp(type,"wtf"))
    7375                return "wtf:traces/wed.wtf";
  • test/test-format.c

    rbcb2402 r568a341  
    6767        if (!strcmp(type,"pcap"))
    6868                return "pcap:traces/100_packets.pcap";
     69        if (!strcmp(type,"pcapng"))
     70                return "pcap:traces/100_packets.pcapng";
    6971        if (!strcmp(type,"wtf"))
    7072                return "wtf:traces/wed.wtf";
  • test/test-time.c

    r6a38a7e r568a341  
    6060        if (!strcmp(type,"pcap"))
    6161                return "pcap:traces/100_packets.pcap";
     62        if (!strcmp(type,"pcapng"))
     63                return "pcap:traces/100_packets.pcapng";
    6264        if (!strcmp(type,"wtf"))
    6365                return "wtf:traces/wed.wtf";
Note: See TracChangeset for help on using the changeset viewer.