aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rw-r--r--src/luarocks/fetch.lua2
-rw-r--r--src/luarocks/type_check.lua2
-rwxr-xr-xtest/testing.sh66
4 files changed, 54 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..dced928c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
1language: c
2compiler: gcc
3script: cd test && ./testing.sh --travis
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index e98d9cc2..53c9d748 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -233,7 +233,7 @@ function load_rockspec(filename, location)
233 name = "rockspec" 233 name = "rockspec"
234 else 234 else
235 name = basename:match("(.*)%.rockspec") 235 name = basename:match("(.*)%.rockspec")
236 if not name and not basename == "rockspec" then 236 if not name then
237 return nil, "Filename '"..filename.."' does not look like a rockspec." 237 return nil, "Filename '"..filename.."' does not look like a rockspec."
238 end 238 end
239 end 239 end
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua
index 6a0ee7e7..5436bde6 100644
--- a/src/luarocks/type_check.lua
+++ b/src/luarocks/type_check.lua
@@ -184,7 +184,7 @@ local function type_check_item(name, item, expected, context)
184 end 184 end
185 if expected ~= "string" then 185 if expected ~= "string" then
186 if not item:match("^"..expected.."$") then 186 if not item:match("^"..expected.."$") then
187 return nil, "Type mismatch on field "..context..name..": invalid value "..item 187 return nil, "Type mismatch on field "..context..name..": invalid value "..item.." does not match '"..expected.."'"
188 end 188 end
189 end 189 end
190 elseif expected_type == "table" then 190 elseif expected_type == "table" then
diff --git a/test/testing.sh b/test/testing.sh
index 6b8be3ab..bce65294 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"
@@ -97,17 +103,41 @@ export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"
97export LUA_PATH= 103export LUA_PATH=
98export LUA_CPATH= 104export LUA_CPATH=
99 105
100luadir="/Programs/Lua/Current" 106luaversion=5.2.3
101platform="linux-x86" 107if [ "$travis" ]
108then
109 pushd /tmp
110 if [ ! -e "lua/bin/lua" ]
111 then
112 mkdir -p lua
113 wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz"
114 tar zxvpf "lua-$luaversion.tar.gz"
115 cd "lua-$luaversion"
116 make linux INSTALL_TOP=/tmp/lua
117 make install INSTALL_TOP=/tmp/lua
118 fi
119 popd
120 luadir=/tmp/lua
121 platform="linux-x86_64"
122else
123 luadir="/Programs/Lua/Current"
124 platform="linux-x86"
125fi
102lua="$luadir/bin/lua" 126lua="$luadir/bin/lua"
103 127
128version_luasocket=3.0rc1
129verrev_luasocket=${version_luasocket}-1
130srcdir_luasocket=luasocket-3.0-rc1
131
104version_luacov=0.3 132version_luacov=0.3
105version_luasocket=2.0.2
106version_lxsh=0.8.6 133version_lxsh=0.8.6
107version_validate_args=1.5.4 134version_validate_args=1.5.4
108verrev_luasocket=${version_luasocket}-5
109verrev_lxsh=${version_lxsh}-2 135verrev_lxsh=${version_lxsh}-2
110 136
137# will change to luasec=luasec once LuaSec for Lua 5.2 is released
138luasec="http://luarocks.org/repositories/rocks-scm/luasec-scm-1.rockspec"
139#luasec=luasec
140
111cd .. 141cd ..
112./configure --with-lua="$luadir" 142./configure --with-lua="$luadir"
113make clean 143make clean
@@ -181,10 +211,10 @@ test_build_diffversion() { $luarocks build luacov ${version_luacov}; }
181test_build_command() { $luarocks build stdlib; } 211test_build_command() { $luarocks build stdlib; }
182test_build_install_bin() { $luarocks build luarepl; } 212test_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; } 213fail_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; }
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; } 214test_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; }
185test_build_supported_platforms() { $luarocks build xctrl; } 215test_build_supported_platforms() { $luarocks build lpty; }
186 216
187test_build_deps_partial_match() { $luarocks build yaml; } 217test_build_deps_partial_match() { if [ "$travis" ]; then return; fi; $luarocks build yaml; }
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"; } 218test_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 219
190test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } 220test_download_all() { $luarocks download --all validate-args && rm validate-args-*; }
@@ -200,14 +230,16 @@ test_lint_ok() { $luarocks download --rockspec validate-args ${version_validate_
200test_list() { $luarocks list; } 230test_list() { $luarocks list; }
201test_list_porcelain() { $luarocks list --porcelain; } 231test_list_porcelain() { $luarocks list --porcelain; }
202 232
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}; } 233test_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}; }
234test_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}; } 235test_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}; }
236fail_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 237
206test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; } 238test_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-*; } 239test_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 240
209test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; } 241test_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; } 242test_pack_src() { $luarocks install $luasec && $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; }
211 243
212test_path() { $luarocks path --bin; } 244test_path() { $luarocks path --bin; }
213 245
@@ -222,7 +254,7 @@ test_search_missing() { $luarocks search missing_rock; }
222 254
223test_show() { $luarocks show luacov; } 255test_show() { $luarocks show luacov; }
224test_show_modules() { $luarocks show --modules luacov; } 256test_show_modules() { $luarocks show --modules luacov; }
225test_show_depends() { $luarocks install luasec && $luarocks show luasec; } 257test_show_depends() { $luarocks install $luasec && $luarocks show luasec; }
226test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } 258test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; }
227 259
228test_unpack_download() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks unpack luasocket && rm -rf ./luasocket-${verrev_luasocket}; } 260test_unpack_download() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks unpack luasocket && rm -rf ./luasocket-${verrev_luasocket}; }
@@ -233,13 +265,13 @@ test_unpack_binary() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks build
233test_admin_help() { $luarocks_admin help; } 265test_admin_help() { $luarocks_admin help; }
234 266
235test_admin_make_manifest() { $luarocks_admin make_manifest; } 267test_admin_make_manifest() { $luarocks_admin make_manifest; }
236test_admin_add_rsync() { $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; } 268test_admin_add_rsync() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing add ./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"; } 269test_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; } 270fail_admin_add_missing() { $luarocks_admin --server=testing add; }
239fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; } 271fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; }
240fail_admin_invalidrock() { $luarocks_admin --server=testing add invalid; } 272fail_admin_invalidrock() { if [ "$travis" ]; then return 1; fi; $luarocks_admin --server=testing add invalid; }
241test_admin_refresh_cache() { $luarocks_admin --server=testing refresh_cache; } 273test_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; } 274test_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; } 275fail_admin_remove_missing() { $luarocks_admin --server=testing remove; }
244 276
245fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } 277fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; }