From 933386b16d944eac3f93100886b03c3ae745b802 Mon Sep 17 00:00:00 2001
From: Peter Melnichenko <mpeterval@gmail.com>
Date: Tue, 1 Nov 2016 22:19:38 +0300
Subject: Add a test for conflict resolution with mixed deploy types

---
 test/test_environment.lua                           | 10 +++++-----
 test/testfiles/mixed_deploy_type/mdt.c              |  6 ++++++
 test/testfiles/mixed_deploy_type/mdt.lua            |  1 +
 test/testfiles/mixed_deploy_type/mdt_file           |  1 +
 .../mixed_deploy_type-0.1.0-1.rockspec              | 21 +++++++++++++++++++++
 .../mixed_deploy_type-0.2.0-1.rockspec              | 21 +++++++++++++++++++++
 6 files changed, 55 insertions(+), 5 deletions(-)
 create mode 100644 test/testfiles/mixed_deploy_type/mdt.c
 create mode 100644 test/testfiles/mixed_deploy_type/mdt.lua
 create mode 100644 test/testfiles/mixed_deploy_type/mdt_file
 create mode 100644 test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec
 create mode 100644 test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec

(limited to 'test')

diff --git a/test/test_environment.lua b/test/test_environment.lua
index 196202df..6f6f1cfe 100644
--- a/test/test_environment.lua
+++ b/test/test_environment.lua
@@ -214,7 +214,7 @@ function test_env.set_args()
    return true
 end
 
-local function copy_dir(source_path, target_path)
+function test_env.copy_dir(source_path, target_path)
    local testing_paths = test_env.testing_paths
    if test_env.TEST_TARGET_OS == "windows" then
       execute_bool(testing_paths.win_tools .. "/cp -R ".. source_path .. "/. " .. target_path)
@@ -430,8 +430,8 @@ local function build_environment(rocks, env_variables)
       end
    end
    
-   copy_dir(testing_paths.testing_tree, testing_paths.testing_tree_copy)
-   copy_dir(testing_paths.testing_sys_tree, testing_paths.testing_sys_tree_copy)
+   test_env.copy_dir(testing_paths.testing_tree, testing_paths.testing_tree_copy)
+   test_env.copy_dir(testing_paths.testing_sys_tree, testing_paths.testing_sys_tree_copy)
 end
 
 --- Reset testing environment
@@ -441,12 +441,12 @@ local function reset_environment(testing_paths, md5sums)
 
    if testing_tree_md5 ~= md5sums.testing_tree_copy_md5 then
       test_env.remove_dir(testing_paths.testing_tree)
-      copy_dir(testing_paths.testing_tree_copy, testing_paths.testing_tree)
+      test_env.copy_dir(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)
-      copy_dir(testing_paths.testing_sys_tree_copy, testing_paths.testing_sys_tree)
+      test_env.copy_dir(testing_paths.testing_sys_tree_copy, testing_paths.testing_sys_tree)
    end
    print("\n[ENVIRONMENT RESET]")
 end
diff --git a/test/testfiles/mixed_deploy_type/mdt.c b/test/testfiles/mixed_deploy_type/mdt.c
new file mode 100644
index 00000000..a162ce23
--- /dev/null
+++ b/test/testfiles/mixed_deploy_type/mdt.c
@@ -0,0 +1,6 @@
+#include "lua.h"
+
+int luaopen_mdt(lua_State *L) {
+   lua_pushstring(L, "mdt.c");
+   return 1;
+}
diff --git a/test/testfiles/mixed_deploy_type/mdt.lua b/test/testfiles/mixed_deploy_type/mdt.lua
new file mode 100644
index 00000000..c9ca9c68
--- /dev/null
+++ b/test/testfiles/mixed_deploy_type/mdt.lua
@@ -0,0 +1 @@
+return "mdt.lua"
diff --git a/test/testfiles/mixed_deploy_type/mdt_file b/test/testfiles/mixed_deploy_type/mdt_file
new file mode 100644
index 00000000..1a15f7d7
--- /dev/null
+++ b/test/testfiles/mixed_deploy_type/mdt_file
@@ -0,0 +1 @@
+return "mdt_file"
diff --git a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec b/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec
new file mode 100644
index 00000000..91b725da
--- /dev/null
+++ b/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.1.0-1.rockspec
@@ -0,0 +1,21 @@
+package = "mixed_deploy_type"
+version = "0.1.0-1"
+source = {
+   url = "http://example.com"
+}
+description = {
+   homepage = "http://example.com",
+   license = "*** please specify a license ***"
+}
+dependencies = {}
+build = {
+   type = "builtin",
+   modules = {
+      mdt = "mdt/mdt.lua"
+   },
+   install = {
+      lua = {
+         mdt_file = "mdt/mdt_file"
+      }
+   }
+}
diff --git a/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec b/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec
new file mode 100644
index 00000000..9ca03180
--- /dev/null
+++ b/test/testfiles/mixed_deploy_type/mixed_deploy_type-0.2.0-1.rockspec
@@ -0,0 +1,21 @@
+package = "mixed_deploy_type"
+version = "0.2.0-1"
+source = {
+   url = "http://example.com"
+}
+description = {
+   homepage = "http://example.com",
+   license = "*** please specify a license ***"
+}
+dependencies = {}
+build = {
+   type = "builtin",
+   modules = {
+      mdt = "mdt/mdt.c"
+   },
+   install = {
+      lib = {
+         mdt_file = "mdt/mdt_file"
+      }
+   }
+}
-- 
cgit v1.2.3-55-g6feb