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

reconf: improving dspin_router transition function.

Location:
branches/reconfiguration/modules/dspin_router/caba/test/synthetic_test/scripts
Files:
2 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
  • branches/reconfiguration/modules/dspin_router/caba/test/synthetic_test/scripts/run_broadcast_check.sh

    r998 r1020  
    11#!/usr/bin/env sh
     2XSIZE=10
     3YSIZE=10
     4NPKTS=50
     5
    26LOGDIR=logs
    3 COMMON="-X 5 -Y 5 -P 1500"
     7COMMON="-X $XSIZE -Y $YSIZE -P $NPKTS"
    48SCRIPTPATH=$(dirname $0)
    59
     
    913
    1014mkdir -p $LOGDIR
    11 for (( x = 0; x < 5; x++ )); do
    12         for (( y = 0; y < 5; y++ )); do
    13                 for (( fx = 0; fx < 5; fx++ )); do
    14                         for (( fy = 0; fy < 5; fy++ )); do
     15for (( x = 0; x < $XSIZE; x++ )); do
     16        for (( y = 0; y < $YSIZE; y++ )); do
     17                for (( fx = 0; fx < $XSIZE; fx++ )); do
     18                        for (( fy = 0; fy < $YSIZE; fy++ )); do
    1519                                if [[ ( $x == $fx ) && ( $y == $fy ) ]]; then continue; fi
    1620                                LOGFILE=$LOGDIR/$(echo log'_'$x'_'$y'_'$fx'_'$fy);
     
    1822                                echo "./simul.x $ARGS ($LOGFILE)"
    1923                                ./simul.x $ARGS > $LOGFILE 2>/dev/null;
    20                                 $SCRIPTPATH/broadcast_check.sh $LOGFILE
     24                                $SCRIPTPATH/broadcast_check.sh $LOGFILE $NPKTS
    2125                                if [[ $? == 1 ]]; then
    2226                                        echo "FAILURE";
Note: See TracChangeset for help on using the changeset viewer.