diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-04 17:25:39 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-06 12:38:45 -0300 |
| commit | 6e7e522ffe3204243306cba8d128a7ec21f591f9 (patch) | |
| tree | 7d6b03d99928ba338e5212dd6b0e077297ea72b0 /spec/util/test_env.lua | |
| parent | 526fd923282d03c89c2511f858eb1d66bdba782b (diff) | |
| download | luarocks-6e7e522ffe3204243306cba8d128a7ec21f591f9.tar.gz luarocks-6e7e522ffe3204243306cba8d128a7ec21f591f9.tar.bz2 luarocks-6e7e522ffe3204243306cba8d128a7ec21f591f9.zip | |
build: make "builtin" the default build.type
Diffstat (limited to 'spec/util/test_env.lua')
| -rw-r--r-- | spec/util/test_env.lua | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 08d5c850..0c140be7 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
| @@ -344,12 +344,17 @@ local function download_rocks(urls, save_path) | |||
| 344 | end | 344 | end |
| 345 | 345 | ||
| 346 | --- Create a file containing a string. | 346 | --- Create a file containing a string. |
| 347 | -- @param path string: path to file. | 347 | -- @param pathname string: path to file. |
| 348 | -- @param str string: content of the file. | 348 | -- @param str string: content of the file. |
| 349 | local function write_file(path, str) | 349 | function test_env.write_file(pathname, str, finally) |
| 350 | local file = assert(io.open(path, "w")) | 350 | local file = assert(io.open(pathname, "w")) |
| 351 | file:write(str) | 351 | file:write(str) |
| 352 | file:close() | 352 | file:close() |
| 353 | if finally then | ||
| 354 | finally(function() | ||
| 355 | os.remove(pathname) | ||
| 356 | end) | ||
| 357 | end | ||
| 353 | end | 358 | end |
| 354 | 359 | ||
| 355 | --- Create md5sum of directory structure recursively, based on filename and size | 360 | --- Create md5sum of directory structure recursively, based on filename and size |
| @@ -666,8 +671,8 @@ local function create_configs() | |||
| 666 | testing_cache = test_env.testing_paths.testing_cache | 671 | testing_cache = test_env.testing_paths.testing_cache |
| 667 | }) | 672 | }) |
| 668 | 673 | ||
| 669 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") | 674 | test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") |
| 670 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content | 675 | test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content |
| 671 | .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") | 676 | .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") |
| 672 | 677 | ||
| 673 | -- testing_config_sftp.lua | 678 | -- testing_config_sftp.lua |
| @@ -691,7 +696,7 @@ local function create_configs() | |||
| 691 | testing_cache = test_env.testing_paths.testing_cache | 696 | testing_cache = test_env.testing_paths.testing_cache |
| 692 | }) | 697 | }) |
| 693 | 698 | ||
| 694 | write_file(test_env.testing_paths.testrun_dir .. "/testing_config_sftp.lua", config_content) | 699 | test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_sftp.lua", config_content) |
| 695 | 700 | ||
| 696 | -- luacov.config | 701 | -- luacov.config |
| 697 | config_content = substitute([[ | 702 | config_content = substitute([[ |
| @@ -710,7 +715,7 @@ local function create_configs() | |||
| 710 | testrun_dir = test_env.testing_paths.testrun_dir | 715 | testrun_dir = test_env.testing_paths.testrun_dir |
| 711 | }) | 716 | }) |
| 712 | 717 | ||
| 713 | write_file(test_env.testing_paths.testrun_dir .. "/luacov.config", config_content) | 718 | test_env.write_file(test_env.testing_paths.testrun_dir .. "/luacov.config", config_content) |
| 714 | 719 | ||
| 715 | config_content = [[ | 720 | config_content = [[ |
| 716 | -- Config file of mock LuaRocks.org site for tests | 721 | -- Config file of mock LuaRocks.org site for tests |
| @@ -720,7 +725,7 @@ local function create_configs() | |||
| 720 | api_version = "1", | 725 | api_version = "1", |
| 721 | } | 726 | } |
| 722 | ]] | 727 | ]] |
| 723 | write_file(test_env.testing_paths.testrun_dir .. "/luarocks_site.lua", config_content) | 728 | test_env.write_file(test_env.testing_paths.testrun_dir .. "/luarocks_site.lua", config_content) |
| 724 | end | 729 | end |
| 725 | 730 | ||
| 726 | --- Remove testing directories. | 731 | --- Remove testing directories. |
