From 47a9e7571f5aefd48d5e8d168bd56f07e296b18e Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 11 Jul 2016 21:29:37 +0200 Subject: Update new_version, pack tests --- .../invalid_validate-args-1.5.4-1.rockspec | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/testfiles/invalid_validate-args-1.5.4-1.rockspec (limited to 'test') diff --git a/test/testfiles/invalid_validate-args-1.5.4-1.rockspec b/test/testfiles/invalid_validate-args-1.5.4-1.rockspec new file mode 100644 index 00000000..0b4d807d --- /dev/null +++ b/test/testfiles/invalid_validate-args-1.5.4-1.rockspec @@ -0,0 +1,35 @@ +package = 'validate-args' +version = '1.5.4-1' +source = {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{++{ + url = "https://bitbucket.org/djerius/validate.args/downloads/validate-args-1.5.4.tar.gz" +} + +description = { + summary = "Function argument validation", + detailed = [[ + validate.args is a Lua module that provides a framework for + validation of arguments to Lua functions as well as complex data + structures. The included validate.inplace module provides "live" + validation during assignment of values to elements in tables. ]], + license = "GPL-3", + +} + +dependencies = { + "lua >= 5.1" +} + +build = { + + type = "builtin", + + modules = { + ["validate.args"] = "validate/args.lua", + ["validate.inplace"] = "validate/inplace.lua", + }, + + copy_directories = { + "doc", "tests" + } + +} -- cgit v1.2.3-55-g6feb From 1656a4c7a2dac25d2dd2e5d2211ce0e7eb000b19 Mon Sep 17 00:00:00 2001 From: roboo Date: Thu, 14 Jul 2016 00:29:01 +0200 Subject: need_rock() added, new flag noreset environment --- spec/build_spec.lua | 2 -- spec/install_spec.lua | 3 --- spec/remove_spec.lua | 7 ++++--- test/test_environment.lua | 23 ++++++++++++----------- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 1ce99089..682c6dcf 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -169,12 +169,10 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) it("LuaRocks build missing external", function() - assert.is_true(test_env.need_luasocket()) assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) end) it("LuaRocks build invalid patch", function() - assert.is_true(test_env.need_luasocket()) assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) end) end) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 0e406e22..9bc11e87 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -83,20 +83,17 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install only-deps of luasocket packed rock", function() - assert.is_true(test_env.need_luasocket()) local output = run.luarocks("install --only-deps " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock") assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1") end) it("LuaRocks install binary rock of cprint", function() - assert.is_true(test_env.need_luasocket()) assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) end) it("LuaRocks install reinstall", function() - assert.is_true(test_env.need_luasocket()) assert.is_true(run.luarocks_bool("install " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) assert.is_true(run.luarocks_bool("install --deps-mode=none " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) end) diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 41c6348a..c7f83b95 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua @@ -44,8 +44,11 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() end) describe("LuaRocks remove more complex tests", function() + before_each(function() + assert.is_true(test_env.need_rock("luasocket")) + end) + it("LuaRocks remove fail, break dependencies", function() - assert.is_true(test_env.need_luasocket()) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) @@ -54,7 +57,6 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() end) it("LuaRocks remove force", function() - assert.is_true(test_env.need_luasocket()) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) @@ -64,7 +66,6 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() end) it("LuaRocks remove force fast", function() - assert.is_true(test_env.need_luasocket()) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) assert.is_true(run.luarocks_bool("build lualogging")) diff --git a/test/test_environment.lua b/test/test_environment.lua index 6de7a4e2..eb545a47 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -14,6 +14,7 @@ USAGE ARGUMENTS env= Set type of environment to use ("minimal" or "full", default: "minimal"). + noreset Don't reset environment after each test clean Remove existing testing environment. travis Add if running on TravisCI. os= Set OS ("linux", "osx", or "windows"). @@ -96,10 +97,13 @@ end function test_env.set_args() -- if at least Lua/LuaJIT version argument was found on input start to parse other arguments to env. variables test_env.TYPE_TEST_ENV = "minimal" + test_env.RESET_ENV = true for _, argument in ipairs(arg) do if argument:find("^env=") then test_env.TYPE_TEST_ENV = argument:match("^env=(.*)$") + elseif argument == "noreset" then + test_env.RESET_ENV = false elseif argument == "clean" then test_env.TEST_ENV_CLEAN = true elseif argument == "travis" then @@ -333,6 +337,7 @@ local function reset_environment(testing_paths, md5sums) test_env.remove_dir(testing_paths.testing_tree) execute_bool("cp -a " .. testing_paths.testing_tree_copy .. "/. " .. testing_paths.testing_tree) end + if testing_sys_tree_md5 ~= md5sums.testing_sys_tree_copy_md5 then test_env.remove_dir(testing_paths.testing_sys_tree) execute_bool("cp -a " .. testing_paths.testing_sys_tree_copy .. "/. " .. testing_paths.testing_sys_tree) @@ -403,21 +408,17 @@ function test_env.setup_specs(extra_rocks) end end - reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables) + if test_env.RESET_ENV then + reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables) + end end ---- Helper function for tests which needs luasocket installed -function test_env.need_luasocket() - if test_env.run.luarocks_nocov("show luasocket") then +--- Test if required rock is installed if not, install it +function test_env.need_rock(rock) + if test_env.run.luarocks_nocov("show " .. rock) then return true else - local testing_cache = test_env.testing_paths.testing_cache .. "/" - local luasocket_rock = "luasocket-3.0rc1-1." .. test_env.platform .. ".rock" - if not exists(testing_cache .. luasocket_rock) then - test_env.run.luarocks_nocov("build --pack-binary-rock luasocket 3.0rc1-1") - os.rename(luasocket_rock, testing_cache .. luasocket_rock) - end - return test_env.run.luarocks_nocov("install " .. testing_cache .. luasocket_rock) + return test_env.run.luarocks_nocov("install " .. rock) end end -- cgit v1.2.3-55-g6feb