diff options
Diffstat (limited to '')
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 2 | ||||
-rw-r--r-- | src/luarocks/type_check.lua | 2 | ||||
-rwxr-xr-x | test/testing.sh | 66 |
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 @@ | |||
1 | language: c | ||
2 | compiler: gcc | ||
3 | script: 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 | ||
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" |
@@ -97,17 +103,41 @@ export LUAROCKS_CONFIG="$testing_dir/testing_config.lua" | |||
97 | export LUA_PATH= | 103 | export LUA_PATH= |
98 | export LUA_CPATH= | 104 | export LUA_CPATH= |
99 | 105 | ||
100 | luadir="/Programs/Lua/Current" | 106 | luaversion=5.2.3 |
101 | platform="linux-x86" | 107 | if [ "$travis" ] |
108 | then | ||
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" | ||
122 | else | ||
123 | luadir="/Programs/Lua/Current" | ||
124 | platform="linux-x86" | ||
125 | fi | ||
102 | lua="$luadir/bin/lua" | 126 | lua="$luadir/bin/lua" |
103 | 127 | ||
128 | version_luasocket=3.0rc1 | ||
129 | verrev_luasocket=${version_luasocket}-1 | ||
130 | srcdir_luasocket=luasocket-3.0-rc1 | ||
131 | |||
104 | version_luacov=0.3 | 132 | version_luacov=0.3 |
105 | version_luasocket=2.0.2 | ||
106 | version_lxsh=0.8.6 | 133 | version_lxsh=0.8.6 |
107 | version_validate_args=1.5.4 | 134 | version_validate_args=1.5.4 |
108 | verrev_luasocket=${version_luasocket}-5 | ||
109 | verrev_lxsh=${version_lxsh}-2 | 135 | verrev_lxsh=${version_lxsh}-2 |
110 | 136 | ||
137 | # will change to luasec=luasec once LuaSec for Lua 5.2 is released | ||
138 | luasec="http://luarocks.org/repositories/rocks-scm/luasec-scm-1.rockspec" | ||
139 | #luasec=luasec | ||
140 | |||
111 | cd .. | 141 | cd .. |
112 | ./configure --with-lua="$luadir" | 142 | ./configure --with-lua="$luadir" |
113 | make clean | 143 | make clean |
@@ -181,10 +211,10 @@ test_build_diffversion() { $luarocks build luacov ${version_luacov}; } | |||
181 | test_build_command() { $luarocks build stdlib; } | 211 | test_build_command() { $luarocks build stdlib; } |
182 | test_build_install_bin() { $luarocks build luarepl; } | 212 | 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; } | 213 | 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; } |
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; } | 214 | 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; } |
185 | test_build_supported_platforms() { $luarocks build xctrl; } | 215 | test_build_supported_platforms() { $luarocks build lpty; } |
186 | 216 | ||
187 | test_build_deps_partial_match() { $luarocks build yaml; } | 217 | test_build_deps_partial_match() { if [ "$travis" ]; then return; fi; $luarocks build yaml; } |
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"; } | 218 | 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 | 219 | ||
190 | test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } | 220 | test_download_all() { $luarocks download --all validate-args && rm validate-args-*; } |
@@ -200,14 +230,16 @@ test_lint_ok() { $luarocks download --rockspec validate-args ${version_validate_ | |||
200 | test_list() { $luarocks list; } | 230 | test_list() { $luarocks list; } |
201 | test_list_porcelain() { $luarocks list --porcelain; } | 231 | test_list_porcelain() { $luarocks list --porcelain; } |
202 | 232 | ||
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}; } | 233 | 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}; } |
234 | 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}; } | 235 | 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}; } |
236 | 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 | 237 | ||
206 | test_new_version() { $luarocks download --rockspec luacov ${version_luacov} && $luarocks new_version ./luacov-${version_luacov}-1.rockspec 0.2 && rm ./luacov-0.*; } | 238 | 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-*; } | 239 | 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 | 240 | ||
209 | test_pack() { $luarocks list && $luarocks pack luacov && rm ./luacov-*.rock; } | 241 | 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; } | 242 | test_pack_src() { $luarocks install $luasec && $luarocks download --rockspec luasocket && $luarocks pack ./luasocket-${verrev_luasocket}.rockspec && rm ./luasocket-${version_luasocket}-*.rock; } |
211 | 243 | ||
212 | test_path() { $luarocks path --bin; } | 244 | test_path() { $luarocks path --bin; } |
213 | 245 | ||
@@ -222,7 +254,7 @@ test_search_missing() { $luarocks search missing_rock; } | |||
222 | 254 | ||
223 | test_show() { $luarocks show luacov; } | 255 | test_show() { $luarocks show luacov; } |
224 | test_show_modules() { $luarocks show --modules luacov; } | 256 | test_show_modules() { $luarocks show --modules luacov; } |
225 | test_show_depends() { $luarocks install luasec && $luarocks show luasec; } | 257 | test_show_depends() { $luarocks install $luasec && $luarocks show luasec; } |
226 | test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } | 258 | test_show_oldversion() { $luarocks install luacov ${version_luacov} && $luarocks show luacov ${version_luacov}; } |
227 | 259 | ||
228 | test_unpack_download() { rm -rf ./luasocket-${verrev_luasocket} && $luarocks unpack luasocket && rm -rf ./luasocket-${verrev_luasocket}; } | 260 | test_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 | |||
233 | test_admin_help() { $luarocks_admin help; } | 265 | test_admin_help() { $luarocks_admin help; } |
234 | 266 | ||
235 | test_admin_make_manifest() { $luarocks_admin make_manifest; } | 267 | test_admin_make_manifest() { $luarocks_admin make_manifest; } |
236 | test_admin_add_rsync() { $luarocks_admin --server=testing add ./luasocket-${verrev_luasocket}.src.rock; } | 268 | test_admin_add_rsync() { if [ "$travis" ]; then return; fi; $luarocks_admin --server=testing add ./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"; } | 269 | 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; } | 270 | fail_admin_add_missing() { $luarocks_admin --server=testing add; } |
239 | fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; } | 271 | fail_admin_invalidserver() { $luarocks_admin --server=invalid add ./luasocket-${verrev_luasocket}.src.rock; } |
240 | fail_admin_invalidrock() { $luarocks_admin --server=testing add invalid; } | 272 | 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; } | 273 | 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; } | 274 | 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; } | 275 | fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } |
244 | 276 | ||
245 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } | 277 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } |