-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.sh
48 lines (38 loc) · 881 Bytes
/
lib.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
41
42
43
44
45
46
47
48
DEFAULT_SEED=42
DATADIR=../data
SPEC_NOSYNC=$(cat ../add/spec-nosync)
ipfs_nosync() {
ipfs config --json Datastore.Spec "$SPEC_NOSYNC" 2>/dev/null
}
ipfs_reset() {
rm -rf ~/.ipfs
ipfs init -e >/dev/null
ipfs_nosync
}
ipfs_calculate_repo_size() {
IPFS_REPO_SIZE=$(du -b ~/.ipfs/blocks | tail -n 1 | awk -F ' ' '{ print $1 }')
}
random() {
$GOPATH/src/github.com/ipfs/go-ipfs/test/sharness/bin/random "$@" $SEED
}
random_files() {
$GOPATH/src/github.com/ipfs/go-ipfs/test/sharness/bin/random-files "$@" -seed $SEED
}
inc_seed() {
SEED=$((SEED + 1))
}
#wrapper for a customized `time` command
TIME() {
command time -f '%e %M' $*
}
# boilerplate steps for each benchmark
# make sure nosync is enabled
ipfs_nosync
# prepare data
mkdir -p $DATADIR/d
if [ "$(ls -A $DATADIR/d)" ]
then
:
else
tar xf $DATADIR/narinfo.tar.gz -C $DATADIR/d
fi