xref: /llvm-project/lldb/test/API/qemu/TestQemuAPI.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1331150a4SPavel Labathimport lldb
2331150a4SPavel Labathimport os
3331150a4SPavel Labathfrom lldbsuite.test.lldbtest import *
4331150a4SPavel Labathfrom lldbsuite.test.decorators import *
5331150a4SPavel Labath
6331150a4SPavel Labath
7331150a4SPavel Labath@skipIfRemote
8331150a4SPavel Labathclass TestQemuAPI(TestBase):
9331150a4SPavel Labath    NO_DEBUG_INFO_TESTCASE = True
10331150a4SPavel Labath
11331150a4SPavel Labath    def test_file_api(self):
12331150a4SPavel Labath        qemu = lldb.SBPlatform("qemu-user")
13331150a4SPavel Labath        host = lldb.SBPlatform.GetHostPlatform()
14331150a4SPavel Labath
15331150a4SPavel Labath        target = self.getBuildArtifact("target.c")
16331150a4SPavel Labath        main_c = lldb.SBFileSpec(self.getSourcePath("main.c"))
17331150a4SPavel Labath
18331150a4SPavel Labath        self.assertSuccess(qemu.Put(main_c, lldb.SBFileSpec(target)))
19331150a4SPavel Labath        self.assertTrue(os.path.exists(target))
20*2238dcc3SJonas Devlieghere        self.assertEqual(
21*2238dcc3SJonas Devlieghere            qemu.GetFilePermissions(target), host.GetFilePermissions(target)
22*2238dcc3SJonas Devlieghere        )
23331150a4SPavel Labath
24*2238dcc3SJonas Devlieghere        self.assertSuccess(qemu.MakeDirectory(self.getBuildArtifact("target_dir")))
25331150a4SPavel Labath        self.assertTrue(os.path.isdir(self.getBuildArtifact("target_dir")))
261dc39378SPavel Labath
271dc39378SPavel Labath    def test_process_api(self):
281dc39378SPavel Labath        self.dbg.SetCurrentPlatform("qemu-user")
29*2238dcc3SJonas Devlieghere        self.expect(
30*2238dcc3SJonas Devlieghere            "platform process list",
311dc39378SPavel Labath            substrs=['no processes were found on the "qemu-user" platform'],
32*2238dcc3SJonas Devlieghere            error=True,
33*2238dcc3SJonas Devlieghere        )
34