diff options
Diffstat (limited to 'spec/quick/build.q')
-rw-r--r-- | spec/quick/build.q | 122 |
1 files changed, 122 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 | ||