-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_regression.sh
executable file
·115 lines (107 loc) · 3.13 KB
/
run_regression.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh -e
abspath() {
if [ -d "$1" ]; then
(cd "$1"; pwd)
elif [ -f "$1" ]; then
if [ -z "${1##*/*}" ]; then
echo "$(cd "${1%/*}"; pwd)/${1##*/}"
else
echo "$(pwd)/$1"
fi
elif [ -d "$(dirname "$1")" ]; then
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
fi
}
if [ "$#" -lt 2 ]; then
echo "Need at least 2 parameters!"
exit 1
fi
export FOLDSEEK="$(abspath "$(command -v "$1")")"
SCRATCH="$(abspath "$2")"
RUN_ONLY="${3:-""}"
BASE="$(dirname "$(abspath "$0")")"
cd "${BASE}"
export DATADIR="${BASE}/data"
cd "${DATADIR}"
tar xvfz scop.tar.gz
cd "${BASE}"
export SCRIPTS="${BASE}/regression"
TESTS=""
run_test() {
if [ "$#" -lt 2 ]; then
echo "Test needs at least 2 parameters!"
exit 1
fi
NAME="$1"
FILE="$2"
shift
shift
if [ ! -z "$RUN_ONLY" ] && [ X"$RUN_ONLY" != X"$NAME" ]; then
return
fi
TESTS="${TESTS} ${NAME}"
export RESULTS="${SCRATCH}/${NAME}"
mkdir -p "${RESULTS}"
START="$(date +%s)"
"${SCRIPTS}/${FILE}" "$@"
STATUS="$?"
END="$(date +%s)"
if [ "${STATUS}" = "0" ]; then
if [ -f "${RESULTS}.report" ] && [ "$(echo $(head -n 1 "${RESULTS}.report"))" = "GOOD" ]; then
rm -rf "${RESULTS}"
fi
fi
eval "${NAME}_TIME"="$((END-START))"
}
# continue on if one test fail
set +e
export EVALUATE="${BASE}/bench.awk"
run_test run_search "run_search.sh"
run_test run_search_tm "run_search_tm.sh"
run_test run_easy_search "run_easy_search.sh"
if [ -z "${SKIP_PROSTT5}" ]; then
run_test run_easy_search_prostt5 "run_easy_search_prostt5.sh"
fi
run_test run_profile_search "run_profile_search.sh"
run_test run_easy_mcif_search "run_easy_mcif_search.sh"
run_test run_easy_caonly_search "run_easy_caonly_search.sh"
run_test run_easy_iterative_search "run_easy_iterative_search.sh"
run_test run_cluster_search "run_cluster_search.sh"
run_test run_cluster_index_search "run_cluster_index_search.sh"
run_test run_cluster_index_exclude_search "run_cluster_index_exclude_search.sh"
export EVALUATE="${BASE}/bench_clu.awk"
run_test run_cluster "run_cluster.sh"
run_test run_cluster_noca_reassign "run_cluster_noca_reassign.sh"
run_test run_easy_cluster "run_easy_cluster.sh"
run_test run_other_scores "run_other_scores.sh"
export EVALUATE="${BASE}/homstrad_bench.awk"
run_test run_homstrad_alignment_quality "run_homstrad_alignment_quality.sh"
run_test run_easy_complex_search "run_easy_complex_search.sh"
set -e
printf "\n"
ERR=0
for i in ${TESTS} ; do
VAL="${i}_TIME"
eval TIME="\$$VAL"
printf "\033[1m$i (Time: %ss)\033[0m\n" "${TIME}"
if [ ! -f "${SCRATCH}/${i}.report" ]; then
printf "\033[33mTEST FAILED (NO REPORT)\033[0m\n\n"
ERR=$((ERR+1))
continue
fi
if [ ! -s "${SCRATCH}/${i}.report" ]; then
printf "\033[33mTEST FAILED (EMPTY REPORT)\033[0m\n\n"
ERR=$((ERR+1))
continue
fi
STATUS="$(head -n 1 "${SCRATCH}/${i}.report")"
if [ "$STATUS" != "GOOD" ]; then
printf "\033[31mTEST FAILED\033[0m\n"
ERR=$((ERR+1))
else
printf "\033[32mTEST SUCCESS\033[0m\n"
fi
cat "${SCRATCH}/${i}.report"
printf "\n"
done
exit "$ERR"