diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/testfiles/luajit-fail-1.0-1.rockspec | 22 | ||||
-rw-r--r-- | test/testfiles/luajit-success-1.0-1.rockspec | 23 | ||||
-rwxr-xr-x | test/testing.sh | 72 |
3 files changed, 105 insertions, 12 deletions
diff --git a/test/testfiles/luajit-fail-1.0-1.rockspec b/test/testfiles/luajit-fail-1.0-1.rockspec new file mode 100644 index 00000000..f8204600 --- /dev/null +++ b/test/testfiles/luajit-fail-1.0-1.rockspec | |||
@@ -0,0 +1,22 @@ | |||
1 | package = "luajit-fail" | ||
2 | version = "1.0-1" | ||
3 | source = { | ||
4 | url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua", | ||
5 | } | ||
6 | description = { | ||
7 | summary = "Test luajit dependency fail", | ||
8 | detailed = [[ | ||
9 | Fail luajit dependency when running with rockspec_format < 3.0. | ||
10 | ]], | ||
11 | homepage = "http://luarocks.org/", | ||
12 | license = "MIT/X license" | ||
13 | } | ||
14 | dependencies = { | ||
15 | "luajit >= 2.0" | ||
16 | } | ||
17 | build = { | ||
18 | type = "builtin", | ||
19 | modules = { | ||
20 | testing = "testing.lua" | ||
21 | } | ||
22 | } | ||
diff --git a/test/testfiles/luajit-success-1.0-1.rockspec b/test/testfiles/luajit-success-1.0-1.rockspec new file mode 100644 index 00000000..31c930c3 --- /dev/null +++ b/test/testfiles/luajit-success-1.0-1.rockspec | |||
@@ -0,0 +1,23 @@ | |||
1 | rockspec_format = "3.0" | ||
2 | package = "luajit-success" | ||
3 | version = "1.0-1" | ||
4 | source = { | ||
5 | url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua", | ||
6 | } | ||
7 | description = { | ||
8 | summary = "Test luajit dependency fail", | ||
9 | detailed = [[ | ||
10 | Use luajit dependency when running with rockspec_format >= 3.0. | ||
11 | ]], | ||
12 | homepage = "http://luarocks.org/", | ||
13 | license = "MIT/X license" | ||
14 | } | ||
15 | dependencies = { | ||
16 | "luajit >= 2.0" | ||
17 | } | ||
18 | build = { | ||
19 | type = "builtin", | ||
20 | modules = { | ||
21 | testing = "testing.lua" | ||
22 | } | ||
23 | } | ||
diff --git a/test/testing.sh b/test/testing.sh index 26bdde5f..abda18d4 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -30,7 +30,15 @@ then | |||
30 | shift | 30 | shift |
31 | fi | 31 | fi |
32 | 32 | ||
33 | luashortversion=`echo $luaversion | cut -d. -f 1-2` | 33 | is_jit=`[ "${luaversion::3}" = "jit" ] && echo 1 || echo 0` |
34 | |||
35 | if [ "$is_jit" = 1 ] | ||
36 | then | ||
37 | luashortversion=5.1 | ||
38 | luajitversion=${luaversion:4} | ||
39 | else | ||
40 | luashortversion=`echo $luaversion | cut -d. -f 1-2` | ||
41 | fi | ||
34 | 42 | ||
35 | testing_dir="$PWD" | 43 | testing_dir="$PWD" |
36 | 44 | ||
@@ -147,13 +155,27 @@ then | |||
147 | if [ ! -e "$luadir/bin/lua" ] | 155 | if [ ! -e "$luadir/bin/lua" ] |
148 | then | 156 | then |
149 | mkdir -p lua | 157 | mkdir -p lua |
150 | echo "Downloading lua $luaversion..." | 158 | cd lua |
151 | wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null | 159 | if [ "$is_jit" = 1 ] |
152 | tar zxpf "lua-$luaversion.tar.gz" | 160 | then |
153 | cd "lua-$luaversion" | 161 | echo "Downloading LuaJIT $luajitversion..." |
154 | echo "Building lua $luaversion..." | 162 | #rm -f "LuaJIT-$luajitversion.tar.gz" |
155 | make linux INSTALL_TOP="$luadir" &> /dev/null | 163 | wget -c "http://luajit.org/download/LuaJIT-$luajitversion.tar.gz" &> /dev/null |
156 | make install INSTALL_TOP="$luadir" &> /dev/null | 164 | tar zxpf "LuaJIT-$luajitversion.tar.gz" |
165 | cd "LuaJIT-$luajitversion" | ||
166 | echo "Building LuaJIT $luajitversion..." | ||
167 | make PREFIX="$luadir" &> /dev/null | ||
168 | make install PREFIX="$luadir" &> /dev/null | ||
169 | else | ||
170 | echo "Downloading Lua $luaversion..." | ||
171 | #rm -f "lua-$luaversion.tar.gz" | ||
172 | wget -c "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null | ||
173 | tar zxpf "lua-$luaversion.tar.gz" | ||
174 | cd "lua-$luaversion" | ||
175 | echo "Building Lua $luaversion..." | ||
176 | make linux INSTALL_TOP="$luadir" &> /dev/null | ||
177 | make install INSTALL_TOP="$luadir" &> /dev/null | ||
178 | fi | ||
157 | fi | 179 | fi |
158 | popd | 180 | popd |
159 | [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa | 181 | [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa |
@@ -161,7 +183,13 @@ then | |||
161 | chmod og-wx ~/.ssh/authorized_keys | 183 | chmod og-wx ~/.ssh/authorized_keys |
162 | ssh-keyscan localhost >> ~/.ssh/known_hosts | 184 | ssh-keyscan localhost >> ~/.ssh/known_hosts |
163 | else | 185 | else |
164 | luadir="/Programs/Lua/Current" | 186 | if [ "$is_jit" = 1 ] |
187 | then | ||
188 | luadir="/Programs/LuaJIT/$luajitversion" | ||
189 | echo HELLO $luadir | ||
190 | else | ||
191 | luadir="/Programs/Lua/$luaversion" | ||
192 | fi | ||
165 | if [ ! -e "$luadir" ] | 193 | if [ ! -e "$luadir" ] |
166 | then | 194 | then |
167 | luadir="/usr/local" | 195 | luadir="/usr/local" |
@@ -175,7 +203,13 @@ else | |||
175 | platform="linux-x86_64" | 203 | platform="linux-x86_64" |
176 | fi | 204 | fi |
177 | 205 | ||
178 | lua="$luadir/bin/lua" | 206 | if [ "$is_jit" = 1 ] |
207 | then | ||
208 | lua="$luadir/bin/luajit" | ||
209 | luarocks_configure_extra_args="--lua-suffix=jit --with-lua-include=$luadir/include/luajit-2.0" | ||
210 | else | ||
211 | lua="$luadir/bin/lua" | ||
212 | fi | ||
179 | 213 | ||
180 | version_luasocket=3.0rc1 | 214 | version_luasocket=3.0rc1 |
181 | verrev_luasocket=${version_luasocket}-1 | 215 | verrev_luasocket=${version_luasocket}-1 |
@@ -196,7 +230,7 @@ verrev_abelhas=${version_abelhas}-1 | |||
196 | luasec=luasec | 230 | luasec=luasec |
197 | 231 | ||
198 | cd .. | 232 | cd .. |
199 | ./configure --with-lua="$luadir" --prefix="$testing_lrprefix" | 233 | ./configure --with-lua="$luadir" --prefix="$testing_lrprefix" $luarocks_configure_extra_args |
200 | make clean | 234 | make clean |
201 | make src/luarocks/site_config.lua | 235 | make src/luarocks/site_config.lua |
202 | make dev | 236 | make dev |
@@ -224,6 +258,7 @@ luarocks_noecho="run_lua --noecho luarocks" | |||
224 | luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" | 258 | luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" |
225 | luarocks_admin="run_lua luarocks-admin" | 259 | luarocks_admin="run_lua luarocks-admin" |
226 | luarocks_admin_nocov="run_lua --nocov luarocks-admin" | 260 | luarocks_admin_nocov="run_lua --nocov luarocks-admin" |
261 | luajit_luarocks="luajit -e require('luacov.runner')('$testing_dir/luacov.config') $basedir/bin/luarocks" | ||
227 | 262 | ||
228 | ################################################### | 263 | ################################################### |
229 | 264 | ||
@@ -242,7 +277,7 @@ mkdir -p "$testing_server" | |||
242 | get "$luarocks_repo/stdlib-41.0.0-1.src.rock" | 277 | get "$luarocks_repo/stdlib-41.0.0-1.src.rock" |
243 | get "$luarocks_repo/luarepl-0.4-1.src.rock" | 278 | get "$luarocks_repo/luarepl-0.4-1.src.rock" |
244 | get "$luarocks_repo/validate-args-1.5.4-1.rockspec" | 279 | get "$luarocks_repo/validate-args-1.5.4-1.rockspec" |
245 | get "$luarocks_repo/luasec-0.5-2.rockspec" | 280 | get "https://raw.githubusercontent.com/brunoos/luasec/master/luasec-0.6alpha-2.rockspec" |
246 | get "$luarocks_repo/luabitop-1.0.2-1.rockspec" | 281 | get "$luarocks_repo/luabitop-1.0.2-1.rockspec" |
247 | get "$luarocks_repo/lpty-1.0.1-1.src.rock" | 282 | get "$luarocks_repo/lpty-1.0.1-1.src.rock" |
248 | get "$luarocks_repo/cprint-${verrev_cprint}.src.rock" | 283 | get "$luarocks_repo/cprint-${verrev_cprint}.src.rock" |
@@ -524,6 +559,19 @@ test_fetch_base_dir() { $lua <<EOF | |||
524 | EOF | 559 | EOF |
525 | } | 560 | } |
526 | 561 | ||
562 | test_luajit_dependency() { | ||
563 | if [ "$is_jit" = 1 ] | ||
564 | then $luarocks build "$testing_dir/testfiles/luajit-success-1.0-1.rockspec" | ||
565 | else true | ||
566 | fi | ||
567 | } | ||
568 | fail_luajit_dependency() { | ||
569 | if [ "$is_jit" = 1 ] | ||
570 | then $luarocks build "$testing_dir/testfiles/luajit-fail-1.0-1.rockspec" | ||
571 | else false | ||
572 | fi | ||
573 | } | ||
574 | |||
527 | test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } | 575 | test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } |
528 | 576 | ||
529 | # Driver ######################################### | 577 | # Driver ######################################### |