Changeset 10cf089


Ignore:
Timestamp:
05/04/10 16:18:47 (11 years ago)
Author:
Perry Lorier <perry@…>
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:
325f86f
Parents:
22e626a
Message:

Be nicer about debug messages
Deal with packets that are snapped to capture == wirelength

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test-convert.c

    r5b8f9ee r10cf089  
    117117        libtrace_out_t *outtrace;
    118118        libtrace_packet_t *packet,*packet2;
     119        const char *trace1name;
     120        const char *trace2name;
    119121
    120122        trace = trace_create(lookup_uri(argv[1]));
     
    170172
    171173        /* Now read it back in again and check it's all kosher */
    172         trace = trace_create(lookup_uri(argv[1]));
     174        trace1name = lookup_uri(argv[1]);
     175        trace = trace_create(trace1name);
    173176        iferr(trace);
    174177        trace_start(trace);
    175         trace2 = trace_create(lookup_out_uri(argv[2]));
     178        trace2name = lookup_out_uri(argv[2]);
     179        trace2 = trace_create(trace2name);
    176180        iferr(trace2);
    177181        trace_start(trace2);
     
    190194                        break;
    191195                }
    192                 if (trace_get_capture_length(packet) != trace_get_capture_length(packet2)) {
    193                         printf("capturelen %zd!=%zd\n",
    194                                         trace_get_capture_length(packet),
    195                                         trace_get_capture_length(packet2));
     196                /* 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))) {
     201                        printf("\t%s\t%s\n",
     202                                trace1name,
     203                                trace2name);
     204                        printf("caplen\t%zd\t%zd\t%+zd\n",
     205                                trace_get_capture_length(packet),
     206                                trace_get_capture_length(packet2),
     207                                trace_get_capture_length(packet2)-trace_get_capture_length(packet));
     208                        printf("wirelen\t%zd\t%zd\t%+zd\n",
     209                                trace_get_wire_length(packet),
     210                                trace_get_wire_length(packet2),
     211                                trace_get_wire_length(packet2)-trace_get_wire_length(packet));
     212                        printf("link\t%d\t%d\n",
     213                                trace_get_link_type(packet),
     214                                trace_get_link_type(packet2));
    196215                        abort();
    197216                }
    198                 assert(trace_get_wire_length(packet)
    199                                 == trace_get_wire_length(packet2));
    200217       
    201218                if (trace_get_tcp(packet)) {
Note: See TracChangeset for help on using the changeset viewer.