summaryrefslogtreecommitdiffstats
path: root/indexlib/tests/large-scale/do-test.zsh
blob: b8d47b45d478e18c56bf8b6313ab035cda0fb44b (plain)
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
#!/usr/bin/env zsh

# SET INPUT FILE BELOW
inputfile=$1
inputfile=ulyss12.txt

indexlibadmin=../../indexlibadmin
index=index

rm -rf index
mkdir index

if test -z $inputfile; then
	cat <<-END 1>&2
	This test needs a large input file as a seed.

	You might consider using http://www.gutenberg.org/ as a starting point to get a file.

	Please edit this script ($0) to set the input file.
END
	exit 1
fi

rm -rf output
mkdir output/

rm -rf tmp
mkdir tmp/

python generate.py < $inputfile

$indexlibadmin remove $index
for t in output/text_*; do 
	$indexlibadmin add $index $t
done


for w in output/words_*.list; do
	$indexlibadmin search $index "`cat $w`" >tmp/got 2>/dev/null
	source output/`basename $w list`script
	if ! diff -q tmp/got tmp/expected; then
		cat <<-END
			Pattern $w was wrong!

			Diff:
		END
		diff -u tmp/got tmp/expected
		echo "End of Diff."
		exit 1
	fi
done

rm -f tmp/got tmp/expected tmp/pat
rmdir tmp