Changeset afaf6e8 for test


Ignore:
Timestamp:
10/24/12 13:40:06 (9 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, 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:
0a8eb88
Parents:
64d4398
Message:
  • Updated test framework to include converting from Linux SLL to ERF
Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/do-tests.sh

    r8bd2bbf rafaf6e8  
    141141rm -f traces/*.out.*
    142142do_test ./test-convert erf pcapfile
     143
     144echo " * pcap (sll) -> erf    raw IP"
     145rm -f traces/*.out.*
     146do_test ./test-convert sll1 erf
     147
     148echo " * pcap (sll) -> erf    loopback"
     149rm -f traces/*.out.*
     150do_test ./test-convert sll2 erf
     151
     152
    143153#./test-convert rtclient erf
    144154#./test-convert rtclient pcap
  • test/test-convert.c

    r10cf089 rafaf6e8  
    9090        if (!strcmp(type, "tsh"))
    9191                return "tsh:traces/10_packets.tsh.gz";
     92        if (!strcmp(type, "sll1"))
     93                return "pcapfile:traces/sll.pcap.gz";
     94        if (!strcmp(type, "sll2"))
     95                return "pcapfile:traces/100_sll.pcap";
    9296        return "unknown";
    9397}
     
    105109                return "duck:traces/100_packets.out.duck";
    106110        return "unknown";
     111}
     112
     113
     114static int length_changed(libtrace_packet_t *packet,
     115                libtrace_packet_t *packet2) {
     116
     117        uint16_t cap_len_1 = trace_get_capture_length(packet);
     118        uint16_t cap_len_2 = trace_get_capture_length(packet2);
     119        uint16_t wlen_1 = trace_get_wire_length(packet);
     120        uint16_t wlen_2 = trace_get_wire_length(packet2);
     121
     122        /* Special case where we demoted a packet */
     123        if (trace_get_link_type(packet) == TRACE_TYPE_LINUX_SLL &&
     124                        trace_get_link_type(packet2) != TRACE_TYPE_LINUX_SLL) {
     125               
     126                if (cap_len_2 != cap_len_1 - sizeof(libtrace_sll_header_t))
     127                        return true;
     128        } else {
     129
     130                if (cap_len_1 != cap_len_2 && cap_len_2 != wlen_2)
     131                        return true;
     132        }
     133       
     134        if (wlen_1 != wlen_2)
     135                return true;
     136
     137        return false;
     138
    107139}
    108140
     
    195227                }
    196228                /* The capture length might be snapped down to the wire length */
    197                 if (
    198                 ((  trace_get_capture_length(packet) != trace_get_capture_length(packet2)
    199                  && trace_get_capture_length(packet2) != trace_get_wire_length(packet2)))
    200                  || (trace_get_wire_length(packet) != trace_get_wire_length(packet2))) {
     229                if (length_changed(packet, packet2)) {
    201230                        printf("\t%s\t%s\n",
    202231                                trace1name,
Note: See TracChangeset for help on using the changeset viewer.