Changeset 1721 for zzuf


Ignore:
Timestamp:
Jan 27, 2007, 10:40:31 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Updated testsuite to use our own files instead of /dev/*.
Location:
zzuf/trunk/test
Files:
4 added
2 edited

Legend:

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

    r1521 r1721  
    11
    2 EXTRA_DIST = testsuite.sh
     2EXTRA_DIST = testsuite.sh file-00 file-ff file-random file-text
    33
    44noinst_PROGRAMS = fdcat streamcat
  • zzuf/trunk/test/testsuite.sh

    r1684 r1721  
    22
    33set -e
    4 
    5 create()
    6 {
    7     rm -f /tmp/zzuf-zero-$$
    8     dd if=/dev/zero of=/tmp/zzuf-zero-$$ bs=1024 count=32 2>/dev/null
    9     rm -f /tmp/zzuf-random-$$
    10     dd if=/dev/urandom of=/tmp/zzuf-random-$$ bs=1024 count=32 2>/dev/null
    11     rm -f /tmp/zzuf-text-$$
    12     strings </dev/urandom | dd bs=1024 count=32 of=/tmp/zzuf-text-$$ 2>/dev/null
    13     echo "" >> /tmp/zzuf-text-$$ # Make sure we have a newline at EOF
    14 }
    154
    165check()
     
    3928}
    4029
    41 cleanup() {
    42     if [ "$FAILED" = 0 ]; then
    43         rm -f /tmp/zzuf-zero-$$
    44         rm -f /tmp/zzuf-random-$$
    45         rm -f /tmp/zzuf-text-$$
    46         echo "*** temporary files removed ***"
    47     else
    48         echo "*** files preserved ***"
    49         echo " /tmp/zzuf-zero-$$"
    50         echo " /tmp/zzuf-random-$$"
    51         echo " /tmp/zzuf-text-$$"
    52     fi
    53 }
    54 
    55 trap "echo ''; echo '*** ABORTED ***'; cleanup; exit 0" 1 2 15
    56 
    5730seed=$((0+0$1))
    58 ZZUF="$(dirname "$0")/../src/zzuf"
    59 FDCAT="$(dirname "$0")/fdcat"
    60 STREAMCAT="$(dirname "$0")/streamcat"
     31DIR="$(dirname "$0")"
     32ZZUF="$DIR/../src/zzuf"
     33FDCAT="$DIR/fdcat"
     34STREAMCAT="$DIR/streamcat"
    6135if [ ! -f "$FDCAT" -o ! -f "$STREAMCAT" ]; then
    6236  echo "error: test/fdcat or test/streamcat are missing"
     
    7347
    7448echo "*** running zzuf test suite ***"
    75 echo "*** creating test files ***"
    76 create
    7749echo "*** using seed $seed ***"
    7850
    7951for r in 0.0 0.00001 0.001 0.1 10.0; do
    80     for type in zero text random; do
    81         file=/tmp/zzuf-$type-$$
     52    for type in 00 ff text random; do
     53        file="$DIR/file-$type"
    8254        ZZOPTS="-s $seed -r $r"
    8355        case $file in
     
    8658        echo "*** file $file, ratio $r ***"
    8759        REFMD5=""
    88         if [ $r = 0.0 -a $type = zero ]; then
     60        if [ $r = 0.0 -a $type = 00 ]; then
    8961            check="bb7df04e1b0a2570657527a7e108ae23"
    9062            echo "*** should be $check ***"
     
    129101if [ "$FAILED" != 0 ]; then
    130102    echo "*** $FAILED tests failed out of $TESTED ***"
    131     cleanup
    132103    exit 1
    133104fi
    134105echo "*** all $TESTED tests OK ***"
    135106
    136 cleanup
    137107exit 0
    138108
Note: See TracChangeset for help on using the changeset viewer.