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