Ignore:
Timestamp:
Oct 13, 2015, 4:21:08 PM (9 years ago)
Author:
cfuguet
Message:

reconf: improving dspin_router transition function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/modules/dspin_router/caba/test/synthetic_test/scripts/broadcast_check.sh

    r998 r1020  
    44# @brief        This script validates that a broadcast transaction reaches once
    55#                       and only once every non-faulty router in the platform.
    6 file=$1
     6fname=$1
     7npkts=$2
     8
    79awk '
    810BEGIN {
    9         sent=0
    10         last=0
    11         failure=0
    12         min=99999999
    13         max=0
     11        npkts=50
     12
     13        rcvpkts=0
     14        nrecvrs=0
     15
     16        sndpkts=0
     17        nsendrs=0
    1418}
    15 #   Parse coordinates of routers
    16 #   /DSPIN_GENERATOR/ {
    17 #       regex="\\[[0-9]+\\]\\[";
    18 #       if (match($2,regex)) {
    19 #               x=substr($2,RSTART+1,RLENGTH-3);
    20 #       }
    21 #       regex="\\]\\[[0-9]+\\]";
    22 #       if (match($2,regex)) {
    23 #               y=substr($2,RSTART+2,RLENGTH-3);
    24 #       }
    25 #   }
    2619
    2720#   Parse the number of sent broadcast packets
    2821/broadcast sent packets += +/ {
    29         if ($6 != 0) {
    30                 sent=$6;
     22        sent=$6
     23        if (sent > 0) {
     24                if (nsendrs > 1) {
     25                        print "error: more than one initiator sent broadcast packets\n"
     26                        exit 1
     27                }
     28                if (sent != npkts) {
     29                        print "error: the number of sent broadcast packets does not "
     30                        print "correspond to the one specified\n"
     31                        exit 1
     32                }
     33                nsendrs++;
     34                sndpkts=sent;
    3135        }
    3236}
     
    3438#   Parse the number of received broadcast packets
    3539/broadcast received packets +=/ {
    36         if ($6 == 0) {
     40        received=$6
     41        if (received == 0) {
    3742                zero++;
    3843        }
    3944        else {
    40                 # store the min and max number of received packets
    41                 if ($6 < min) {
    42                         min=$6;
     45                if (received != npkts) {
     46                        print "error: at least a router received a number of broadcast ";
     47                        if (received > npkts) {
     48                                print "greater than the number of broadcast sent\n";
     49                        }
     50                        else {
     51                                print "less than the number of broadcast sent\n";
     52                        }
     53                        exit 1
    4354                }
    44                 if ($6 > max) {
    45                         max=$6;
    46                 }
     55                nrecvrs++;
     56                rcvpkts=received
    4757        }
    4858}
     
    5666                exit 1;
    5767        }
    58 
    59         if (max > sent) {
    60                 print "error: at least a router received a number of broadcast greater"
    61                 print "than the number of broadcast sent\n";
    62                 exit 1;
    63         }
    64 
    6568        if (zero == 1) {
    6669                print "error: the broadcast source received broadcasts\n";
     
    6871        }
    6972
    70         error=sent - min
    71         if (error > 0) {
    72                 print "error: the number of broadcast received by a router is inferior "
    73                 print "to the error threshold: error = " error "\n";
    74                 exit 1;
    75         }
    76 
     73        print "sent: " sndpkts " / # senders: " nsendrs;
     74        print "received: " rcvpkts " / # receivers " nrecvrs "\n";
    7775        exit 0;
    78 }' $file
     76}' $fname
    7977if [[ $? == 1 ]]; then exit 1; fi
    8078
Note: See TracChangeset for help on using the changeset viewer.