-
Notifications
You must be signed in to change notification settings - Fork 53
/
util.sh
executable file
·46 lines (42 loc) · 1.48 KB
/
util.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
#!/bin/bash
function cleanDirectoryRecursively() {
find . -name "$1" | sed 's#^#rm -fr #g' | sh
}
function cleanTempData() {
cleanDirectoryRecursively "config.json"
cleanDirectoryRecursively "peers.json"
cleanDirectoryRecursively "elastos_test"
}
cpuArgs=''
if [[ "$2" == "cpu" || "$3" == "cpu" ]]; then
cpuArgs='-cpuprofile profile.out'
fi
memArgs=''
if [[ "$2" == "mem" || "$3" == "mem" ]]; then
memArgs='-benchmem -memprofile memprofile.out'
fi
if [[ "$1" == "clean" ]]; then
cleanTempData
elif [[ "$1" == "cleanall" ]]; then
cleanTempData
cleanDirectoryRecursively "elastos"
elif [[ "$1" == "test" ]]; then
./ela-cli script -f test/white_box/main/test_all.lua
elif [[ "$1" == "unittest" ]]; then
go test `go list ./... | grep -v benchmark` -short
elif [[ "$1" == "benchall" ]]; then
go test ./benchmark/... -bench=. $cpuArgs $memArgs
elif [[ "$1" == "benchspec" ]]; then
go test ./benchmark/special/... -bench=. $cpuArgs $memArgs
elif [[ "$1" == "benchproc" ]]; then
go test ./benchmark/process/... -bench=. $cpuArgs $memArgs
elif [[ "$1" == "benchsync" ]]; then
cp ela benchmark/sync/
cp config.json benchmark/sync/
rm -rf benchmark/sync/elastos_test
cp -r elastos benchmark/sync/elastos_test
ulimit -n 1024
go test ./benchmark/sync/... -bench=. $cpuArgs $memArgs -timeout 1000m
elif [[ "$1" == "datagen" ]]; then
./ela-datagen --dir benchmark/process/elastos_test --height "$2" --mode normal --inputsperblock 200 --maxrefers 200 --minrefers 100 --addresscount 100
fi