From 916f3b9afecbe6033ac2f39700e60c1ed4e0edc4 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sat, 8 Feb 2014 18:33:26 -0200 Subject: Add test for missing external deps. Improves coverage. A bug was uncovered writing this! --- test/testfiles/missing_external-0.1-1.rockspec | 24 ++++++++++++++++++++++++ test/testing.sh | 15 ++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/testfiles/missing_external-0.1-1.rockspec (limited to 'test') diff --git a/test/testfiles/missing_external-0.1-1.rockspec b/test/testfiles/missing_external-0.1-1.rockspec new file mode 100644 index 00000000..5f8e6219 --- /dev/null +++ b/test/testfiles/missing_external-0.1-1.rockspec @@ -0,0 +1,24 @@ +package = "missing_external" +version = "0.1-1" +source = { + -- any valid URL + url = "https://raw.github.com/keplerproject/luarocks/master/src/luarocks/build.lua" +} +description = { + summary = "Missing external dependency", +} +external_dependencies = { + INEXISTENT = { + library = "inexistentlib*", + header = "inexistentheader*.h", + } +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "builtin", + modules = { + build = "build.lua" + } +} diff --git a/test/testing.sh b/test/testing.sh index a0bfeeca..5ae21d81 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -72,6 +72,18 @@ upload_servers = { rsync = "localhost/tmp/luarocks_testing", }, } +external_deps_dirs = { + "/usr/local", + "/usr", + -- These are used for a test that fails, so it + -- can point to invalid paths: + { + prefix = "/opt", + bin = "bin", + include = "include", + lib = { "lib", "lib64" }, + } +} EOF ( cat $testing_dir/testing_config.lua @@ -327,8 +339,9 @@ test_build_diffversion() { $luarocks build luacov ${version_luacov}; } test_build_command() { $luarocks build stdlib; } test_build_install_bin() { $luarocks build luarepl; } fail_build_nohttps() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks build ./validate-args-${version_validate_args}-1.rockspec && rm ./validate-args-${version_validate_args}-1.rockspec; } -test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx && pwd && ls && $luarocks install $luasec && pwd && ls && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } +test_build_https() { need_luasocket; $luarocks download --rockspec validate-args ${verrev_validate_args} && $luarocks install $luasec && $luarocks build ./validate-args-${verrev_validate_args}.rockspec && rm ./validate-args-${verrev_validate_args}.rockspec; } test_build_supported_platforms() { $luarocks build lpty; } +fail_build_missing_external() { $luarocks build "$testing_dir/testfiles/missing_external-0.1-1.rockspec" INEXISTENT_INCDIR="/invalid/dir"; } test_build_deps_partial_match() { $luarocks build lrandom; } test_build_show_downloads() { export LUAROCKS_CONFIG="$testing_dir/testing_config_show_downloads.lua" && $luarocks build alien; export LUAROCKS_CONFIG="$testing_dir/testing_config.lua"; } -- cgit v1.2.3-55-g6feb