Changeset 2541


Ignore:
Timestamp:
Jul 16, 2008, 7:23:24 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Split the test suite into the RNG test and the Unix utils test.
Location:
zzuf/trunk/test
Files:
1 added
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/test/Makefile.am

    r2462 r2541  
    11
    2 EXTRA_DIST = testsuite.sh file-00 file-ff file-random file-text
     2EXTRA_DIST = rng utils file-00 file-ff file-random file-text
    33
    44noinst_PROGRAMS = zzcat zzero
    55
    6 TESTS = testsuite.sh
     6TESTS = rng utils
    77
    88zzcat_SOURCES = zzcat.c
  • zzuf/trunk/test/utils

    r2534 r2541  
    22
    33set -e
    4 
    5 checkflip()
    6 {
    7     r=$1
    8     expect=$2
    9     s2=$seed
    10     mib=20
    11     echo "*** $mib MiB of zeroes, ratio $r ***"
    12     echo " expected ....... $expect"
    13     rmax=-1
    14     rmin=-1
    15     rtot=0
    16     for x in 0 1 2 3 4 5 6 7 8 9; do
    17         ret=`dd if=/dev/zero bs=1048576 count=$mib 2>/dev/null | "$ZZUF" -s $s2 -r $r | "$ZZERO"`
    18         if [ "$rmax" = -1 -o "$ret" -gt "$rmax" ]; then rmax=$ret; fi
    19         if [ "$rmin" = -1 -o "$ret" -lt "$rmin" ]; then rmin=$ret; fi
    20         rtot=`expr $rtot + $ret || true`
    21         echo " try $x .......... $ret"
    22         s2=`expr $s2 + 1`
    23     done
    24     rmean=`expr '(' $rtot + 5 ')' / 10 || true`
    25     delta=`expr $rmean - $expect || true`
    26     if [ "$delta" -gt -5 -a "$delta" -lt 5 ]; then
    27         result="ok"
    28     elif [ $(($rmean * 8)) -lt $(($expect * 7)) \
    29                -o $(($rmean * 7)) -gt $(($expect * 8)) ]; then
    30         result="FAILED"
    31         FAILED=$(($FAILED + 1))
    32     else
    33         result="ok"
    34     fi
    35     TESTED=$(($TESTED + 1))
    36     echo " min/avg/max $rmin/$rmean/$rmax .......... $result"
    37 }
    384
    395checkutils()
     
    12692  exit 1
    12793fi
    128 ZZERO="$DIR/zzero"
    129 if [ ! -f "$ZZERO" ]; then
    130   echo "error: test/zzero is missing"
    131   exit 1
    132 fi
    13394if file /bin/cat | grep -q 'statically linked'; then
    13495  STATIC_CAT=1
     
    146107fi
    147108
    148 echo "*** running zzuf test suite with seed $seed ***"
     109echo "*** running zzuf utils test suite with seed $seed ***"
    149110
    150 echo ""
    151 echo "*** check #1: random number generator ***"
    152 # if X flips are performed on N bits set to 0, the average number of bits
    153 # set to 1 is: N / 2 * (1 - pow(1 - 2 / N, X)
    154 checkflip 0.000000001 0
    155 checkflip 0.00000001  1
    156 checkflip 0.0000001  16
    157 checkflip 0.000001  167
    158 checkflip 0.00001  1677
    159 checkflip 0.0001  16775
    160 checkflip 0.001  167604
    161 checkflip 0.01  1661055
    162 checkflip 0.1  15205967
    163 
    164 echo ""
    165 echo "*** check #2: libc functions coverage ***"
    166111checkutils 0.0
    167112checkutils 0.000000001
Note: See TracChangeset for help on using the changeset viewer.