-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtests.rc
executable file
·143 lines (132 loc) · 3.28 KB
/
tests.rc
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
#
# A set of functions for running various tests on the program
#
# Example usage:
#
# source tests.rc && do_build
#
if [ ! -e stanford-corenlp-models-current.jar ]; then
wget http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar
fi
if [ ! -e stanford-corenlp-caseless-models-current.jar ]; then
wget http://nlp.stanford.edu/software/stanford-corenlp-caseless-models-current.jar
fi
if [ ! -e stanford-corenlp-3.5.3.jar ]; then
wget http://central.maven.org/maven2/edu/stanford/nlp/stanford-corenlp/3.5.3/stanford-corenlp-3.5.3.jar
fi
configure() {
set -e
set -o xtrace
local SFM=${SEARCH_FULL_MEMORY:-"1"}
./configure \
--enable-debug SEARCH_FULL_MEMORY=$SFM CXX='clang++' $@
make clean
}
do_clean() {
set -e
set -o xtrace
echo "-- CLEAN --"
#rm -f etc/.have_models
#rm -f etc/.pp_affinity
#rm -f etc/.mk_graph
./autogen.sh
configure
make clean
}
do_build() {
set -e
set -o xtrace
echo "-- MAKE --"
configure
# main sources
make all
# gtest
make -C test/src/gtest gtest_main.lo lib/libgtest.la
# C++ tests
make -C test/src all naturalli_test
make -C test/src all naturalli_itest
# Java tests
make src/naturalli_preprocess.jar
make test/src/naturalli_preprocess_test.jar
}
do_document() {
set -e
set -o xtrace
echo "-- DOCUMENT --"
doxygen doxygen.conf
}
do_test_c() {
set -e
set -o xtrace
# Run the tests
echo "-- C++ TESTS --"
test/src/naturalli_test --gtest_output=xml:test/naturalli_test.xml
test/src/naturalli_itest --gtest_output=xml:test/naturalli_itest.xml
# Compute the coverage
echo "-- COVERAGE --"
cd src/
rm -f naturalli_server-Messages.pb.gcda
rm -f naturalli_server-Messages.pb.gcno
rm -f naturalli_server-Messages.pb.h.gcno
rm -f naturalli_server-Messages.pb.h.gcda
gcovr -r . --xml -o coverage.xml
if [ "`gcovr --version | grep 'gcovr 3'`" != "" ]; then
gcovr -r . --html --html-details -o /var/www/html/naturalli/coverage/index.html
fi
cd ..
}
do_test_java() {
set -e
set -o xtrace
echo "-- JAVA TESTS --"
make java_test
}
do_test_dist() {
set -e
set -o xtrace
echo "-- MAKE DIST --"
configure
make dist
tar xfz `find . -name "naturalli-2.*.tar.gz"`
cd `find . -type d -name "naturalli-2.*"`
configure
make all check
make java_test
cd ..
rm -r `find . -type d -name "naturalli-2.*"`
}
do_test_variants() {
set -e
set -o xtrace
echo "-- C++ SPECIAL TESTS --"
echo "(no debugging)"
configure --disable-debug
make check
echo "(fuzzy matches)"
configure MAX_FUZZY_MATCHES=8
make check
echo "(two pass hash)"
configure TWO_PASS_HASH=1
make check
echo "(search cycle memory)"
configure SEARCH_FULL_MEMORY=0 SEARCH_CYCLE_MEMORY=1; make check
configure SEARCH_FULL_MEMORY=0 SEARCH_CYCLE_MEMORY=2; make check
configure SEARCH_FULL_MEMORY=0 SEARCH_CYCLE_MEMORY=5; make check
echo "(search full memory)"
configure SEARCH_FULL_MEMORY=0; make check
configure SEARCH_FULL_MEMORY=1; make check
echo "(clang 3.5)"
configure SEARCH_FULL_MEMORY=0 CXX=clang++-3.5; make check
echo "(g++ 4.9)"
configure SEARCH_FULL_MEMORY=0 CXX=g++-4.9; make check
echo "(back to default)"
configure # reconfigure to default
make all
}
do_test_cases() {
set -e
set -o xtrace
echo "-- TEST CASES --"
test/run_testcases.sh
}