Changeset f051c1b for test


Ignore:
Timestamp:
08/12/14 14:14:50 (6 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:
0862c20
Parents:
f9a70ca
Message:

Tidies up the state messages received, now all states are passed through created->resumed->paused->stopped this might simplify some code. Removed the extra paused state.
Hooks up the reporter method through trace_pstart, hopefully resulting in simpler code most of the time. Also renames this from reducer to reporter anywhere it was not already. Adds a test for this also.
Removes is_packet from a result in favour of a more generic type, with packet being one of these.
Moves configuration for tuning relelated settings into a single structure.

Location:
test
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • test/Makefile

    r17c5749 rf051c1b  
    1515BINS_PARALLEL = test-format-parallel test-format-parallel-hasher \
    1616        test-format-parallel-singlethreaded test-format-parallel-stressthreads \
    17         test-format-parallel-singlethreaded-hasher
     17        test-format-parallel-singlethreaded-hasher test-format-parallel-reporter
    1818
    1919BINS = test-pcap-bpf test-event test-time test-dir test-wireless test-errors \
  • test/do-tests-parallel.sh

    r54834a1 rf051c1b  
    5757do_test ./test-format-parallel-stressthreads erf
    5858
     59echo \* Read stress testing with 100 threads
     60do_test ./test-format-parallel-reporter erf
     61
    5962echo
    6063echo "Tests passed: $OK"
  • test/test-format-parallel-hasher.c

    r59ef093 rf051c1b  
    9595        bool seen_start_message;
    9696        bool seen_stop_message;
    97         bool seen_paused_message;
     97        bool seen_resumed_message;
    9898        bool seen_pausing_message;
    9999        int count;
     
    125125        }
    126126        else switch (mesg->code) {
    127                 case MESSAGE_STARTED:
     127                case MESSAGE_STARTING:
    128128                        assert(tls == NULL);
    129129                        tls = calloc(sizeof(struct TLS), 1);
     
    132132                        tls->seen_start_message = true;
    133133                        break;
    134                 case MESSAGE_STOPPED:
     134                case MESSAGE_STOPPING:
    135135                        assert(tls->seen_start_message);
    136136                        assert(tls != NULL);
     
    139139
    140140                        // All threads publish to verify the thread count
    141                         trace_publish_result(trace, (uint64_t) 0, (void *) tls->count);
    142                         trace_post_reduce(trace);
     141                        trace_publish_result(trace, t, (uint64_t) 0, (void *) tls->count, RESULT_NORMAL);
     142                        trace_post_reporter(trace);
    143143                        free(tls);
    144144                        break;
     
    152152                        tls->seen_pausing_message = true;
    153153                        break;
    154                 case MESSAGE_PAUSED:
    155                         assert(tls->seen_pausing_message);
    156                         tls->seen_paused_message = true;
     154                case MESSAGE_RESUMING:
     155                        assert(tls->seen_pausing_message  || tls->seen_start_message);
     156                        tls->seen_resumed_message = true;
    157157                        break;
    158158        }
     
    197197        trace_pstart(trace, NULL, per_packet, NULL);
    198198        iferr(trace,tracename);
    199 
    200199        /* Make sure traces survive a pause and restart */
    201200        trace_ppause(trace);
  • test/test-format-parallel-singlethreaded-hasher.c

    r59ef093 rf051c1b  
    9595        bool seen_start_message;
    9696        bool seen_stop_message;
    97         bool seen_paused_message;
     97        bool seen_resuming_message;
    9898        bool seen_pausing_message;
    9999        int count;
     
    125125        }
    126126        else switch (mesg->code) {
    127                 case MESSAGE_STARTED:
     127                case MESSAGE_STARTING:
    128128                        assert(tls == NULL);
    129129                        tls = calloc(sizeof(struct TLS), 1);
     
    132132                        tls->seen_start_message = true;
    133133                        break;
    134                 case MESSAGE_STOPPED:
     134                case MESSAGE_STOPPING:
    135135                        assert(tls->seen_start_message);
    136136                        assert(tls != NULL);
     
    139139
    140140                        // All threads publish to verify the thread count
    141                         trace_publish_result(trace, (uint64_t) 0, (void *) tls->count);
    142                         trace_post_reduce(trace);
     141                        trace_publish_result(trace, t, (uint64_t) 0, (void *) tls->count, RESULT_NORMAL);
     142                        trace_post_reporter(trace);
    143143                        free(tls);
    144144                        break;
     
    152152                        tls->seen_pausing_message = true;
    153153                        break;
    154                 case MESSAGE_PAUSED:
    155                         assert(tls->seen_pausing_message);
    156                         tls->seen_paused_message = true;
     154                case MESSAGE_RESUMING:
     155                        assert(tls->seen_pausing_message || tls->seen_start_message);
     156                        tls->seen_resuming_message = true;
    157157                        break;
    158158        }
  • test/test-format-parallel-singlethreaded.c

    r59ef093 rf051c1b  
    9595        bool seen_start_message;
    9696        bool seen_stop_message;
    97         bool seen_paused_message;
     97        bool seen_resuming_message;
    9898        bool seen_pausing_message;
    9999        int count;
     
    125125        }
    126126        else switch (mesg->code) {
    127                 case MESSAGE_STARTED:
     127                case MESSAGE_STARTING:
    128128                        assert(tls == NULL);
    129129                        tls = calloc(sizeof(struct TLS), 1);
     
    132132                        tls->seen_start_message = true;
    133133                        break;
    134                 case MESSAGE_STOPPED:
     134                case MESSAGE_STOPPING:
    135135                        assert(tls->seen_start_message);
    136136                        assert(tls != NULL);
     
    139139
    140140                        // All threads publish to verify the thread count
    141                         trace_publish_result(trace, (uint64_t) 0, (void *) tls->count);
    142                         trace_post_reduce(trace);
     141                        trace_publish_result(trace, t, (uint64_t) 0, (void *) tls->count, RESULT_NORMAL);
     142                        trace_post_reporter(trace);
    143143                        free(tls);
    144144                        break;
     
    152152                        tls->seen_pausing_message = true;
    153153                        break;
    154                 case MESSAGE_PAUSED:
    155                         assert(tls->seen_pausing_message);
    156                         tls->seen_paused_message = true;
     154                case MESSAGE_RESUMING:
     155                        assert(tls->seen_pausing_message || tls->seen_start_message);
     156                        tls->seen_resuming_message = true;
    157157                        break;
    158158        }
  • test/test-format-parallel-stressthreads.c

    r59ef093 rf051c1b  
    9595        bool seen_start_message;
    9696        bool seen_stop_message;
    97         bool seen_paused_message;
     97        bool seen_resuming_message;
    9898        bool seen_pausing_message;
    9999        int count;
     
    125125        }
    126126        else switch (mesg->code) {
    127                 case MESSAGE_STARTED:
     127                case MESSAGE_STARTING:
    128128                        assert(tls == NULL);
    129129                        tls = calloc(sizeof(struct TLS), 1);
     
    132132                        tls->seen_start_message = true;
    133133                        break;
    134                 case MESSAGE_STOPPED:
     134                case MESSAGE_STOPPING:
    135135                        assert(tls->seen_start_message);
    136136                        assert(tls != NULL);
     
    139139
    140140                        // All threads publish to verify the thread count
    141                         trace_publish_result(trace, (uint64_t) 0, (void *) tls->count);
    142                         trace_post_reduce(trace);
     141                        trace_publish_result(trace, t, (uint64_t) 0, (void *) tls->count, RESULT_NORMAL);
     142                        trace_post_reporter(trace);
    143143                        free(tls);
    144144                        break;
     
    152152                        tls->seen_pausing_message = true;
    153153                        break;
    154                 case MESSAGE_PAUSED:
    155                         assert(tls->seen_pausing_message);
    156                         tls->seen_paused_message = true;
     154                case MESSAGE_RESUMING:
     155                        assert(tls->seen_pausing_message || tls->seen_start_message);
     156                        tls->seen_resuming_message = true;
    157157                        break;
    158158        }
  • test/test-format-parallel.c

    r59ef093 rf051c1b  
    9595        bool seen_start_message;
    9696        bool seen_stop_message;
    97         bool seen_paused_message;
     97        bool seen_resuming_message;
    9898        bool seen_pausing_message;
    9999        int count;
     
    132132        }
    133133        else switch (mesg->code) {
    134                 case MESSAGE_STARTED:
     134                case MESSAGE_STARTING:
    135135                        assert(!seen_start_message || seen_paused_message);
    136136                        assert(tls == NULL);
     
    141141                        tls->seen_start_message = true;
    142142                        break;
    143                 case MESSAGE_STOPPED:
     143                case MESSAGE_STOPPING:
    144144                        assert(seen_start_message);
    145145                        assert(tls != NULL);
     
    152152
    153153                        // All threads publish to verify the thread count
    154                         trace_publish_result(trace, (uint64_t) 0, (void *) count);
    155                         trace_post_reduce(trace);
     154                        trace_publish_result(trace, t, (uint64_t) 0, (void *) count, RESULT_NORMAL);
     155                        trace_post_reporter(trace);
    156156                        break;
    157157                case MESSAGE_TICK:
     
    165165                        tls->seen_pausing_message = true;
    166166                        break;
    167                 case MESSAGE_PAUSED:
    168                         assert(seen_pausing_message);
     167                case MESSAGE_RESUMING:
     168                        assert(tls->seen_pausing_message  || tls->seen_start_message );
    169169                        seen_paused_message = true;
    170                         tls->seen_paused_message = true;
     170                        tls->seen_resuming_message = true;
    171171                        break;
    172172        }
Note: See TracChangeset for help on using the changeset viewer.