aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-12-18 15:32:00 -0200
committerHisham Muhammad <hisham@gobolinux.org>2013-12-18 15:32:00 -0200
commit7a9bd561c4fd86a58eda66df14c26cf49d8361f6 (patch)
treef2e0e9b44b043bac4879a19982235e64b37b44ee /test
parent346a73b842cc352edaf4563bd61a2ba1aa2db9be (diff)
downloadluarocks-7a9bd561c4fd86a58eda66df14c26cf49d8361f6.tar.gz
luarocks-7a9bd561c4fd86a58eda66df14c26cf49d8361f6.tar.bz2
luarocks-7a9bd561c4fd86a58eda66df14c26cf49d8361f6.zip
Test environment improvements
Diffstat (limited to 'test')
-rwxr-xr-xtest/testing.sh105
1 files changed, 64 insertions, 41 deletions
diff --git a/test/testing.sh b/test/testing.sh
index ec42bb56..24aa5e78 100755
--- a/test/testing.sh
+++ b/test/testing.sh
@@ -38,13 +38,17 @@ rm -rf "$testing_tree"
38rm -rf "$testing_sys_tree" 38rm -rf "$testing_sys_tree"
39rm -rf "$testing_tree_copy" 39rm -rf "$testing_tree_copy"
40rm -rf "$testing_sys_tree_copy" 40rm -rf "$testing_sys_tree_copy"
41rm -rf "$testing_cache"
42rm -rf "$testing_server"
43rm -rf "$testing_dir/testing_config.lua" 41rm -rf "$testing_dir/testing_config.lua"
44rm -rf "$testing_dir/testing_config_show_downloads.lua" 42rm -rf "$testing_dir/testing_config_show_downloads.lua"
45rm -rf "$testing_dir/testing_config_sftp.lua" 43rm -rf "$testing_dir/testing_config_sftp.lua"
46rm -rf "$testing_dir/luacov.config" 44rm -rf "$testing_dir/luacov.config"
47 45
46if [ "$1" == "--clean" ]
47then
48 rm -rf "$testing_cache"
49 rm -rf "$testing_server"
50fi
51
48mkdir -p "$testing_cache" 52mkdir -p "$testing_cache"
49 53
50[ "$1" = "clean" ] && { 54[ "$1" = "clean" ] && {
@@ -117,11 +121,13 @@ then
117 if [ ! -e "lua/bin/lua" ] 121 if [ ! -e "lua/bin/lua" ]
118 then 122 then
119 mkdir -p lua 123 mkdir -p lua
120 wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" 124 echo "Downloading lua $luaversion..."
121 tar zxvpf "lua-$luaversion.tar.gz" 125 wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null
126 tar zxpf "lua-$luaversion.tar.gz"
122 cd "lua-$luaversion" 127 cd "lua-$luaversion"
123 make linux INSTALL_TOP=/tmp/lua 128 echo "Building lua $luaversion..."
124 make install INSTALL_TOP=/tmp/lua 129 make linux INSTALL_TOP=/tmp/lua &> /dev/null
130 make install INSTALL_TOP=/tmp/lua &> /dev/null
125 fi 131 fi
126 popd 132 popd
127 luadir=/tmp/lua 133 luadir=/tmp/lua
@@ -188,38 +194,40 @@ luarocks_admin_nocov="run_lua --nocov luarocks-admin"
188 194
189################################################### 195###################################################
190 196
191if [ ! -d "$testing_server" ] 197mkdir -p "$testing_server"
192then 198(
193 mkdir "$testing_server" 199 cd "$testing_server"
194 ( 200 luarocks_repo="http://luarocks.org/repositories/rocks"
195 cd "$testing_server" 201 luarocks_scm_repo="http://luarocks.org/repositories/rocks-scm"
196 luarocks_repo="http://luarocks.org/repositories/rocks" 202 get() { [ -e `basename "$1"` ] || wget -c "$1"; }
197 luarocks_scm_repo="http://luarocks.org/repositories/rocks-scm" 203 get "$luarocks_repo/luacov-${verrev_luacov}.src.rock"
198 wget "$luarocks_repo/luacov-${verrev_luacov}.src.rock" 204 get "$luarocks_repo/luacov-${verrev_luacov}.rockspec"
199 wget "$luarocks_repo/luacov-${verrev_luacov}.rockspec" 205 get "$luarocks_repo/luadoc-3.0.1-1.src.rock"
200 wget "$luarocks_repo/luadoc-3.0.1-1.src.rock" 206 get "$luarocks_repo/lualogging-1.3.0-1.src.rock"
201 wget "$luarocks_repo/lualogging-1.3.0-1.src.rock" 207 get "$luarocks_repo/luasocket-${verrev_luasocket}.src.rock"
202 wget "$luarocks_repo/luasocket-${verrev_luasocket}.src.rock" 208 get "$luarocks_repo/luasocket-${verrev_luasocket}.rockspec"
203 wget "$luarocks_repo/luasocket-${verrev_luasocket}.rockspec" 209 get "$luarocks_repo/luafilesystem-1.6.2-1.src.rock"
204 wget "$luarocks_repo/luafilesystem-1.6.2-1.src.rock" 210 get "$luarocks_repo/stdlib-35-1.src.rock"
205 wget "$luarocks_repo/stdlib-35-1.src.rock" 211 get "$luarocks_repo/luarepl-0.4-1.src.rock"
206 wget "$luarocks_repo/luarepl-0.4-1.src.rock" 212 get "$luarocks_repo/validate-args-1.5.4-1.rockspec"
207 wget "$luarocks_repo/validate-args-1.5.4-1.rockspec" 213 get "$luarocks_scm_repo/luasec-scm-1.rockspec"
208 wget "$luarocks_scm_repo/luasec-scm-1.rockspec" 214 get "$luarocks_repo/luabitop-1.0.2-1.rockspec"
209 wget "$luarocks_repo/luabitop-1.0.2-1.rockspec" 215 get "$luarocks_repo/lpty-1.0.1-1.src.rock"
210 wget "$luarocks_repo/lpty-1.0.1-1.src.rock" 216 get "$luarocks_repo/cprint-${verrev_cprint}.src.rock"
211 wget "$luarocks_repo/cprint-${verrev_cprint}.src.rock" 217 get "$luarocks_repo/cprint-${verrev_cprint}.rockspec"
212 wget "$luarocks_repo/cprint-${verrev_cprint}.rockspec" 218 get "$luarocks_repo/wsapi-1.6-1.src.rock"
213 wget "$luarocks_repo/wsapi-1.6-1.src.rock" 219 get "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock"
214 wget "$luarocks_repo/lxsh-${verrev_lxsh}.src.rock" 220 get "$luarocks_repo/abelhas-1.0-1.rockspec"
215 wget "$luarocks_repo/abelhas-1.0-1.rockspec" 221 get "$luarocks_repo/lzlib-0.4.work3-1.src.rock"
216 wget "$luarocks_repo/lzlib-0.4.work3-1.src.rock" 222 get "$luarocks_repo/lpeg-0.12-1.src.rock"
217 wget "$luarocks_repo/lpeg-0.12-1.src.rock" 223 get "$luarocks_repo/luaposix-31-1.src.rock"
218 wget "$luarocks_repo/luaposix-31-1.src.rock" 224 get "$luarocks_repo/md5-1.2-1.src.rock"
219 wget "$luarocks_repo/md5-1.2-1.src.rock" 225 get "$luarocks_repo/lrandom-20120430.51-1.src.rock"
220 ) 226 get "$luarocks_repo/lrandom-20120430.52-1.src.rock"
221 $luarocks_admin_nocov make_manifest "$testing_server" 227 get "$luarocks_repo/lrandom-20120430.51-1.rockspec"
222fi 228 get "$luarocks_repo/lrandom-20120430.52-1.rockspec"
229)
230$luarocks_admin_nocov make_manifest "$testing_server"
223 231
224################################################### 232###################################################
225 233
@@ -234,9 +242,13 @@ build_environment() {
234 rm -rf "$testing_sys_tree_copy" 242 rm -rf "$testing_sys_tree_copy"
235 mkdir -p "$testing_tree" 243 mkdir -p "$testing_tree"
236 mkdir -p "$testing_sys_tree" 244 mkdir -p "$testing_sys_tree"
245 $luarocks_admin_nocov make_manifest "$testing_cache"
237 for package in "$@" 246 for package in "$@"
238 do 247 do
239 $luarocks_nocov build --tree="$testing_sys_tree" $package 248 $luarocks_nocov install --only-server="$testing_cache" --tree="$testing_sys_tree" $package || {
249 $luarocks_nocov build --tree="$testing_sys_tree" $package
250 $luarocks_nocov pack --tree="$testing_sys_tree" $package; mv $package-*.rock "$testing_cache"
251 }
240 done 252 done
241 eval `$luarocks_noecho_nocov path --bin` 253 eval `$luarocks_noecho_nocov path --bin`
242 cp -a "$testing_tree" "$testing_tree_copy" 254 cp -a "$testing_tree" "$testing_tree_copy"
@@ -410,7 +422,6 @@ run_tests() {
410 else echo "FAIL: Unexpected failure."; exit 1 422 else echo "FAIL: Unexpected failure."; exit 1
411 fi 423 fi
412 done 424 done
413
414 grep "^fail_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test 425 grep "^fail_$1.*(" < $testing_dir/testing.sh | cut -d'(' -f1 | while read test
415 do 426 do
416 echo "-------------------------------------------" 427 echo "-------------------------------------------"
@@ -425,11 +436,17 @@ run_tests() {
425} 436}
426 437
427run_with_minimal_environment() { 438run_with_minimal_environment() {
439 echo "==========================================="
440 echo "Running with minimal environment"
441 echo "==========================================="
428 build_environment luacov 442 build_environment luacov
429 run_tests $1 443 run_tests $1
430} 444}
431 445
432run_with_full_environment() { 446run_with_full_environment() {
447 echo "==========================================="
448 echo "Running with full environment"
449 echo "==========================================="
433 build_environment luacov luafilesystem luasocket luabitop luaposix md5 lzlib 450 build_environment luacov luafilesystem luasocket luabitop luaposix md5 lzlib
434 run_tests $1 451 run_tests $1
435} 452}
@@ -444,4 +461,10 @@ run_all_tests $1
444 461
445$testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin 462$testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin
446 463
447cat $testing_dir/luacov.report.out 464if [ "$travis" ]
465then
466 grep "Summary" -B1 -A1000 $testing_dir/luacov.report.out
467else
468 cat "$testing_dir/luacov.report.out"
469fi
470