-
Notifications
You must be signed in to change notification settings - Fork 1
/
report
executable file
·74 lines (66 loc) · 1.85 KB
/
report
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#
# whisky - a collection of stateless RNGs
# by Sean Connelly (@velipso), https://sean.fun
# Project Home: https://github.com/velipso/whisky
# SPDX-License-Identifier: 0BSD
#
set -e
if ! which dieharder > /dev/null; then
echo 'Missing dieharder' >&2
echo 'You must install the dieharder tool to continue' >&2
exit 1
fi
if ! which clang > /dev/null; then
echo 'Missing clang' >&2
echo 'You must install the clang tool to continue' >&2
exit 1
fi
if [ ! -e test.c ]; then
echo 'Missing test.c' >&2
echo 'This script should be ran inside the top-level directory in the whiksy repo' >&2
exit 1
fi
echo 'Generating whisky.out...'
clang -O2 -o whisky.out test.c
if [ $# -lt 1 ]; then
echo 'Creates a report for a given generator, and puts it in the reports/ directory'
echo ''
echo 'Usage:'
echo ' ./report <generator>'
echo ''
echo 'For a list of generators, run:'
echo ' ./whisky.out'
exit 1
fi
if ! ./whisky.out "$1"; then
echo 'Invalid generator' >&2
echo ''
echo 'For a list of generators, run:'
echo ' ./whisky.out'
exit 1
fi
if [ "$1" = "sha256" ]; then
NAME=whisky_sha256
DIM=8
else
NAME="whisky$1"
DIM=$(echo "$1" | sed 's/^\([0-9]*\).*/\1/g')
fi
AXIS=1
FILE='reports/'"$NAME"'.txt'
rm -f "$FILE"
while [ "$AXIS" -le "$DIM" ]; do
for DIRECTION in '+' '-'; do
echo 'Generating report for' "$NAME" 'along axis' "$AXIS"'/'"$DIM"', '"$DIRECTION"' direction...'
echo '###############################################################################' >> "$FILE"
echo '#' >> "$FILE"
echo '# '"$NAME"', axis '"$AXIS"' of '"$DIM"', '"$DIRECTION"' direction' >> "$FILE"
echo '#' >> "$FILE"
echo '###############################################################################' >> "$FILE"
echo '' >> "$FILE"
./whisky.out "$1" "$AXIS" "$DIRECTION" | dieharder -g 200 -a | tee -a "$FILE"
echo '' >> "$FILE"
done
AXIS=$(( $AXIS + 1 ))
done