summaryrefslogtreecommitdiff
path: root/exporters/darcs/t/bench-tailor.sh
blob: 7567f7bed786cada404a2d5d0303c1b422d2aa36 (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
56
57
58
59
#!/bin/sh

create_config()
{
	cd $1
	mypath=$(pwd)
	cd - >/dev/null
	myname=$(basename $mypath)

	cat > config << EOF
[DEFAULT]
encoding-errors-policy = replace

[$myname]
source = darcs:$myname
target = git:$myname

[darcs:$myname]
subdir = darcs
repository = $mypath

[git:$myname]
subdir = git
repository = $mypath.git
EOF
}

PATH=$HOME/darcs/tailor:$PATH
if [ ! -d darcs-benchmark ]; then
	darcs get http://code.haskell.org/darcs/darcs-benchmark
	cd darcs-benchmark
else
	cd darcs-benchmark
	darcs pull -a
fi
sh initialise.sh
cd big-zoo
if [ -n "$1" ]; then
	targets=$1
else
	targets=*_play.tar.gz
fi
for i in $targets
do
	echo "benchmarking $i"
	rm -rf _playground
	tar xf $i
	cd _playground
	log="../$i.tailor-$(tailor --version).log"
	create_config sandbox
	sh -c 'time tailor --configfile config' 2>&1 |tee $log
	if diff --exclude _darcs --exclude .git -Nur sandbox git >/dev/null; then
		echo "ok, the result is correct" >> $log
	else
		echo "ouch, the result is corrupted" >> $log
		exit 1
	fi
	cd ..
done