summaryrefslogtreecommitdiff
path: root/spec/quick
diff options
context:
space:
mode:
Diffstat (limited to 'spec/quick')
-rw-r--r--spec/quick/admin_make_manifest.q46
-rw-r--r--spec/quick/build.q405
-rw-r--r--spec/quick/cmd.q36
-rw-r--r--spec/quick/config.q97
-rw-r--r--spec/quick/doc.q13
-rw-r--r--spec/quick/install.q688
-rw-r--r--spec/quick/list.q45
-rw-r--r--spec/quick/make.q88
-rw-r--r--spec/quick/new_version.q213
-rw-r--r--spec/quick/pack.q128
-rw-r--r--spec/quick/path.q22
-rw-r--r--spec/quick/purge.q103
-rw-r--r--spec/quick/test.q51
13 files changed, 1935 insertions, 0 deletions
diff --git a/spec/quick/admin_make_manifest.q b/spec/quick/admin_make_manifest.q
new file mode 100644
index 0000000..527e86a
--- /dev/null
+++ b/spec/quick/admin_make_manifest.q
@@ -0,0 +1,46 @@
+SUITE: luarocks-admin make_manifest
+
+================================================================================
+TEST: runs
+
+FILE: test-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/test.lua"
+}
+build = {
+ type = "builtin",
+ modules = {
+ test = "test.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: test.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks make --pack-binary-rock ./test-1.0-1.rockspec
+
+RUN: luarocks-admin make_manifest .
+
+FILE_CONTENTS: ./manifest-%{lua_version}
+--------------------------------------------------------------------------------
+commands = {}
+modules = {}
+repository = {
+ test = {
+ ["1.0-1"] = {
+ {
+ arch = "all"
+ },
+ {
+ arch = "rockspec"
+ }
+ }
+ }
+}
+--------------------------------------------------------------------------------
diff --git a/spec/quick/build.q b/spec/quick/build.q
new file mode 100644
index 0000000..d0d6a89
--- /dev/null
+++ b/spec/quick/build.q
@@ -0,0 +1,405 @@
+SUITE: luarocks build
+
+================================================================================
+TEST: fails when given invalid argument
+RUN: luarocks build aoesuthaoeusahtoeustnaou --only-server=localhost
+EXIT: 1
+STDERR:
+--------------------------------------------------------------------------------
+Could not find a result named aoesuthaoeusahtoeustnaou
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: 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: 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: fails if no permissions to access the specified tree #unix
+
+RUN: luarocks build --tree=/usr ./a_rock-1.0-1.rockspec
+EXIT: 2
+STDERR:
+--------------------------------------------------------------------------------
+You may want to run as a privileged user,
+or use --local to install into your local tree
+or run 'luarocks config local_by_default true' to make --local the default.
+
+(You may need to configure your Lua package paths
+to use the local tree, see 'luarocks path --help')
+--------------------------------------------------------------------------------
+
+We show the OS permission denied error, so we don't show the --force-lock
+message.
+
+NOT_STDERR:
+--------------------------------------------------------------------------------
+try --force-lock
+--------------------------------------------------------------------------------
+
+NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
+
+
+
+================================================================================
+TEST: fails if tree is locked, --force-lock overrides #unix
+
+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"
+ },
+}
+--------------------------------------------------------------------------------
+
+FILE: %{testing_tree}/lockfile.lfs
+--------------------------------------------------------------------------------
+dummy lock file for testing
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --tree=%{testing_tree} ./a_rock-1.0-1.rockspec
+EXIT: 4
+STDERR:
+--------------------------------------------------------------------------------
+requires exclusive write access
+try --force-lock
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --tree=%{testing_tree} ./a_rock-1.0-1.rockspec --force-lock
+EXIT: 0
+
+
+
+================================================================================
+TEST: fails if no permissions to access the parent #unix
+
+RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0-1.rockspec
+EXIT: 2
+STDERR:
+--------------------------------------------------------------------------------
+Error: /usr/invalid/lib/luarocks/rocks-%{lua_version} does not exist
+and your user does not have write permissions in /usr
+
+You may want to run as a privileged user,
+or use --local to install into your local tree
+or run 'luarocks config local_by_default true' to make --local the default.
+
+(You may need to configure your Lua package paths
+to use the local tree, see 'luarocks path --help')
+--------------------------------------------------------------------------------
+
+We show the OS permission denied error, so we don't show the --force-lock
+message.
+
+NOT_STDERR:
+--------------------------------------------------------------------------------
+try --force-lock
+--------------------------------------------------------------------------------
+
+NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
+
+
+
+================================================================================
+TEST: luarocks build: do not rebuild when already installed
+
+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
+--------------------------------------------------------------------------------
+
+RUN: luarocks build a_rock-1.0-1.rockspec
+STDOUT:
+--------------------------------------------------------------------------------
+a_rock 1.0-1 is already installed
+Use --force to reinstall
+--------------------------------------------------------------------------------
+
+
+RUN: luarocks build a_rock-1.0-1.rockspec --force
+NOT_STDOUT:
+--------------------------------------------------------------------------------
+a_rock 1.0-1 is already installed
+Use --force to reinstall
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: supports --pin #pinning
+
+FILE: test-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/test.lua"
+}
+dependencies = {
+ "a_rock >= 0.8"
+}
+build = {
+ type = "builtin",
+ modules = {
+ test = "test.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: test.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --only-server=%{fixtures_dir}/a_repo test-1.0-1.rockspec --pin --tree=lua_modules
+
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/test-1.0-1.rockspec
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/a_rock/2.0-1/a_rock-2.0-1.rockspec
+
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/luarocks.lock
+
+FILE_CONTENTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/luarocks.lock
+--------------------------------------------------------------------------------
+return {
+ dependencies = {
+ a_rock = "2.0-1",
+ lua = "%{lua_version}-1"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: supports --pin --only-deps #pinning
+
+FILE: test-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/test.lua"
+}
+dependencies = {
+ "a_rock >= 0.8"
+}
+build = {
+ type = "builtin",
+ modules = {
+ test = "test.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: test.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --only-server=%{fixtures_dir}/a_repo test-1.0-1.rockspec --pin --only-deps --tree=lua_modules
+
+NOT_EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/test-1.0-1.rockspec
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/a_rock/2.0-1/a_rock-2.0-1.rockspec
+
+EXISTS: ./luarocks.lock
+
+FILE_CONTENTS: ./luarocks.lock
+--------------------------------------------------------------------------------
+return {
+ dependencies = {
+ a_rock = "2.0-1",
+ lua = "%{lua_version}-1"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: installs bin entries correctly
+
+FILE: test-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz",
+ dir = "an_upstream_tarball-0.1",
+}
+build = {
+ type = "builtin",
+ modules = {
+ my_module = "src/my_module.lua"
+ },
+ install = {
+ bin = {
+ "src/my_module.lua"
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build test-1.0-1.rockspec --tree=lua_modules
+
+RM: %{fixtures_dir}/bin/something.lua
+
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/test-1.0-1.rockspec
+
+FILE_CONTENTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/rock_manifest
+--------------------------------------------------------------------------------
+rock_manifest = {
+ bin = {
+ ["my_module.lua"] = "25884dbf5be7114791018a48199d4c04"
+ },
+ lua = {
+ ["my_module.lua"] = "25884dbf5be7114791018a48199d4c04"
+ },
+ ["test-1.0-1.rockspec"] =
+}
+--------------------------------------------------------------------------------
+
+EXISTS: ./lua_modules/bin/my_module.lua%{wrapper_extension}
+
+
+
+================================================================================
+TEST: downgrades directories correctly
+
+FILE: mytest-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "mytest"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz",
+ dir = "an_upstream_tarball-0.1",
+}
+build = {
+ modules = {
+ ["parent.child.my_module"] = "src/my_module.lua"
+ },
+}
+--------------------------------------------------------------------------------
+
+FILE: mytest-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "mytest"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz",
+ dir = "an_upstream_tarball-0.1",
+}
+build = {
+ modules = {
+ ["parent.child.my_module"] = "src/my_module.lua"
+ },
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build ./mytest-2.0-1.rockspec
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/parent/child/my_module.lua
+
+RUN: luarocks build ./mytest-1.0-1.rockspec
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/parent/child/my_module.lua
+
+RUN: luarocks build ./mytest-2.0-1.rockspec
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/parent/child/my_module.lua
diff --git a/spec/quick/cmd.q b/spec/quick/cmd.q
new file mode 100644
index 0000000..acde92b
--- /dev/null
+++ b/spec/quick/cmd.q
@@ -0,0 +1,36 @@
+SUITE: luarocks CLI
+
+================================================================================
+TEST: warns but continues if given an invalid version
+
+RUN: luarocks --lua-version 1.0
+
+STDOUT:
+--------------------------------------------------------------------------------
+Version : 1.0
+LUA : (interpreter not found)
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: reports if lua.h header is not found
+
+RUN: luarocks LUA_INCDIR=/bad/dir
+
+STDOUT:
+--------------------------------------------------------------------------------
+LUA_INCDIR : /bad/dir (lua.h not found)
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: reports if Lua library is not found
+
+RUN: luarocks LUA_LIBDIR=/bad/dir
+
+STDOUT:
+--------------------------------------------------------------------------------
+LUA_LIBDIR : /bad/dir (Lua library itself not found)
+--------------------------------------------------------------------------------
diff --git a/spec/quick/config.q b/spec/quick/config.q
new file mode 100644
index 0000000..d623056
--- /dev/null
+++ b/spec/quick/config.q
@@ -0,0 +1,97 @@
+SUITE: luarocks config
+
+================================================================================
+TEST: --system-config shows the path of the system config
+
+FILE: %{testing_lrprefix}/etc/luarocks/config-%{LUA_VERSION}.lua
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+RUN: luarocks config --system-config
+
+STDOUT:
+--------------------------------------------------------------------------------
+%{path(%{testing_lrprefix}/etc/luarocks/config-%{LUA_VERSION}.lua)}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: reports when setting a bad LUA_LIBDIR
+
+RUN: luarocks config variables.LUA_LIBDIR /some/bad/path
+
+LuaRocks writes configuration values as they are given, without auto-conversion
+of slashes for Windows:
+
+STDOUT:
+--------------------------------------------------------------------------------
+Wrote
+variables.LUA_LIBDIR = "/some/bad/path"
+--------------------------------------------------------------------------------
+
+STDERR:
+--------------------------------------------------------------------------------
+Warning: Failed finding the Lua library.
+Tried:
+
+LuaRocks may not work correctly when building C modules using this configuration.
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: reports when setting a bad LUA_INCDIR
+
+RUN: luarocks config variables.LUA_INCDIR /some/bad/path
+
+STDOUT:
+--------------------------------------------------------------------------------
+Wrote
+variables.LUA_INCDIR = "/some/bad/path"
+--------------------------------------------------------------------------------
+
+LuaRocks uses configuration values as they are given, without auto-conversion
+of slashes for Windows:
+
+STDERR:
+--------------------------------------------------------------------------------
+Warning: Failed finding Lua header lua.h (searched at /some/bad/path). You may need to install Lua development headers.
+
+LuaRocks may not work correctly when building C modules using this configuration.
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: rejects setting bad lua_dir
+
+RUN: luarocks config lua_dir /some/bad/dir
+EXIT: 1
+
+STDERR:
+--------------------------------------------------------------------------------
+Lua interpreter not found
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: reports when setting a bad LUA_INCDIR
+
+RUN: luarocks config variables.LUA_INCDIR /some/bad/path
+
+STDOUT:
+--------------------------------------------------------------------------------
+Wrote
+variables.LUA_INCDIR = "/some/bad/path"
+--------------------------------------------------------------------------------
+
+LuaRocks uses configuration values as they are given, without auto-conversion
+of slashes for Windows:
+
+STDERR:
+--------------------------------------------------------------------------------
+Warning: Failed finding Lua header lua.h (searched at /some/bad/path). You may need to install Lua development headers.
+
+LuaRocks may not work correctly when building C modules using this configuration.
+--------------------------------------------------------------------------------
diff --git a/spec/quick/doc.q b/spec/quick/doc.q
new file mode 100644
index 0000000..4c71f83
--- /dev/null
+++ b/spec/quick/doc.q
@@ -0,0 +1,13 @@
+SUITE: luarocks doc
+
+================================================================================
+TEST: --local
+
+RUN: luarocks install --local --only-server=%{fixtures_dir}/a_repo a_rock
+
+RUN: luarocks doc a_rock --local
+
+STDOUT:
+--------------------------------------------------------------------------------
+opening http://www.example.com
+--------------------------------------------------------------------------------
diff --git a/spec/quick/install.q b/spec/quick/install.q
new file mode 100644
index 0000000..e2df428
--- /dev/null
+++ b/spec/quick/install.q
@@ -0,0 +1,688 @@
+SUITE: luarocks install
+
+===============================================================================
+TEST: fails with no flags or arguments
+RUN: luarocks install
+EXIT: 1
+
+
+
+===============================================================================
+TEST: fails with an unknown rock
+RUN: luarocks install aoeuaoeuaoeiaoeuaoeua
+EXIT: 1
+
+
+
+===============================================================================
+TEST: fails with an invalid .rock argument
+RUN: luarocks install "invalid.rock"
+EXIT: 1
+
+
+
+===============================================================================
+TEST: fails with incompatible architecture
+RUN: luarocks install foo-1.0-1.impossible-x86.rock
+EXIT: 1
+STDERR:
+--------------------------------------------------------------------------------
+Incompatible architecture
+--------------------------------------------------------------------------------
+
+
+
+===============================================================================
+TEST: fails if not a zip file
+
+FILE: not_a_zipfile-1.0-1.src.rock
+--------------------------------------------------------------------------------
+I am not a zip file!
+--------------------------------------------------------------------------------
+RUN: luarocks install not_a_zipfile-1.0-1.src.rock
+EXIT: 1
+
+
+
+===============================================================================
+TEST: fails with an invalid patch
+
+FILE: invalid_patch-0.1-1.rockspec
+--------------------------------------------------------------------------------
+package = "invalid_patch"
+version = "0.1-1"
+source = {
+ -- any valid URL
+ url = "https://raw.github.com/keplerproject/luarocks/master/src/luarocks/build.lua"
+}
+description = {
+ summary = "A rockspec with an invalid patch",
+}
+dependencies = {
+ "lua >= 5.1"
+}
+build = {
+ type = "builtin",
+ modules = {
+ build = "build.lua"
+ },
+ patches = {
+ ["I_am_an_invalid_patch.patch"] =
+[[
+diff -Naur luadoc-3.0.1/src/luadoc/doclet/html.lua luadoc-3.0.1-new/src/luadoc/doclet/html.lua
+--- luadoc-3.0.1/src/luadoc/doclet/html.lua2007-12-21 15:50:48.000000000 -0200
++++ luadoc-3.0.1-new/src/luadoc/doclet/html.lua2008-02-28 01:59:53.000000000 -0300
+@@ -18,6 +18,7 @@
+- gabba gabba gabba
++ gobo gobo gobo
+]]
+ }
+}
+--------------------------------------------------------------------------------
+RUN: luarocks invalid_patch-0.1-1.rockspec
+EXIT: 1
+
+
+
+================================================================================
+TEST: handle versioned modules when installing another version with --keep #268
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-1.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks build myrock-2.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks install ./myrock-2.0-1.all.rock
+
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
+
+RUN: luarocks install ./myrock-1.0-1.all.rock --keep
+
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/myrock_1_0_1-rock.lua
+
+RUN: luarocks install ./myrock-2.0-1.all.rock
+
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/rock.lua
+NOT_EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/myrock_1_0_1-rock.lua
+
+
+
+================================================================================
+TEST: handle versioned libraries when installing another version with --keep #268
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/c_module.c"
+}
+build = {
+ modules = {
+ c_module = { "c_module.c" }
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/c_module.c"
+}
+build = {
+ 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 myrock-1.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks build myrock-2.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks install ./myrock-2.0-1.%{platform}.rock
+
+EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
+
+RUN: luarocks install ./myrock-1.0-1.%{platform}.rock --keep
+
+EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
+EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/myrock_1_0_1-c_module.%{lib_extension}
+
+RUN: luarocks install ./myrock-2.0-1.%{platform}.rock
+
+EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/c_module.%{lib_extension}
+NOT_EXISTS: %{testing_sys_tree}/lib/lua/%{LUA_VERSION}/myrock_1_0_1-c_module.%{lib_extension}
+
+
+
+================================================================================
+TEST: installs a package with a bin entry
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" },
+ install = {
+ bin = {
+ ["scripty"] = "rock.lua",
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-1.0-1.rockspec
+EXISTS: %{testing_sys_tree}/bin/scripty%{wrapper_extension}
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+NOT_EXISTS: %{testing_sys_tree}/bin/scripty%{wrapper_extension}
+
+RUN: luarocks install myrock-1.0-1.all.rock
+EXISTS: %{testing_sys_tree}/bin/scripty%{wrapper_extension}
+
+
+
+================================================================================
+TEST: installs a package without its documentation using --no-doc
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "."
+}
+build = {
+ modules = { rock = "rock.lua" },
+ install = {
+ bin = {
+ ["scripty"] = "rock.lua",
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+FILE: doc/something
+--------------------------------------------------------------------------------
+a doc
+--------------------------------------------------------------------------------
+
+RUN: luarocks make
+EXISTS: %{testing_sys_rocks}/myrock/1.0-1/doc/something
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+NOT_EXISTS: %{testing_sys_rocks}/myrock/1.0-1/doc/something
+
+RUN: luarocks install myrock-1.0-1.all.rock
+EXISTS: %{testing_sys_rocks}/myrock/1.0-1/doc/something
+RUN: luarocks remove myrock
+NOT_EXISTS: %{testing_sys_rocks}/myrock/1.0-1/doc/something
+
+RUN: luarocks install myrock-1.0-1.all.rock --no-doc
+NOT_EXISTS: %{testing_sys_rocks}/myrock/1.0-1/doc/something
+
+
+
+================================================================================
+TEST: handle non-Lua files in build.install.lua when upgrading sailorproject/sailor#138
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "."
+}
+build = {
+ modules = {
+ rock = "rock.lua",
+ },
+ install = {
+ lua = {
+ ["sailor.blank-app.htaccess"] = "src/sailor/blank-app/.htaccess",
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-1.0-2.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-2"
+source = {
+ url = "."
+}
+build = {
+ modules = {
+ rock = "rock.lua",
+ },
+ install = {
+ lua = {
+ ["sailor.blank-app.htaccess"] = "src/sailor/blank-app/.htaccess",
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+FILE: src/sailor/blank-app/.htaccess
+--------------------------------------------------------------------------------
+# I am just a file
+--------------------------------------------------------------------------------
+
+Prepare two versions as .rock packages with the same non-Lua asset:
+
+RUN: luarocks make ./myrock-1.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks make ./myrock-1.0-2.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+Now install the first one, and check that the asset was installed, with no "~"
+backup leftover:
+
+RUN: luarocks install myrock-1.0-1.all.rock --no-doc
+
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/sailor/blank-app/.htaccess
+NOT_EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/sailor/blank-app/.htaccess~
+
+Then install the second one, and the asset should be replaced, again with no
+"~" backup leftover:
+
+RUN: luarocks install myrock-1.0-2.all.rock --no-doc
+
+EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/sailor/blank-app/.htaccess
+NOT_EXISTS: %{testing_sys_tree}/share/lua/%{LUA_VERSION}/sailor/blank-app/.htaccess~
+
+
+
+================================================================================
+TEST: do not reinstall when already installed
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-1.0-1.rockspec
+RUN: luarocks pack myrock
+RUN: luarocks remove myrock
+
+RUN: luarocks install ./myrock-1.0-1.all.rock
+
+RUN: luarocks show myrock
+STDOUT:
+--------------------------------------------------------------------------------
+myrock 1.0
+--------------------------------------------------------------------------------
+
+RUN: luarocks install ./myrock-1.0-1.all.rock
+STDOUT:
+--------------------------------------------------------------------------------
+myrock 1.0-1 is already installed
+Use --force to reinstall
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: installation rolls back on failure
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = {
+ ["folder.rock"] = "rock.lua",
+ ["xyz"] = "xyz.lua",
+ },
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+FILE: xyz.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks make --pack-binary-rock ./myrock-1.0-1.rockspec
+
+FILE: %{testing_sys_tree}/share/lua/%{lua_version}/folder
+--------------------------------------------------------------------------------
+a file where a folder should be
+--------------------------------------------------------------------------------
+
+Try to install and fail because the file is in the folder's spot:
+
+RUN: luarocks install ./myrock-1.0-1.all.rock
+EXIT: 1
+
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/folder
+
+No leftovers from the failed installation:
+
+NOT_EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/xyz.lua
+
+Now we remove the file...
+
+RM: %{testing_sys_tree}/share/lua/%{lua_version}/folder
+
+Try again and succeed:
+
+RUN: luarocks install ./myrock-1.0-1.all.rock
+
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/folder/rock.lua
+EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/xyz.lua
+
+
+
+================================================================================
+TEST: new install functionality based on #552: break dependencies warning
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: hasdep-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "hasdep"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/hasdep.lua"
+}
+dependencies = {
+ "myrock >= 2.0",
+}
+build = {
+ modules = { hasdep = "hasdep.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+FILE: hasdep.lua
+--------------------------------------------------------------------------------
+return "hasdep"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-2.0-1.rockspec
+RUN: luarocks build hasdep-1.0-1.rockspec
+RUN: luarocks build myrock-1.0-1.rockspec
+
+STDERR:
+--------------------------------------------------------------------------------
+Will not remove myrock 2.0
+Removing it would break dependencies for
+hasdep 1.0
+--------------------------------------------------------------------------------
+
+EXISTS: %{testing_sys_rocks}/myrock/1.0-1
+EXISTS: %{testing_sys_rocks}/myrock/2.0-1
+
+
+
+================================================================================
+TEST: new install functionality based on #552: break dependencies with --force
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: hasdep-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "hasdep"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/hasdep.lua"
+}
+dependencies = {
+ "myrock >= 2.0",
+}
+build = {
+ modules = { hasdep = "hasdep.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+FILE: hasdep.lua
+--------------------------------------------------------------------------------
+return "hasdep"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-2.0-1.rockspec
+RUN: luarocks build hasdep-1.0-1.rockspec
+RUN: luarocks build myrock-1.0-1.rockspec --force
+
+STDERR:
+--------------------------------------------------------------------------------
+The following packages may be broken by this forced removal
+hasdep 1.0
+--------------------------------------------------------------------------------
+
+NOT_EXISTS: %{testing_sys_rocks}/myrock/2.0-1
+EXISTS: %{testing_sys_rocks}/myrock/1.0-1
+
+
+
+================================================================================
+TEST: new install functionality based on #552: break dependencies with --force-fast
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: hasdep-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "hasdep"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/hasdep.lua"
+}
+dependencies = {
+ "myrock >= 2.0",
+}
+build = {
+ modules = { hasdep = "hasdep.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+FILE: hasdep.lua
+--------------------------------------------------------------------------------
+return "hasdep"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-2.0-1.rockspec
+RUN: luarocks build hasdep-1.0-1.rockspec
+RUN: luarocks build myrock-1.0-1.rockspec --force-fast
+
+NOT_STDERR:
+--------------------------------------------------------------------------------
+The following packages may be broken by this forced removal
+hasdep 1.0
+--------------------------------------------------------------------------------
+
+NOT_EXISTS: %{testing_sys_rocks}/myrock/2.0-1
+EXISTS: %{testing_sys_rocks}/myrock/1.0-1
diff --git a/spec/quick/list.q b/spec/quick/list.q
new file mode 100644
index 0000000..a40f37e
--- /dev/null
+++ b/spec/quick/list.q
@@ -0,0 +1,45 @@
+SUITE: luarocks list
+
+================================================================================
+TEST: invalid tree
+
+RUN: luarocks --tree=%{path(/some/invalid/tree)} list
+
+STDOUT:
+--------------------------------------------------------------------------------
+Rocks installed for Lua %{lua_version} in %{path(/some/invalid/tree)}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: --porcelain
+
+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 list --porcelain
+
+STDOUT:
+--------------------------------------------------------------------------------
+a_rock 1.0-1 installed %{testing_sys_rocks}
+--------------------------------------------------------------------------------
diff --git a/spec/quick/make.q b/spec/quick/make.q
new file mode 100644
index 0000000..eb3472b
--- /dev/null
+++ b/spec/quick/make.q
@@ -0,0 +1,88 @@
+SUITE: luarocks make
+
+================================================================================
+TEST: overrides luarocks.lock with --pin #pinning
+
+FILE: test-2.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "2.0-1"
+source = {
+ url = "file://%{path(tmpdir)}/test.lua"
+}
+dependencies = {
+ "a_rock >= 0.8"
+}
+build = {
+ type = "builtin",
+ modules = {
+ test = "test.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: test.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+FILE: luarocks.lock
+--------------------------------------------------------------------------------
+return {
+ dependencies = {
+ ["a_rock"] = "1.0-1",
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks make --only-server=%{fixtures_dir}/a_repo --pin --tree=lua_modules
+
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/2.0-1/test-2.0-1.rockspec
+EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/a_rock/2.0-1/a_rock-2.0-1.rockspec
+
+FILE_CONTENTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/2.0-1/luarocks.lock
+--------------------------------------------------------------------------------
+return {
+ dependencies = {
+ a_rock = "2.0-1",
+ lua = "%{lua_version}-1"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: running make twice builds twice
+
+FILE: test-2.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "2.0-1"
+source = {
+ url = "file://%{path(tmpdir)}/test.lua"
+}
+build = {
+ type = "builtin",
+ modules = {
+ test = "test.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: test.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks make --only-server=%{fixtures_dir}/a_repo --pin --tree=lua_modules
+STDOUT:
+--------------------------------------------------------------------------------
+test 2.0-1 is now installed
+--------------------------------------------------------------------------------
+
+RUN: luarocks make --only-server=%{fixtures_dir}/a_repo --pin --tree=lua_modules
+STDOUT:
+--------------------------------------------------------------------------------
+test 2.0-1 is now installed
+--------------------------------------------------------------------------------
diff --git a/spec/quick/new_version.q b/spec/quick/new_version.q
new file mode 100644
index 0000000..98426db
--- /dev/null
+++ b/spec/quick/new_version.q
@@ -0,0 +1,213 @@
+SUITE: luarocks new_version
+
+================================================================================
+TEST: fails without a context
+
+RUN: luarocks new_version
+EXIT: 1
+
+
+
+================================================================================
+TEST: fails with invalid arg
+
+RUN: luarocks new_version i_dont_exist
+EXIT: 1
+
+
+
+================================================================================
+TEST: updates a version
+
+FILE: myexample-0.1-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.1-1"
+source = {
+ url = "git+https://localhost/myexample.git",
+ tag = "v0.1"
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks new_version myexample-0.1-1.rockspec 0.2
+
+FILE_CONTENTS: myexample-0.2-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.2-1"
+source = {
+ url = "git+https://localhost/myexample.git",
+ tag = "v0.2"
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: updates via tag
+
+FILE: myexample-0.1-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.1-1"
+source = {
+ url = "git+https://localhost/myexample.git",
+ tag = "v0.1"
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks new_version myexample-0.1-1.rockspec --tag v0.2
+
+FILE_CONTENTS: myexample-0.2-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.2-1"
+source = {
+ url = "git+https://localhost/myexample.git",
+ tag = "v0.2"
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: updates URL
+
+FILE: myexample-0.1-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.1-1"
+source = {
+ url = "https://localhost/myexample-0.1.tar.gz",
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks new_version myexample-0.1-1.rockspec 0.2 https://localhost/newpath/myexample-0.2.tar.gz
+
+FILE_CONTENTS: myexample-0.2-1.rockspec
+--------------------------------------------------------------------------------
+package = "myexample"
+version = "0.2-1"
+source = {
+ url = "https://localhost/newpath/myexample-0.2.tar.gz"
+}
+description = {
+ summary = "xxx",
+ detailed = "xxx"
+}
+build = {
+ type = "builtin",
+ modules = {
+ foo = "src/foo.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: updates MD5
+
+FILE: test-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz",
+ md5 = "dca2ac30ce6c27cbd8dac4dd8f447630",
+}
+build = {
+ type = "builtin",
+ modules = {
+ my_module = "src/my_module.lua"
+ },
+ install = {
+ bin = {
+ "src/my_module.lua"
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks new_version test-1.0-1.rockspec 2.0 file://%{url(%{fixtures_dir})}/busted_project-0.1.tar.gz
+
+FILE_CONTENTS: test-2.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "test"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{fixtures_dir})}/busted_project-0.1.tar.gz",
+ md5 = "adfdfb8f1caa2b1f935a578fb07536eb",
+}
+build = {
+ type = "builtin",
+ modules = {
+ my_module = "src/my_module.lua"
+ },
+ install = {
+ bin = {
+ "src/my_module.lua"
+ }
+ }
+}
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: takes a URL, downloads and bumps revision by default
+
+RUN: luarocks new_version file://%{url(%{fixtures_dir})}/a_rock-1.0-1.rockspec
+
+EXISTS: a_rock-1.0-1.rockspec
+EXISTS: a_rock-1.0-2.rockspec
diff --git a/spec/quick/pack.q b/spec/quick/pack.q
new file mode 100644
index 0000000..ee44a45
--- /dev/null
+++ b/spec/quick/pack.q
@@ -0,0 +1,128 @@
+SUITE: luarocks pack
+
+================================================================================
+TEST: fails no arguments
+
+RUN: luarocks pack
+EXIT: 1
+
+
+
+================================================================================
+TEST: fails with invalid rockspec
+
+RUN: luarocks pack $%{fixtures_dir}/invalid_say-1.3-1.rockspec
+EXIT: 1
+
+
+
+================================================================================
+TEST: fails with rock that is not installed
+
+RUN: luarocks pack notinstalled
+EXIT: 1
+
+
+
+================================================================================
+TEST: fails with non existing path
+
+RUN: luarocks pack /notexists/notinstalled
+EXIT: 1
+
+
+
+================================================================================
+TEST: packs latest version version of rock
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-1.0-1.rockspec
+RUN: luarocks build myrock-2.0-1.rockspec --keep
+RUN: luarocks pack myrock
+
+EXISTS: myrock-2.0-1.all.rock
+
+
+
+================================================================================
+TEST: --sign #gpg
+PENDING: true
+
+FILE: myrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: myrock-2.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+package = "myrock"
+version = "2.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/rock.lua"
+}
+build = {
+ modules = { rock = "rock.lua" }
+}
+--------------------------------------------------------------------------------
+
+FILE: rock.lua
+--------------------------------------------------------------------------------
+return "hello"
+--------------------------------------------------------------------------------
+
+RUN: luarocks build myrock-1.0-1.rockspec
+RUN: luarocks build myrock-2.0-1.rockspec --keep
+RUN: luarocks pack myrock --sign
+
+EXISTS: myrock-2.0-1.all.rock
+EXISTS: myrock-2.0-1.all.rock.asc
+
+
+
+================================================================================
+TEST: packs a namespaced rock #namespaces
+
+RUN: luarocks build a_user/a_rock --server=%{fixtures_dir}/a_repo
+RUN: luarocks build a_rock --keep --server=%{fixtures_dir}/a_repo
+RUN: luarocks pack a_user/a_rock
+
+EXISTS: a_rock-2.0-1.all.rock
diff --git a/spec/quick/path.q b/spec/quick/path.q
new file mode 100644
index 0000000..77fc188
--- /dev/null
+++ b/spec/quick/path.q
@@ -0,0 +1,22 @@
+================================================================================
+TEST: luarocks path: --project-tree
+
+
+RUN: luarocks path --project-tree=foo
+STDOUT:
+--------------------------------------------------------------------------------
+%{path(foo/share/lua/%{lua_version}/?.lua)}
+%{path(foo/share/lua/%{lua_version}/?/init.lua)}
+--------------------------------------------------------------------------------
+
+RUN: luarocks path --project-tree=foo --tree=bar
+NOT_STDOUT:
+--------------------------------------------------------------------------------
+%{path(foo/share/lua/%{lua_version}/?.lua)}
+%{path(foo/share/lua/%{lua_version}/?/init.lua)}
+--------------------------------------------------------------------------------
+STDOUT:
+--------------------------------------------------------------------------------
+%{path(bar/share/lua/%{lua_version}/?.lua)}
+%{path(bar/share/lua/%{lua_version}/?/init.lua)}
+--------------------------------------------------------------------------------
diff --git a/spec/quick/purge.q b/spec/quick/purge.q
new file mode 100644
index 0000000..1fb6129
--- /dev/null
+++ b/spec/quick/purge.q
@@ -0,0 +1,103 @@
+SUITE: luarocks purge
+
+================================================================================
+TEST: needs a --tree argument
+RUN: luarocks purge
+EXIT: 1
+
+================================================================================
+TEST: missing tree
+RUN: luarocks purge --tree=missing-tree
+EXIT: 1
+
+================================================================================
+TEST: missing --tree argument
+RUN: luarocks purge --tree=
+EXIT: 1
+
+
+================================================================================
+TEST: runs
+
+FILE: testrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "testrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/testrock.lua"
+}
+dependencies = {
+ "a_rock >= 0.8"
+}
+build = {
+ type = "builtin",
+ modules = {
+ testrock = "testrock.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: testrock.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec
+
+EXISTS: %{testing_sys_rocks}/testrock
+EXISTS: %{testing_sys_rocks}/a_rock
+
+RUN: luarocks purge --tree=%{testing_sys_tree}
+
+NOT_EXISTS: %{testing_sys_rocks}/testrock
+NOT_EXISTS: %{testing_sys_rocks}/a_rock
+
+
+
+================================================================================
+TEST: works with missing files
+
+FILE: testrock-1.0-1.rockspec
+--------------------------------------------------------------------------------
+package = "testrock"
+version = "1.0-1"
+source = {
+ url = "file://%{url(%{tmpdir})}/testrock.lua"
+}
+dependencies = {
+ "a_rock >= 0.8"
+}
+build = {
+ type = "builtin",
+ modules = {
+ testrock = "testrock.lua"
+ }
+}
+--------------------------------------------------------------------------------
+
+FILE: testrock.lua
+--------------------------------------------------------------------------------
+return {}
+--------------------------------------------------------------------------------
+
+RUN: luarocks build --only-server=%{fixtures_dir}/a_repo testrock-1.0-1.rockspec
+
+RMDIR: %{testing_sys_tree}/share/lua/%{lua_version}/testrock
+
+RUN: luarocks purge --tree=%{testing_sys_tree}
+
+NOT_EXISTS: %{testing_sys_rocks}/testrock
+NOT_EXISTS: %{testing_sys_rocks}/a_rock
+
+
+
+================================================================================
+TEST: --old-versions
+
+RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 2.0
+RUN: luarocks install --only-server=%{fixtures_dir}/a_repo a_rock 1.0 --keep
+
+RUN: luarocks purge --old-versions --tree=%{testing_sys_tree}
+
+EXISTS: %{testing_sys_rocks}/a_rock/2.0-1
+NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1
diff --git a/spec/quick/test.q b/spec/quick/test.q
new file mode 100644
index 0000000..cb5ccd7
--- /dev/null
+++ b/spec/quick/test.q
@@ -0,0 +1,51 @@
+================================================================================
+TEST: luarocks test: handle if test.command is not a string
+
+Regression test for #1055.
+
+FILE: example-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+source = {
+ url = "",
+}
+package = "example"
+version = "1.0-1"
+test = {
+ type = "command",
+ command = {"./unit.lua"},
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks test
+EXIT: 1
+STDERR:
+--------------------------------------------------------------------------------
+'command' expects a string
+--------------------------------------------------------------------------------
+
+
+
+================================================================================
+TEST: luarocks test: handle if test.script is not a string
+
+FILE: example-1.0-1.rockspec
+--------------------------------------------------------------------------------
+rockspec_format = "3.0"
+source = {
+ url = "",
+}
+package = "example"
+version = "1.0-1"
+test = {
+ type = "command",
+ script = {"./unit.lua"},
+}
+--------------------------------------------------------------------------------
+
+RUN: luarocks test
+EXIT: 1
+STDERR:
+--------------------------------------------------------------------------------
+'script' expects a string
+--------------------------------------------------------------------------------