| Revision 4120,
1.3 KB
checked in by sam, 3 years ago
(diff) |
|
Add a workaround in the test suite for a cowdancer limitation causing .ilist
corruption and use ulimit instead of limit.
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | . "$(dirname "$0")/functions.inc" |
|---|
| 4 | |
|---|
| 5 | checkflip() |
|---|
| 6 | { |
|---|
| 7 | r=$1 |
|---|
| 8 | expect=$2 |
|---|
| 9 | s2=$seed |
|---|
| 10 | mib=20 |
|---|
| 11 | rmax=-1 |
|---|
| 12 | rmin=-1 |
|---|
| 13 | rtot=0 |
|---|
| 14 | new_test "$mib MiB of zeroes, ratio $r" |
|---|
| 15 | for x in 0 1 2 3 4; do |
|---|
| 16 | ret=`dd if=/dev/zero bs=1048576 count=$mib 2>/dev/null | $ZZUF -s $s2 -r $r | "$ZZERO"` |
|---|
| 17 | if [ "$rmax" = -1 -o "$ret" -gt "$rmax" ]; then rmax=$ret; fi |
|---|
| 18 | if [ "$rmin" = -1 -o "$ret" -lt "$rmin" ]; then rmin=$ret; fi |
|---|
| 19 | rtot=`expr $rtot + $ret || true` |
|---|
| 20 | echo " try $x .......... $ret" |
|---|
| 21 | s2=`expr $s2 + 1` |
|---|
| 22 | done |
|---|
| 23 | rmean=`expr '(' $rtot + 2 ')' / 5 || true` |
|---|
| 24 | delta=`expr $rmean - $expect || true` |
|---|
| 25 | printf " expected $expect min/avg/max $rmin/$rmean/$rmax .........." |
|---|
| 26 | if [ "$delta" -gt -5 -a "$delta" -lt 5 ]; then |
|---|
| 27 | pass_test " ok" |
|---|
| 28 | elif [ $(($rmean * 8)) -lt $(($expect * 7)) \ |
|---|
| 29 | -o $(($rmean * 7)) -gt $(($expect * 8)) ]; then |
|---|
| 30 | fail_test " FAILED" |
|---|
| 31 | else |
|---|
| 32 | pass_test " ok" |
|---|
| 33 | fi |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | start_test "zzuf RNG test suite" |
|---|
| 37 | |
|---|
| 38 | # if X flips are performed on N bits set to 0, the average number of bits |
|---|
| 39 | # set to 1 is: N / 2 * (1 - pow(1 - 2 / N, X) |
|---|
| 40 | checkflip 0.000000001 0 |
|---|
| 41 | checkflip 0.00000001 1 |
|---|
| 42 | checkflip 0.0000001 16 |
|---|
| 43 | checkflip 0.000001 167 |
|---|
| 44 | checkflip 0.00001 1677 |
|---|
| 45 | checkflip 0.0001 16775 |
|---|
| 46 | checkflip 0.001 167604 |
|---|
| 47 | checkflip 0.01 1661055 |
|---|
| 48 | checkflip 0.1 15205967 |
|---|
| 49 | |
|---|
| 50 | stop_test |
|---|
| 51 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.