[RISCV] Add RVVConstraint to SiFive custom matrix multiply instructions. (#124055)
[llvm-project.git] / lldb / test / API / functionalities / paths / TestPaths.py
blob29aa6f943ae427a0b5edfb42770fdc7fc3a18bd0
1 """
2 Test some lldb command abbreviations.
3 """
6 import lldb
7 import os
8 import sys
9 import json
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13 from lldbsuite.test import lldbplatformutil
16 class TestPaths(TestBase):
17 @no_debug_info_test
18 def test_paths(self):
19 """Test to make sure no file names are set in the lldb.SBFileSpec objects returned by lldb.SBHostOS.GetLLDBPath() for paths that are directories"""
20 dir_path_types = [
21 lldb.ePathTypeLLDBShlibDir,
22 lldb.ePathTypeSupportExecutableDir,
23 lldb.ePathTypeHeaderDir,
24 lldb.ePathTypePythonDir,
25 lldb.ePathTypeLLDBSystemPlugins,
26 lldb.ePathTypeLLDBUserPlugins,
27 lldb.ePathTypeLLDBTempSystemDir,
28 lldb.ePathTypeClangDir,
31 for path_type in dir_path_types:
32 f = lldb.SBHostOS.GetLLDBPath(path_type)
33 # No directory path types should have the filename set
34 self.assertIsNone(f.GetFilename())
36 shlib_dir = lldb.SBHostOS.GetLLDBPath(lldb.ePathTypeLLDBShlibDir).GetDirectory()
37 if lldbplatformutil.getHostPlatform() == "windows":
38 filenames = ["liblldb.dll"]
39 elif lldbplatformutil.getHostPlatform() == "macosx":
40 filenames = ["LLDB", "liblldb.dylib"]
41 else:
42 filenames = ["liblldb.so"]
43 self.assertTrue(
44 any([os.path.exists(os.path.join(shlib_dir, f)) for f in filenames]),
45 "shlib_dir = " + shlib_dir,
48 @no_debug_info_test
49 def test_interpreter_info(self):
50 info_sd = self.dbg.GetScriptInterpreterInfo(
51 self.dbg.GetScriptingLanguage("python")
53 self.assertTrue(info_sd.IsValid())
54 stream = lldb.SBStream()
55 self.assertSuccess(info_sd.GetAsJSON(stream))
56 info = json.loads(stream.GetData())
57 prefix = info["prefix"]
58 self.assertEqual(os.path.realpath(sys.prefix), os.path.realpath(prefix))
59 self.assertEqual(
60 os.path.realpath(os.path.join(info["lldb-pythonpath"], "lldb")),
61 os.path.realpath(os.path.dirname(lldb.__file__)),
63 self.assertTrue(os.path.exists(info["executable"]))
64 self.assertEqual(info["language"], "python")
66 @no_debug_info_test
67 def test_directory_doesnt_end_with_slash(self):
68 current_directory_spec = lldb.SBFileSpec(os.path.curdir)
69 current_directory_string = current_directory_spec.GetDirectory()
70 self.assertNotEqual(current_directory_string[-1:], "/")
72 @skipUnlessPlatform(["windows"])
73 @no_debug_info_test
74 def test_windows_double_slash(self):
75 """Test to check the path with double slash is handled correctly"""
76 # Create a path and see if lldb gets the directory and file right
77 fspec = lldb.SBFileSpec("C:\\dummy1\\dummy2//unknown_file", True)
78 self.assertEqual(
79 os.path.normpath(fspec.GetDirectory()), os.path.normpath("C:/dummy1/dummy2")
81 self.assertEqual(fspec.GetFilename(), "unknown_file")