aboutsummaryrefslogtreecommitdiff
path: root/spec/quick/build.q
blob: c6ca433c9970781f83d4af27663181d75375b9bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
TEST: luarocks build: fails when given invalid argument
RUN: luarocks build aoesuthaoeusahtoeustnaou --only-server=localhost
EXIT: 1
STDERR:
--------------------------------------------------------------------------------
Could not find a result named aoesuthaoeusahtoeustnaou
--------------------------------------------------------------------------------



================================================================================
TEST: luarocks build: with no arguments behaves as luarocks make

FILE: c_module-1.0-1.rockspec
--------------------------------------------------------------------------------
package = "c_module"
version = "1.0-1"
source = {
   url = "http://example.com/c_module"
}
build = {
   type = "builtin",
   modules = {
      c_module = { "c_module.c" }
   }
}
--------------------------------------------------------------------------------
FILE: c_module.c
--------------------------------------------------------------------------------
#include <lua.h>
#include <lauxlib.h>

int luaopen_c_module(lua_State* L) {
  lua_newtable(L);
  lua_pushinteger(L, 1);
  lua_setfield(L, -2, "c_module");
  return 1;
}
--------------------------------------------------------------------------------
RUN: luarocks build
EXISTS: c_module.%{lib_extension}



================================================================================
TEST: luarocks build: defaults to builtin type

FILE: a_rock-1.0-1.rockspec
--------------------------------------------------------------------------------
rockspec_format = "3.0"
package = "a_rock"
version = "1.0-1"
source = {
   url = "file://%{url(%{fixtures_dir})}/a_rock.lua"
}
description = {
   summary = "An example rockspec",
}
dependencies = {
   "lua >= 5.1"
}
build = {
   modules = {
      build = "a_rock.lua"
   },
}
--------------------------------------------------------------------------------
RUN: luarocks build a_rock-1.0-1.rockspec
RUN: luarocks show a_rock
STDOUT:
--------------------------------------------------------------------------------
a_rock 1.0
--------------------------------------------------------------------------------


================================================================================
TEST: luarocks build: fails if no permissions to access the specified tree #unix

RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec
EXIT: 4
STDERR:
--------------------------------------------------------------------------------
requires exclusive access
use --force-lock
--------------------------------------------------------------------------------

NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec

RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec --force-lock
EXIT: 4
STDERR:
--------------------------------------------------------------------------------
requires exclusive access
failed to force the lock
--------------------------------------------------------------------------------

NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec



================================================================================
TEST: luarocks build: fails if no permissions to access the parent #unix

RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec
EXIT: 4
STDERR:
--------------------------------------------------------------------------------
requires exclusive access
use --force-lock
--------------------------------------------------------------------------------

NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec

RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec --force-lock
EXIT: 4
STDERR:
--------------------------------------------------------------------------------
requires exclusive access
failed to force the lock
--------------------------------------------------------------------------------

NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec