diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/testing.sh | 268 |
1 files changed, 216 insertions, 52 deletions
diff --git a/test/testing.sh b/test/testing.sh index 6b8be3ab..0386978a 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh -e | 1 | #!/bin/bash -e |
2 | 2 | ||
3 | # Setup ######################################### | 3 | # Setup ######################################### |
4 | 4 | ||
@@ -7,7 +7,7 @@ | |||
7 | exit 1 | 7 | exit 1 |
8 | } | 8 | } |
9 | 9 | ||
10 | if [ -z "$@" ] | 10 | if [ -z "$*" ] |
11 | then | 11 | then |
12 | ps aux | grep -q '[s]shd' || { | 12 | ps aux | grep -q '[s]shd' || { |
13 | echo "Run sudo /bin/sshd in order to perform all tests." | 13 | echo "Run sudo /bin/sshd in order to perform all tests." |
@@ -15,6 +15,12 @@ then | |||
15 | } | 15 | } |
16 | fi | 16 | fi |
17 | 17 | ||
18 | if [ "$1" == "--travis" ] | ||
19 | then | ||
20 | travis=true | ||
21 | shift | ||
22 | fi | ||
23 | |||
18 | testing_dir="$PWD" | 24 | testing_dir="$PWD" |
19 | 25 | ||
20 | testing_tree="$testing_dir/testing" | 26 | testing_tree="$testing_dir/testing" |
@@ -22,6 +28,7 @@ testing_sys_tree="$testing_dir/testing_sys" | |||
22 | testing_tree_copy="$testing_dir/testing_copy" | 28 | testing_tree_copy="$testing_dir/testing_copy" |
23 | testing_sys_tree_copy="$testing_dir/testing_sys_copy" | 29 | testing_sys_tree_copy="$testing_dir/testing_sys_copy" |
24 | testing_cache="$testing_dir/testing_cache" | 30 | testing_cache="$testing_dir/testing_cache" |
31 | testing_server="$testing_dir/testing_server" | ||
25 | 32 | ||
26 | [ "$1" ] || rm -f luacov.stats.out | 33 | [ "$1" ] || rm -f luacov.stats.out |
27 | rm -f luacov.report.out | 34 | rm -f luacov.report.out |
@@ -31,12 +38,19 @@ rm -rf "$testing_tree" | |||
31 | rm -rf "$testing_sys_tree" | 38 | rm -rf "$testing_sys_tree" |
32 | rm -rf "$testing_tree_copy" | 39 | rm -rf "$testing_tree_copy" |
33 | rm -rf "$testing_sys_tree_copy" | 40 | rm -rf "$testing_sys_tree_copy" |
34 | rm -rf "$testing_cache" | ||
35 | rm -rf "$testing_dir/testing_config.lua" | 41 | rm -rf "$testing_dir/testing_config.lua" |
36 | rm -rf "$testing_dir/testing_config_show_downloads.lua" | 42 | rm -rf "$testing_dir/testing_config_show_downloads.lua" |
37 | rm -rf "$testing_dir/testing_config_sftp.lua" | 43 | rm -rf "$testing_dir/testing_config_sftp.lua" |
38 | rm -rf "$testing_dir/luacov.config" | 44 | rm -rf "$testing_dir/luacov.config" |
39 | 45 | ||
46 | if [ "$1" == "--clean" ] | ||
47 | then | ||
48 | rm -rf "$testing_cache" | ||
49 | rm -rf "$testing_server" | ||
50 | fi | ||
51 | |||
52 | mkdir -p "$testing_cache" | ||
53 | |||
40 | [ "$1" = "clean" ] && { | 54 | [ "$1" = "clean" ] && { |
41 | rm -f luacov.stats.out | 55 | rm -f luacov.stats.out |
42 | exit 0 | 56 | exit 0 |
@@ -45,7 +59,10 @@ rm -rf "$testing_dir/luacov.config" | |||
45 | cat <<EOF > $testing_dir/testing_config.lua | 59 | cat <<EOF > $testing_dir/testing_config.lua |
46 | rocks_trees = { | 60 | rocks_trees = { |
47 | "$testing_tree", | 61 | "$testing_tree", |
48 | "$testing_sys_tree", | 62 | { name = "system", root = "$testing_sys_tree" }, |
63 | } | ||
64 | rocks_servers = { | ||
65 | "$testing_server" | ||
49 | } | 66 | } |
50 | local_cache = "$testing_cache" | 67 | local_cache = "$testing_cache" |
51 | upload_server = "testing" | 68 | upload_server = "testing" |
@@ -97,31 +114,124 @@ export LUAROCKS_CONFIG="$testing_dir/testing_config.lua" | |||
97 | export LUA_PATH= | 114 | export LUA_PATH= |
98 | export LUA_CPATH= | 115 | export LUA_CPATH= |
99 | 116 | ||
100 | luadir="/Programs/Lua/Current" | 117 | luaversion=5.2.3 |
101 | platform="linux-x86" | 118 | if [ "$travis" ] |
119 | then | ||
120 | pushd /tmp | ||
121 | if [ ! -e "lua/bin/lua" ] | ||
122 | then | ||
123 | mkdir -p lua | ||
124 | echo "Downloading lua $luaversion..." | ||
125 | wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null | ||
126 | tar zxpf "lua-$luaversion.tar.gz" | ||
127 | cd "lua-$luaversion" | ||
128 | echo "Building lua $luaversion..." | ||
129 | make linux INSTALL_TOP=/tmp/lua &> /dev/null | ||
130 | make install INSTALL_TOP=/tmp/lua &> /dev/null | ||
131 | fi | ||
132 | popd | ||
133 | luadir=/tmp/lua | ||
134 | else | ||
135 | luadir="/Programs/Lua/Current" | ||
136 | fi | ||
137 | |||
138 | if [ `uname -m` = i686 ] | ||
139 | then | ||
140 | platform="linux-x86" | ||
141 | else | ||
142 | platform="linux-x86_64" | ||
143 | fi | ||
144 | |||
102 | lua="$luadir/bin/lua" | 145 | lua="$luadir/bin/lua" |
103 | 146 | ||
104 | version_luacov=0.3 | 147 | version_luasocket=3.0rc1 |
105 | version_luasocket=2.0.2 | 148 | verrev_luasocket=${version_luasocket}-1 |
149 | srcdir_luasocket=luasocket-3.0-rc1 | ||
150 | |||
151 | version_cprint=0.1 | ||
152 | verrev_cprint=0.1-1 | ||
153 | |||
154 | version_luacov=0.4 | ||
155 | verrev_luacov=0.4-1 | ||
106 | version_lxsh=0.8.6 | 156 | version_lxsh=0.8.6 |
107 | version_validate_args=1.5.4 | 157 | version_validate_args=1.5.4 |
108 | verrev_luasocket=${version_luasocket}-5 | 158 | verrev_validate_args=1.5.4-1 |
109 | verrev_lxsh=${version_lxsh}-2 | 159 | verrev_lxsh=${version_lxsh}-2 |
110 | 160 | ||
161 | luasec=luasec | ||
162 | |||
111 | cd .. | 163 | cd .. |
112 | ./configure --with-lua="$luadir" | 164 | ./configure --with-lua="$luadir" |
113 | make clean | 165 | make clean |
114 | make src/luarocks/site_config.lua | 166 | make src/luarocks/site_config.lua |
115 | make dev | 167 | make dev |
116 | cd src | 168 | cd src |
169 | basedir=$PWD | ||
170 | run_lua() { | ||
171 | if [ "$1" = "--noecho" ]; then shift; noecho=1; else noecho=0; fi | ||
172 | if [ "$1" = "--nocov" ]; then shift; nocov=1; else nocov=0; fi | ||
173 | if [ "$noecho" = 0 ] | ||
174 | then | ||
175 | echo $* | ||
176 | fi | ||
177 | cmd=$1 | ||
178 | shift | ||
179 | if [ "$nocov" = 0 ] | ||
180 | then | ||
181 | "$lua" -e"require('luacov.runner')('$testing_dir/luacov.config')" "$basedir/bin/$cmd" "$@" | ||
182 | else | ||
183 | "$lua" "$basedir/bin/$cmd" "$@" | ||
184 | fi | ||
185 | } | ||
186 | luarocks="run_lua luarocks" | ||
187 | luarocks_nocov="run_lua --nocov luarocks" | ||
188 | luarocks_noecho="run_lua --noecho luarocks" | ||
189 | luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" | ||
190 | luarocks_admin="run_lua luarocks-admin" | ||
191 | luarocks_admin_nocov="run_lua --nocov luarocks-admin" | ||
117 | 192 | ||
118 | echo $LUA_PATH | 193 | ################################################### |
119 | |||
120 | luarocks_nocov="$lua $PWD/bin/luarocks" | ||
121 | luarocks="$lua -erequire('luacov.runner')('$testing_dir/luacov.config') $PWD/bin/luarocks" | ||
122 | luarocks_admin="$lua -erequire('luacov.runner')('$testing_dir/luacov.config') $PWD/bin/luarocks-admin" | ||
123 | 194 | ||
124 | $luarocks_nocov download luacov | 195 | mkdir -p "$testing_server" |
196 | ( | ||
197 | cd "$testing_server" | ||
198 | luarocks_repo="http://luarocks.org/repositories/rocks" | ||
199 | luarocks_scm_repo="http://luarocks.org/repositories/rocks-scm" | ||
200 | get() { [ -e `basename "$1"` ] || wget -c "$1"; } | ||
201 | get "$luarocks_repo/luacov-${verrev_luacov}.src.rock" | ||
202 | get "$luarocks_repo/luacov-${verrev_luacov}.rockspec" | ||
203 | get "$luarocks_repo/luadoc-3.0.1-1.src.rock" | ||
204 | get "$luarocks_repo/lualogging-1.3.0-1.src.rock" | ||
205 | get "$luarocks_repo/luasocket-${verrev_luasocket}.src.rock" | ||
206 | get "$luarocks_repo/luasocket-${verrev_luasocket}.rockspec" | ||
207 | get "$luarocks_repo/luafilesystem-1.6.2-1.src.rock" | ||
208 | get "$luarocks_repo/stdlib-35-1.src.rock" | ||
209 | get "$luarocks_repo/luarepl-0.4-1.src.rock" | ||
210 | get "$luarocks_repo/validate-args-1.5.4-1.rockspec" | ||
211 | get "$luarocks_scm_repo/luasec-scm-1.rockspec" | ||
212 | get "$luarocks_repo/luabitop-1.0.2-1.rockspec" | ||
213 | get "$luarocks_repo/lpty-1.0.1-1.src.rock" | ||
214 | get "$luarocks_repo/cprint-${verrev_cprint}.src.rock" | ||
215 | get "$luarocks_repo/cprint-${verrev_cprint}.rockspec" | ||
216 | get "$luarocks_repo/wsapi-1.6-1.src.rock" | ||
217 | get "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock" | ||
218 | get "$luarocks_repo/abelhas-1.0-1.rockspec" | ||
219 | get "$luarocks_repo/lzlib-0.4.work3-1.src.rock" | ||
220 | get "$luarocks_repo/lpeg-0.12-1.src.rock" | ||
221 | get "$luarocks_repo/luaposix-31-1.src.rock" | ||
222 | get "$luarocks_repo/md5-1.2-1.src.rock" | ||
223 | get "$luarocks_repo/lrandom-20120430.51-1.src.rock" | ||
224 | get "$luarocks_repo/lrandom-20120430.52-1.src.rock" | ||
225 | get "$luarocks_repo/lrandom-20120430.51-1.rockspec" | ||
226 | get "$luarocks_repo/lrandom-20120430.52-1.rockspec" | ||
227 | ) | ||
228 | $luarocks_admin_nocov make_manifest "$testing_server" | ||
229 | |||
230 | ################################################### | ||
231 | |||
232 | checksum_path() { | ||
233 | ( cd "$1"; find . -printf "%s %p\n" | md5sum ) | ||
234 | } | ||
125 | 235 | ||
126 | build_environment() { | 236 | build_environment() { |
127 | rm -rf "$testing_tree" | 237 | rm -rf "$testing_tree" |
@@ -130,21 +240,55 @@ build_environment() { | |||
130 | rm -rf "$testing_sys_tree_copy" | 240 | rm -rf "$testing_sys_tree_copy" |
131 | mkdir -p "$testing_tree" | 241 | mkdir -p "$testing_tree" |
132 | mkdir -p "$testing_sys_tree" | 242 | mkdir -p "$testing_sys_tree" |
243 | $luarocks_admin_nocov make_manifest "$testing_cache" | ||
133 | for package in "$@" | 244 | for package in "$@" |
134 | do | 245 | do |
135 | $luarocks_nocov build --tree="$testing_sys_tree" $package | 246 | $luarocks_nocov install --only-server="$testing_cache" --tree="$testing_sys_tree" $package || { |
247 | $luarocks_nocov build --tree="$testing_sys_tree" $package | ||
248 | $luarocks_nocov pack --tree="$testing_sys_tree" $package; mv $package-*.rock "$testing_cache" | ||
249 | } | ||
136 | done | 250 | done |
137 | eval `$luarocks_nocov path --bin` | 251 | eval `$luarocks_noecho_nocov path --bin` |
138 | cp -a "$testing_tree" "$testing_tree_copy" | 252 | cp -a "$testing_tree" "$testing_tree_copy" |
139 | cp -a "$testing_sys_tree" "$testing_sys_tree_copy" | 253 | cp -a "$testing_sys_tree" "$testing_sys_tree_copy" |
254 | testing_tree_copy_md5=`checksum_path "$testing_tree_copy"` | ||
255 | testing_sys_tree_copy_md5=`checksum_path "$testing_sys_tree_copy"` | ||
140 | } | 256 | } |
141 | 257 | ||
142 | reset_environment() { | 258 | reset_environment() { |
143 | rm -rf "$testing_tree" | 259 | testing_tree_md5=`checksum_path "$testing_tree"` |
144 | rm -rf "$testing_sys_tree" | 260 | testing_sys_tree_md5=`checksum_path "$testing_sys_tree"` |
145 | cp -a "$testing_tree_copy" "$testing_tree" | 261 | if [ "$testing_tree_md5" != "$testing_tree_copy_md5" ] |
146 | cp -a "$testing_sys_tree_copy" "$testing_sys_tree" | 262 | then |
263 | rm -rf "$testing_tree" | ||
264 | cp -a "$testing_tree_copy" "$testing_tree" | ||
265 | fi | ||
266 | if [ "$testing_sys_tree_md5" != "$testing_sys_tree_copy_md5" ] | ||
267 | then | ||
268 | rm -rf "$testing_sys_tree" | ||
269 | cp -a "$testing_sys_tree_copy" "$testing_sys_tree" | ||
270 | fi | ||
271 | } | ||
272 | |||
273 | need() { | ||
274 | echo "Obtaining $1 $2..." | ||
275 | if $luarocks show $1 &> /dev/null | ||
276 | then | ||
277 | echo "Already available" | ||
278 | return | ||
279 | fi | ||
280 | platrock="$1-$2.$platform.rock" | ||
281 | if [ ! -e "$testing_cache/$platrock" ] | ||
282 | then | ||
283 | echo "Building $1 $2..." | ||
284 | $luarocks_nocov build --pack-binary-rock $1 $2 | ||
285 | mv "$platrock" "$testing_cache" | ||
286 | fi | ||
287 | echo "Installing $1 $2..." | ||
288 | $luarocks_nocov install "$testing_cache/$platrock" | ||
289 | return | ||
147 | } | 290 | } |
291 | need_luasocket() { need luasocket $verrev_luasocket; } | ||
148 | 292 | ||
149 | # Tests ######################################### | 293 | # Tests ######################################### |
150 | 294 | ||
@@ -176,40 +320,49 @@ fail_new_version_invalid() { $luarocks new_version invalid; } | |||
176 | fail_make_norockspec() { $luarocks make; } | 320 | fail_make_norockspec() { $luarocks make; } |
177 | 321 | ||
178 | fail_build_blank_arg() { $luarocks build --tree="" lpeg; } | 322 | fail_build_blank_arg() { $luarocks build --tree="" lpeg; } |
179 | test_build_withpatch() { $luarocks build luadoc; } | 323 | test_build_withpatch() { need_luasocket; $luarocks build luadoc; } |
180 | test_build_diffversion() { $luarocks build luacov ${version_luacov}; } | 324 | test_build_diffversion() { $luarocks build luacov ${version_luacov}; } |
181 | test_build_command() { $luarocks build stdlib; } | 325 | test_build_command() { $luarocks build stdlib; } |
182 | test_build_install_bin() { $luarocks build luarepl; } | 326 | test_build_install_bin() { $luarocks build luarepl; } |
183 | fail_build_nohttps() { $luarocks install luasocket && $luarocks download --rockspec validate-args ${version_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } | 327 | fail_build_nohttps() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } |
184 | test_build_https() { $luarocks download --rockspec validate-args ${version_validate_args} && $luarocks install luasec && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } | 328 | test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx && pwd && ls && $luarocks install $luasec && pwd && ls && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } |
185 | test_build_supported_platforms() { $luarocks build xctrl; } | 329 | test_build_supported_platforms() { $luarocks build lpty; } |
186 | 330 | ||
187 | test_build_deps_partial_match() { $luarocks build yaml; } | 331 | test_build_deps_partial_match() { $luarocks build lrandom; } |
188 | test_build_show_downloads() { export LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" && $luarocks build alien; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } | 332 | test_build_show_downloads() { export LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" && $luarocks build alien; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } |
189 | 333 | ||
190 | test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } | 334 | test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } |
191 | test_download_rockspecversion() { $luarocks download --rockspec validate-args ${version_validate_args} && rm validate-args-*; } | 335 | test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; } |
192 | 336 | ||
193 | test_help() { $luarocks help; } | 337 | test_help() { $luarocks help; } |
194 | 338 | ||
195 | test_install_binaryrock() { $luarocks build luasocket && $luarocks pack luasocket && $luarocks install ./luasocket-${verrev_luasocket}.${platform}.rock && rm ./luasocket-${verrev_luasocket}.${platform}.rock; } | 339 | test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; } |
196 | test_install_with_bin() { $luarocks install wsapi; } | 340 | test_install_with_bin() { $luarocks install wsapi; } |
341 | fail_install_notazipfile() { $luarocks install "$testing_dir/testfiles/not_a_zipfile-1.0-1.src.rock"; } | ||
197 | 342 | ||
198 | test_lint_ok() { $luarocks download --rockspec validate-args ${version_validate_args} && $luarocks lint ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } | 343 | test_lint_ok() { $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks lint ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } |
344 | fail_lint_type_mismatch_string() { $luarocks lint "$testing_dir/testfiles/type_mismatch_string-1.0-1.rockspec"; } | ||
345 | fail_lint_type_mismatch_version() { $luarocks lint "$testing_dir/testfiles/type_mismatch_version-1.0-1.rockspec"; } | ||
346 | fail_lint_type_mismatch_table() { $luarocks lint "$testing_dir/testfiles/type_mismatch_table-1.0-1.rockspec"; } | ||
199 | 347 | ||
200 | test_list() { $luarocks list; } | 348 | test_list() { $luarocks list; } |
201 | test_list_porcelain() { $luarocks list --porcelain; } | 349 | test_list_porcelain() { $luarocks list --porcelain; } |
202 | 350 | ||
203 | test_make() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --src luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && cd luasocket-${verrev_luasocket}/luasocket-${version_luasocket} && $luarocks make && cd ../.. && rm -rf ./luasocket-${verrev_luasocket}; } | 351 | test_make_with_rockspec() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --src luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && cd luasocket-${verrev_luasocket}/${srcdir_luasocket} && $luarocks make luasocket-${verrev_luasocket}.rockspec && cd ../.. && rm -rf ./luasocket-${verrev_luasocket}; } |
352 | test_make_default_rockspec() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; } | ||
204 | test_make_pack_binary_rock() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --deps-mode=none --pack-binary-rock && [ -e ./lxsh-${verrev_lxsh}.all.rock ] && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; } | 353 | test_make_pack_binary_rock() { rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --deps-mode=none --pack-binary-rock && [ -e ./lxsh-${verrev_lxsh}.all.rock ] && cd ../.. && rm -rf ./lxsh-${verrev_lxsh}; } |
354 | fail_make_which_rockspec() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --src luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && cd luasocket-${verrev_luasocket}/${srcdir_luasocket} && $luarocks make && cd ../.. && rm -rf ./luasocket-${verrev_luasocket}; } | ||
205 | 355 | ||
206 | test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; } | 356 | test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; } |
207 | test_new_version_url() { $luarocks download --rockspec abelhas 1.0 && $luarocks new_version ./abelhas-1.0-1.rockspec 1.1 https://github.com/downloads/ittner/abelhas/abelhas-1.1.tar.gz && rm ./abelhas-*; } | 357 | test_new_version_url() { $luarocks download --rockspec abelhas 1.0 && $luarocks new_version ./abelhas-1.0-1.rockspec 1.1 https://github.com/downloads/ittner/abelhas/abelhas-1.1.tar.gz && rm ./abelhas-*; } |
208 | 358 | ||
209 | test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; } | 359 | test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; } |
210 | test_pack_src() { $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; } | 360 | test_pack_src() { $luarocks install $luasec && $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; } |
211 | 361 | ||
212 | test_path() { $luarocks path --bin; } | 362 | test_path() { $luarocks path --bin; } |
363 | test_path_lr_path() { $luarocks path --lr-path; } | ||
364 | test_path_lr_cpath() { $luarocks path --lr-cpath; } | ||
365 | test_path_lr_bin() { $luarocks path --lr-bin; } | ||
213 | 366 | ||
214 | fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; } | 367 | fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; } |
215 | test_purge() { $luarocks purge --tree="$testing_sys_tree"; } | 368 | test_purge() { $luarocks purge --tree="$testing_sys_tree"; } |
@@ -222,35 +375,35 @@ test_search_missing() { $luarocks search missing_rock; } | |||
222 | 375 | ||
223 | test_show() { $luarocks show luacov; } | 376 | test_show() { $luarocks show luacov; } |
224 | test_show_modules() { $luarocks show --modules luacov; } | 377 | test_show_modules() { $luarocks show --modules luacov; } |
225 | test_show_depends() { $luarocks install luasec && $luarocks show luasec; } | 378 | test_show_depends() { need_luasocket; $luarocks install $luasec && $luarocks show luasec; } |
226 | test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } | 379 | test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } |
227 | 380 | ||
228 | test_unpack_download() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks unpack luasocket && rm -rf ./luasocket-${verrev_luasocket}; } | 381 | test_unpack_download() { rm -rf ./cprint-${verrev_cprint} && $luarocks unpack cprint && rm -rf ./cprint-${verrev_cprint}; } |
229 | test_unpack_src() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --src luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && rm -rf ./luasocket-${verrev_luasocket}; } | 382 | test_unpack_src() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --src cprint && $luarocks unpack ./cprint-${verrev_cprint}.src.rock && rm -rf ./cprint-${verrev_cprint}; } |
230 | test_unpack_rockspec() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --rockspec luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.rockspec && rm -rf ./luasocket-${verrev_luasocket}; } | 383 | test_unpack_rockspec() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --rockspec cprint && $luarocks unpack ./cprint-${verrev_cprint}.rockspec && rm -rf ./cprint-${verrev_cprint}; } |
231 | test_unpack_binary() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks build luasocket && $luarocks pack luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.${platform}.rock && rm -rf ./luasocket-${verrev_luasocket}; } | 384 | test_unpack_binary() { rm -rf ./cprint-${verrev_cprint} && $luarocks build cprint && $luarocks pack cprint && $luarocks unpack ./cprint-${verrev_cprint}.${platform}.rock && rm -rf ./cprint-${verrev_cprint}; } |
232 | 385 | ||
233 | test_admin_help() { $luarocks_admin help; } | 386 | test_admin_help() { $luarocks_admin help; } |
234 | 387 | ||
235 | test_admin_make_manifest() { $luarocks_admin make_manifest; } | 388 | test_admin_make_manifest() { $luarocks_admin make_manifest; } |
236 | test_admin_add_rsync() { $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; } | 389 | test_admin_add_rsync() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; } |
237 | test_admin_add_sftp() { export LUAROCKS_CONFIG="$testing_dir/testing_config_sftp.lua" && $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } | 390 | test_admin_add_sftp() { if [ "$travis" ]; then return; fi; export LUAROCKS_CONFIG="$testing_dir/testing_config_sftp.lua" && $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } |
238 | fail_admin_add_missing() { $luarocks_admin --server=testing add; } | 391 | fail_admin_add_missing() { $luarocks_admin --server=testing add; } |
239 | fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; } | 392 | fail_admin_invalidserver() { $luarocks_admin --server=invalid add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; } |
240 | fail_admin_invalidrock() { $luarocks_admin --server=testing add invalid; } | 393 | fail_admin_invalidrock() { if [ "$travis" ]; then return 1; fi; $luarocks_admin --server=testing add invalid; } |
241 | test_admin_refresh_cache() { $luarocks_admin --server=testing refresh_cache; } | 394 | test_admin_refresh_cache() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing refresh_cache; } |
242 | test_admin_remove() { $luarocks_admin --server=testing remove ./luasocket-${verrev_luasocket}.src.rock; } | 395 | test_admin_remove() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing remove luasocket-${verrev_luasocket}.src.rock; } |
243 | fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } | 396 | fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } |
244 | 397 | ||
245 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } | 398 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } |
246 | test_deps_mode_one() { $luarocks build --tree="$testing_sys_tree" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; } | 399 | test_deps_mode_one() { $luarocks build --tree="system" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; } |
247 | test_deps_mode_order() { $luarocks build --tree="$testing_sys_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } | 400 | test_deps_mode_order() { $luarocks build --tree="system" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } |
248 | test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; } | 401 | test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; } |
249 | test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; } | 402 | test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; } |
250 | test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } | 403 | test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } |
251 | test_deps_mode_nodeps_alias() { $luarocks build --tree="$testing_tree" --nodeps lxsh; [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } | 404 | test_deps_mode_nodeps_alias() { $luarocks build --tree="$testing_tree" --nodeps lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } |
252 | test_deps_mode_make_order() { $luarocks build --tree="$testing_sys_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_tree" --deps-mode=order && cd ../.. && [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ] && rm -rf ./lxsh-${verrev_lxsh}; } | 405 | test_deps_mode_make_order() { $luarocks build --tree="$testing_sys_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_tree" --deps-mode=order && cd ../.. && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ] && rm -rf ./lxsh-${verrev_lxsh}; } |
253 | test_deps_mode_make_order_sys() { $luarocks build --tree="$testing_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_sys_tree" --deps-mode=order && cd ../.. && [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ] && rm -rf ./lxsh-${verrev_lxsh}; } | 406 | test_deps_mode_make_order_sys() { $luarocks build --tree="$testing_tree" lpeg && rm -rf ./lxsh-${verrev_lxsh} && $luarocks download --src lxsh ${verrev_lxsh} && $luarocks unpack ./lxsh-${verrev_lxsh}.src.rock && cd lxsh-${verrev_lxsh}/lxsh-${version_lxsh}-1 && $luarocks make --tree="$testing_sys_tree" --deps-mode=order && cd ../.. && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ] && rm -rf ./lxsh-${verrev_lxsh}; } |
254 | 407 | ||
255 | test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; } | 408 | test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; } |
256 | test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; } | 409 | test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; } |
@@ -274,7 +427,6 @@ run_tests() { | |||
274 | else echo "FAIL: Unexpected failure."; exit 1 | 427 | else echo "FAIL: Unexpected failure."; exit 1 |
275 | fi | 428 | fi |
276 | done | 429 | done |
277 | |||
278 | grep "^fail_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test | 430 | grep "^fail_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test |
279 | do | 431 | do |
280 | echo "-------------------------------------------" | 432 | echo "-------------------------------------------" |
@@ -289,11 +441,17 @@ run_tests() { | |||
289 | } | 441 | } |
290 | 442 | ||
291 | run_with_minimal_environment() { | 443 | run_with_minimal_environment() { |
444 | echo "===========================================" | ||
445 | echo "Running with minimal environment" | ||
446 | echo "===========================================" | ||
292 | build_environment luacov | 447 | build_environment luacov |
293 | run_tests $1 | 448 | run_tests $1 |
294 | } | 449 | } |
295 | 450 | ||
296 | run_with_full_environment() { | 451 | run_with_full_environment() { |
452 | echo "===========================================" | ||
453 | echo "Running with full environment" | ||
454 | echo "===========================================" | ||
297 | build_environment luacov luafilesystem luasocket luabitop luaposix md5 lzlib | 455 | build_environment luacov luafilesystem luasocket luabitop luaposix md5 lzlib |
298 | run_tests $1 | 456 | run_tests $1 |
299 | } | 457 | } |
@@ -308,4 +466,10 @@ run_all_tests $1 | |||
308 | 466 | ||
309 | $testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin | 467 | $testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin |
310 | 468 | ||
311 | cat $testing_dir/luacov.report.out | 469 | if [ "$travis" ] |
470 | then | ||
471 | grep "Summary" -B1 -A1000 $testing_dir/luacov.report.out | ||
472 | else | ||
473 | cat "$testing_dir/luacov.report.out" | ||
474 | fi | ||
475 | |||