aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/testllvmsubprojects.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/testllvmsubprojects.py')
-rw-r--r--tests/unittests/testllvmsubprojects.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/unittests/testllvmsubprojects.py b/tests/unittests/testllvmsubprojects.py
new file mode 100644
index 0000000..c39e7ae
--- /dev/null
+++ b/tests/unittests/testllvmsubprojects.py
@@ -0,0 +1,64 @@
+import os
+import unittest
+
+from modules.llvm import LLVMSubproject
+
+
+class TestLLVMSubproject(unittest.TestCase):
+ """Test that we have the right info on LLVM subprojects."""
+
+ def test_build_paths(self):
+ subprojects = LLVMSubproject.get_all_subprojects()
+
+ self.assertEqual(subprojects["clang"].cmake_path,
+ os.path.join("tools", "clang"))
+ self.assertEqual(subprojects["compiler-rt"].cmake_path,
+ os.path.join("projects", "compiler-rt"))
+ self.assertEqual(subprojects["libcxx"].cmake_path,
+ os.path.join("projects", "libcxx"))
+ self.assertEqual(subprojects["libcxxabi"].cmake_path,
+ os.path.join("projects", "libcxxabi"))
+ self.assertEqual(subprojects["libunwind"].cmake_path,
+ os.path.join("projects", "libunwind"))
+ self.assertEqual(subprojects["lld"].cmake_path,
+ os.path.join("tools", "lld"))
+ self.assertEqual(subprojects["lldb"].cmake_path,
+ os.path.join("tools", "lldb"))
+ self.assertEqual(subprojects["test-suite"].cmake_path,
+ os.path.join("projects", "test-suite"))
+
+ def test_cmake_vars(self):
+ subprojects = LLVMSubproject.get_all_subprojects()
+
+ self.assertEqual(
+ subprojects["clang"].cmake_var,
+ "LLVM_TOOL_CLANG_BUILD")
+ self.assertEqual(subprojects["compiler-rt"].cmake_var,
+ "LLVM_TOOL_COMPILER_RT_BUILD")
+ self.assertEqual(
+ subprojects["libcxx"].cmake_var,
+ "LLVM_TOOL_LIBCXX_BUILD")
+ self.assertEqual(subprojects["libcxxabi"].cmake_var,
+ "LLVM_TOOL_LIBCXXABI_BUILD")
+ self.assertEqual(
+ subprojects["libunwind"].cmake_var,
+ "LLVM_TOOL_LIBUNWIND_BUILD")
+ self.assertEqual(subprojects["lld"].cmake_var, "LLVM_TOOL_LLD_BUILD")
+ self.assertEqual(subprojects["lldb"].cmake_var, "LLVM_TOOL_LLDB_BUILD")
+ self.assertEqual(subprojects["test-suite"].cmake_var, None)
+
+ def test_get_cmake_path(self):
+ subproject = LLVMSubproject(
+ os.path.join(
+ "path",
+ "to",
+ "subproj"),
+ None)
+ cmake_path = subproject.get_cmake_path(os.path.join("llvm", "sources"))
+
+ self.assertEqual(
+ str(cmake_path),
+ os.path.join("llvm", "sources", "path", "to", "subproj"))
+
+if __name__ == "__main__":
+ unittest.main()