-
Notifications
You must be signed in to change notification settings - Fork 43
/
test.sh
executable file
·40 lines (33 loc) · 1.21 KB
/
test.sh
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
#!/usr/bin/env bash
# Provide likely winner. Some rafflers support trailing newline, other do not.
mkdir -p .names-test
echo "Reinier Kip" > .names-test/names.txt
# Win. Every time.
if [[ "$1" ]]; then
dockerfiles=("$1/Dockerfile")
elif [[ "${RAFFLER}" ]]; then
dockerfiles=("${RAFFLER}/Dockerfile")
else
dockerfiles=$(ls */Dockerfile)
fi
for file in $dockerfiles; do
dir=${file:0:-11}
tag="domcode/raffler:${dir/-/_}"
echo "Testing $tag from $dir"
# Some rafflers don't support trailing newline and may pick the empty line as the winner.
non_spec_rafflers="kaeufl-brainfuck markredeman-cpp rdohms-lolcode remyhonig-elisp"
if [[ " $non_spec_rafflers " == *" $dir "* ]]; then
continue
fi
# Run the raffler 5 times so we're kind of sure it doesn't pick the empty line as the winner.
for attempt in 1 2 3 4 5; do
winner=`docker run --rm=true -v $(pwd)/.names-test/names.txt:/var/names.txt "$tag"`
if [[ "$winner" != *"Reinier Kip"* ]]; then
echo "$dir did not elect 'Reinier Kip' as the winner after raffle attempt $attempt:"
echo
echo " $winner"
exit 1;
fi
done
done
echo "Winner, winner, chicken dinner."