aboutsummaryrefslogtreecommitdiff
path: root/spec/quick
diff options
context:
space:
mode:
Diffstat (limited to 'spec/quick')
-rw-r--r--spec/quick/build.q122
-rw-r--r--spec/quick/config.q17
-rw-r--r--spec/quick/install.q124
-rw-r--r--spec/quick/list.q10
4 files changed, 273 insertions, 0 deletions
diff --git a/spec/quick/build.q b/spec/quick/build.q
new file mode 100644
index 00000000..c6ca433c
--- /dev/null
+++ b/spec/quick/build.q
@@ -0,0 +1,122 @@
1TEST: luarocks build: fails when given invalid argument
2RUN: luarocks build aoesuthaoeusahtoeustnaou --only-server=localhost
3EXIT: 1
4STDERR:
5--------------------------------------------------------------------------------
6Could not find a result named aoesuthaoeusahtoeustnaou
7--------------------------------------------------------------------------------
8
9
10
11================================================================================
12TEST: luarocks build: with no arguments behaves as luarocks make
13
14FILE: c_module-1.0-1.rockspec
15--------------------------------------------------------------------------------
16package = "c_module"
17version = "1.0-1"
18source = {
19 url = "http://example.com/c_module"
20}
21build = {
22 type = "builtin",
23 modules = {
24 c_module = { "c_module.c" }
25 }
26}
27--------------------------------------------------------------------------------
28FILE: c_module.c
29--------------------------------------------------------------------------------
30#include <lua.h>
31#include <lauxlib.h>
32
33int luaopen_c_module(lua_State* L) {
34 lua_newtable(L);
35 lua_pushinteger(L, 1);
36 lua_setfield(L, -2, "c_module");
37 return 1;
38}
39--------------------------------------------------------------------------------
40RUN: luarocks build
41EXISTS: c_module.%{lib_extension}
42
43
44
45================================================================================
46TEST: luarocks build: defaults to builtin type
47
48FILE: a_rock-1.0-1.rockspec
49--------------------------------------------------------------------------------
50rockspec_format = "3.0"
51package = "a_rock"
52version = "1.0-1"
53source = {
54 url = "file://%{url(%{fixtures_dir})}/a_rock.lua"
55}
56description = {
57 summary = "An example rockspec",
58}
59dependencies = {
60 "lua >= 5.1"
61}
62build = {
63 modules = {
64 build = "a_rock.lua"
65 },
66}
67--------------------------------------------------------------------------------
68RUN: luarocks build a_rock-1.0-1.rockspec
69RUN: luarocks show a_rock
70STDOUT:
71--------------------------------------------------------------------------------
72a_rock 1.0
73--------------------------------------------------------------------------------
74
75
76================================================================================
77TEST: luarocks build: fails if no permissions to access the specified tree #unix
78
79RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec
80EXIT: 4
81STDERR:
82--------------------------------------------------------------------------------
83requires exclusive access
84use --force-lock
85--------------------------------------------------------------------------------
86
87NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
88
89RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec --force-lock
90EXIT: 4
91STDERR:
92--------------------------------------------------------------------------------
93requires exclusive access
94failed to force the lock
95--------------------------------------------------------------------------------
96
97NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
98
99
100
101================================================================================
102TEST: luarocks build: fails if no permissions to access the parent #unix
103
104RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec
105EXIT: 4
106STDERR:
107--------------------------------------------------------------------------------
108requires exclusive access
109use --force-lock
110--------------------------------------------------------------------------------
111
112NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
113
114RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec --force-lock
115EXIT: 4
116STDERR:
117--------------------------------------------------------------------------------
118requires exclusive access
119failed to force the lock
120--------------------------------------------------------------------------------
121
122NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
diff --git a/spec/quick/config.q b/spec/quick/config.q
new file mode 100644
index 00000000..ec338f98
--- /dev/null
+++ b/spec/quick/config.q
@@ -0,0 +1,17 @@
1================================================================================
2TEST: luarocks config --system-config shows the path of the system config
3
4MKDIR: %{testing_lrprefix}/etc/luarocks
5
6FILE: %{testing_lrprefix}/etc/luarocks/config-%{LUA_VERSION}.lua
7--------------------------------------------------------------------------------
8
9--------------------------------------------------------------------------------
10
11RUN: luarocks config --system-config
12
13STDOUT:
14--------------------------------------------------------------------------------
15%{testing_lrprefix}/etc/luarocks/config-%{LUA_VERSION}.lua
16--------------------------------------------------------------------------------
17#TODO: ^^^ %{path()}
diff --git a/spec/quick/install.q b/spec/quick/install.q
new file mode 100644
index 00000000..2bccf2f1
--- /dev/null
+++ b/spec/quick/install.q
@@ -0,0 +1,124 @@
1===============================================================================
2TEST: luarocks install: handle versioned modules when installing another version with --keep #268
3
4FILE: myrock-1.0-1.rockspec
5--------------------------------------------------------------------------------
6rockspec_format = "3.0"
7package = "myrock"
8version = "1.0-1"
9source = {
10 url = "file://%{url(tmpdir)}/rock.lua"
11}
12build = {
13 modules = { rock = "rock.lua" }
14}
15--------------------------------------------------------------------------------
16
17FILE: myrock-2.0-1.rockspec
18--------------------------------------------------------------------------------
19rockspec_format = "3.0"
20package = "myrock"
21version = "2.0-1"
22source = {
23 url = "file://%{url(tmpdir)}/rock.lua"
24}
25build = {
26 modules = { rock = "rock.lua" }
27}
28--------------------------------------------------------------------------------
29
30FILE: rock.lua
31--------------------------------------------------------------------------------
32return "hello"
33--------------------------------------------------------------------------------
34
35RUN: luarocks build myrock-1.0-1.rockspec
36RUN: luarocks pack myrock
37RUN: luarocks remove myrock
38
39RUN: luarocks build myrock-2.0-1.rockspec
40RUN: luarocks pack myrock
41RUN: luarocks remove myrock
42
43RUN: luarocks install ./myrock-2.0-1.all.rock
44
45EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
46
47RUN: luarocks install ./myrock-1.0-1.all.rock --keep
48
49EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
50EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/myrock_1_0_1-rock.lua
51
52RUN: luarocks install ./myrock-2.0-1.all.rock
53
54EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
55NOT_EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/myrock_1_0_1-rock.lua
56
57
58
59===============================================================================
60TEST: luarocks install: handle versioned libraries when installing another version with --keep #268
61
62FILE: myrock-1.0-1.rockspec
63--------------------------------------------------------------------------------
64rockspec_format = "3.0"
65package = "myrock"
66version = "1.0-1"
67source = {
68 url = "file://%{url(tmpdir)}/c_module.c"
69}
70build = {
71 modules = {
72 c_module = { "c_module.c" }
73 }
74}
75--------------------------------------------------------------------------------
76
77FILE: myrock-2.0-1.rockspec
78--------------------------------------------------------------------------------
79rockspec_format = "3.0"
80package = "myrock"
81version = "2.0-1"
82source = {
83 url = "file://%{url(tmpdir)}/c_module.c"
84}
85build = {
86 modules = {
87 c_module = { "c_module.c" }
88 }
89}
90--------------------------------------------------------------------------------
91FILE: c_module.c
92--------------------------------------------------------------------------------
93#include <lua.h>
94#include <lauxlib.h>
95
96int luaopen_c_module(lua_State* L) {
97 lua_newtable(L);
98 lua_pushinteger(L, 1);
99 lua_setfield(L, -2, "c_module");
100 return 1;
101}
102--------------------------------------------------------------------------------
103
104RUN: luarocks build myrock-1.0-1.rockspec
105RUN: luarocks pack myrock
106RUN: luarocks remove myrock
107
108RUN: luarocks build myrock-2.0-1.rockspec
109RUN: luarocks pack myrock
110RUN: luarocks remove myrock
111
112RUN: luarocks install ./myrock-2.0-1.%{platform}.rock
113
114EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
115
116RUN: luarocks install ./myrock-1.0-1.%{platform}.rock --keep
117
118EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
119EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/myrock_1_0_1-c_module.%{lib_extension}
120
121RUN: luarocks install ./myrock-2.0-1.%{platform}.rock
122
123EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
124NOT_EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/myrock_1_0_1-c_module.%{lib_extension}
diff --git a/spec/quick/list.q b/spec/quick/list.q
new file mode 100644
index 00000000..7cbdee43
--- /dev/null
+++ b/spec/quick/list.q
@@ -0,0 +1,10 @@
1================================================================================
2TEST: luarocks list: invalid tree
3
4RUN: luarocks --tree=%{path(/some/invalid/tree)} list
5
6STDOUT:
7--------------------------------------------------------------------------------
8Rocks installed for Lua %{lua_version} in /some/invalid/tree
9--------------------------------------------------------------------------------
10#TODO: ^^^ %{path()}