aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/testing.sh268
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
10if [ -z "$@" ] 10if [ -z "$*" ]
11then 11then
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 }
16fi 16fi
17 17
18if [ "$1" == "--travis" ]
19then
20 travis=true
21 shift
22fi
23
18testing_dir="$PWD" 24testing_dir="$PWD"
19 25
20testing_tree="$testing_dir/testing" 26testing_tree="$testing_dir/testing"
@@ -22,6 +28,7 @@ testing_sys_tree="$testing_dir/testing_sys"
22testing_tree_copy="$testing_dir/testing_copy" 28testing_tree_copy="$testing_dir/testing_copy"
23testing_sys_tree_copy="$testing_dir/testing_sys_copy" 29testing_sys_tree_copy="$testing_dir/testing_sys_copy"
24testing_cache="$testing_dir/testing_cache" 30testing_cache="$testing_dir/testing_cache"
31testing_server="$testing_dir/testing_server"
25 32
26[ "$1" ] || rm -f luacov.stats.out 33[ "$1" ] || rm -f luacov.stats.out
27rm -f luacov.report.out 34rm -f luacov.report.out
@@ -31,12 +38,19 @@ rm -rf "$testing_tree"
31rm -rf "$testing_sys_tree" 38rm -rf "$testing_sys_tree"
32rm -rf "$testing_tree_copy" 39rm -rf "$testing_tree_copy"
33rm -rf "$testing_sys_tree_copy" 40rm -rf "$testing_sys_tree_copy"
34rm -rf "$testing_cache"
35rm -rf "$testing_dir/testing_config.lua" 41rm -rf "$testing_dir/testing_config.lua"
36rm -rf "$testing_dir/testing_config_show_downloads.lua" 42rm -rf "$testing_dir/testing_config_show_downloads.lua"
37rm -rf "$testing_dir/testing_config_sftp.lua" 43rm -rf "$testing_dir/testing_config_sftp.lua"
38rm -rf "$testing_dir/luacov.config" 44rm -rf "$testing_dir/luacov.config"
39 45
46if [ "$1" == "--clean" ]
47then
48 rm -rf "$testing_cache"
49 rm -rf "$testing_server"
50fi
51
52mkdir -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"
45cat <<EOF > $testing_dir/testing_config.lua 59cat <<EOF > $testing_dir/testing_config.lua
46rocks_trees = { 60rocks_trees = {
47 "$testing_tree", 61 "$testing_tree",
48 "$testing_sys_tree", 62 { name = "system", root = "$testing_sys_tree" },
63}
64rocks_servers = {
65 "$testing_server"
49} 66}
50local_cache = "$testing_cache" 67local_cache = "$testing_cache"
51upload_server = "testing" 68upload_server = "testing"
@@ -97,31 +114,124 @@ export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"
97export LUA_PATH= 114export LUA_PATH=
98export LUA_CPATH= 115export LUA_CPATH=
99 116
100luadir="/Programs/Lua/Current" 117luaversion=5.2.3
101platform="linux-x86" 118if [ "$travis" ]
119then
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
134else
135 luadir="/Programs/Lua/Current"
136fi
137
138if [ `uname -m` = i686 ]
139then
140 platform="linux-x86"
141else
142 platform="linux-x86_64"
143fi
144
102lua="$luadir/bin/lua" 145lua="$luadir/bin/lua"
103 146
104version_luacov=0.3 147version_luasocket=3.0rc1
105version_luasocket=2.0.2 148verrev_luasocket=${version_luasocket}-1
149srcdir_luasocket=luasocket-3.0-rc1
150
151version_cprint=0.1
152verrev_cprint=0.1-1
153
154version_luacov=0.4
155verrev_luacov=0.4-1
106version_lxsh=0.8.6 156version_lxsh=0.8.6
107version_validate_args=1.5.4 157version_validate_args=1.5.4
108verrev_luasocket=${version_luasocket}-5 158verrev_validate_args=1.5.4-1
109verrev_lxsh=${version_lxsh}-2 159verrev_lxsh=${version_lxsh}-2
110 160
161luasec=luasec
162
111cd .. 163cd ..
112./configure --with-lua="$luadir" 164./configure --with-lua="$luadir"
113make clean 165make clean
114make src/luarocks/site_config.lua 166make src/luarocks/site_config.lua
115make dev 167make dev
116cd src 168cd src
169basedir=$PWD
170run_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}
186luarocks="run_lua luarocks"
187luarocks_nocov="run_lua --nocov luarocks"
188luarocks_noecho="run_lua --noecho luarocks"
189luarocks_noecho_nocov="run_lua --noecho --nocov luarocks"
190luarocks_admin="run_lua luarocks-admin"
191luarocks_admin_nocov="run_lua --nocov luarocks-admin"
117 192
118echo $LUA_PATH 193###################################################
119
120luarocks_nocov="$lua $PWD/bin/luarocks"
121luarocks="$lua -erequire('luacov.runner')('$testing_dir/luacov.config') $PWD/bin/luarocks"
122luarocks_admin="$lua -erequire('luacov.runner')('$testing_dir/luacov.config') $PWD/bin/luarocks-admin"
123 194
124$luarocks_nocov download luacov 195mkdir -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
232checksum_path() {
233 ( cd "$1"; find . -printf "%s %p\n" | md5sum )
234}
125 235
126build_environment() { 236build_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
142reset_environment() { 258reset_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
273need() {
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}
291need_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; }
176fail_make_norockspec() { $luarocks make; } 320fail_make_norockspec() { $luarocks make; }
177 321
178fail_build_blank_arg() { $luarocks build --tree="" lpeg; } 322fail_build_blank_arg() { $luarocks build --tree="" lpeg; }
179test_build_withpatch() { $luarocks build luadoc; } 323test_build_withpatch() { need_luasocket; $luarocks build luadoc; }
180test_build_diffversion() { $luarocks build luacov ${version_luacov}; } 324test_build_diffversion() { $luarocks build luacov ${version_luacov}; }
181test_build_command() { $luarocks build stdlib; } 325test_build_command() { $luarocks build stdlib; }
182test_build_install_bin() { $luarocks build luarepl; } 326test_build_install_bin() { $luarocks build luarepl; }
183fail_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; } 327fail_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; }
184test_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; } 328test_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; }
185test_build_supported_platforms() { $luarocks build xctrl; } 329test_build_supported_platforms() { $luarocks build lpty; }
186 330
187test_build_deps_partial_match() { $luarocks build yaml; } 331test_build_deps_partial_match() { $luarocks build lrandom; }
188test_build_show_downloads() { export LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" && $luarocks build alien; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } 332test_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
190test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } 334test_download_all() { $luarocks download --all validate-args && rm validate-args-*; }
191test_download_rockspecversion() { $luarocks download --rockspec validate-args ${version_validate_args} && rm validate-args-*; } 335test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; }
192 336
193test_help() { $luarocks help; } 337test_help() { $luarocks help; }
194 338
195test_install_binaryrock() { $luarocks build luasocket && $luarocks pack luasocket && $luarocks install ./luasocket-${verrev_luasocket}.${platform}.rock && rm ./luasocket-${verrev_luasocket}.${platform}.rock; } 339test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; }
196test_install_with_bin() { $luarocks install wsapi; } 340test_install_with_bin() { $luarocks install wsapi; }
341fail_install_notazipfile() { $luarocks install "$testing_dir/testfiles/not_a_zipfile-1.0-1.src.rock"; }
197 342
198test_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; } 343test_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; }
344fail_lint_type_mismatch_string() { $luarocks lint "$testing_dir/testfiles/type_mismatch_string-1.0-1.rockspec"; }
345fail_lint_type_mismatch_version() { $luarocks lint "$testing_dir/testfiles/type_mismatch_version-1.0-1.rockspec"; }
346fail_lint_type_mismatch_table() { $luarocks lint "$testing_dir/testfiles/type_mismatch_table-1.0-1.rockspec"; }
199 347
200test_list() { $luarocks list; } 348test_list() { $luarocks list; }
201test_list_porcelain() { $luarocks list --porcelain; } 349test_list_porcelain() { $luarocks list --porcelain; }
202 350
203test_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}; } 351test_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}; }
352test_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}; }
204test_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}; } 353test_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}; }
354fail_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
206test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; } 356test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; }
207test_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-*; } 357test_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
209test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; } 359test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; }
210test_pack_src() { $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; } 360test_pack_src() { $luarocks install $luasec && $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; }
211 361
212test_path() { $luarocks path --bin; } 362test_path() { $luarocks path --bin; }
363test_path_lr_path() { $luarocks path --lr-path; }
364test_path_lr_cpath() { $luarocks path --lr-cpath; }
365test_path_lr_bin() { $luarocks path --lr-bin; }
213 366
214fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; } 367fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; }
215test_purge() { $luarocks purge --tree="$testing_sys_tree"; } 368test_purge() { $luarocks purge --tree="$testing_sys_tree"; }
@@ -222,35 +375,35 @@ test_search_missing() { $luarocks search missing_rock; }
222 375
223test_show() { $luarocks show luacov; } 376test_show() { $luarocks show luacov; }
224test_show_modules() { $luarocks show --modules luacov; } 377test_show_modules() { $luarocks show --modules luacov; }
225test_show_depends() { $luarocks install luasec && $luarocks show luasec; } 378test_show_depends() { need_luasocket; $luarocks install $luasec && $luarocks show luasec; }
226test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } 379test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; }
227 380
228test_unpack_download() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks unpack luasocket && rm -rf ./luasocket-${verrev_luasocket}; } 381test_unpack_download() { rm -rf ./cprint-${verrev_cprint} && $luarocks unpack cprint && rm -rf ./cprint-${verrev_cprint}; }
229test_unpack_src() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --src luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.src.rock && rm -rf ./luasocket-${verrev_luasocket}; } 382test_unpack_src() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --src cprint && $luarocks unpack ./cprint-${verrev_cprint}.src.rock && rm -rf ./cprint-${verrev_cprint}; }
230test_unpack_rockspec() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks download --rockspec luasocket && $luarocks unpack ./luasocket-${verrev_luasocket}.rockspec && rm -rf ./luasocket-${verrev_luasocket}; } 383test_unpack_rockspec() { rm -rf ./cprint-${verrev_cprint} && $luarocks download --rockspec cprint && $luarocks unpack ./cprint-${verrev_cprint}.rockspec && rm -rf ./cprint-${verrev_cprint}; }
231test_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}; } 384test_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
233test_admin_help() { $luarocks_admin help; } 386test_admin_help() { $luarocks_admin help; }
234 387
235test_admin_make_manifest() { $luarocks_admin make_manifest; } 388test_admin_make_manifest() { $luarocks_admin make_manifest; }
236test_admin_add_rsync() { $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; } 389test_admin_add_rsync() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; }
237test_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"; } 390test_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"; }
238fail_admin_add_missing() { $luarocks_admin --server=testing add; } 391fail_admin_add_missing() { $luarocks_admin --server=testing add; }
239fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; } 392fail_admin_invalidserver() { $luarocks_admin --server=invalid add "$testing_server/luasocket-${verrev_luasocket}.src.rock"; }
240fail_admin_invalidrock() { $luarocks_admin --server=testing add invalid; } 393fail_admin_invalidrock() { if [ "$travis" ]; then return 1; fi; $luarocks_admin --server=testing add invalid; }
241test_admin_refresh_cache() { $luarocks_admin --server=testing refresh_cache; } 394test_admin_refresh_cache() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing refresh_cache; }
242test_admin_remove() { $luarocks_admin --server=testing remove ./luasocket-${verrev_luasocket}.src.rock; } 395test_admin_remove() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing remove luasocket-${verrev_luasocket}.src.rock; }
243fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } 396fail_admin_remove_missing() { $luarocks_admin --server=testing remove; }
244 397
245fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } 398fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; }
246test_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 ]; } 399test_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 ]; }
247test_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 ]; } 400test_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 ]; }
248test_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 ]; } 401test_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 ]; }
249test_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 ]; } 402test_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 ]; }
250test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } 403test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; }
251test_deps_mode_nodeps_alias() { $luarocks build --tree="$testing_tree" --nodeps lxsh; [ `$luarocks list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } 404test_deps_mode_nodeps_alias() { $luarocks build --tree="$testing_tree" --nodeps lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; }
252test_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}; } 405test_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}; }
253test_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}; } 406test_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
255test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; } 408test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; }
256test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; } 409test_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
291run_with_minimal_environment() { 443run_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
296run_with_full_environment() { 451run_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
311cat $testing_dir/luacov.report.out 469if [ "$travis" ]
470then
471 grep "Summary" -B1 -A1000 $testing_dir/luacov.report.out
472else
473 cat "$testing_dir/luacov.report.out"
474fi
475