xref: /llvm-project/lldb/test/API/commands/trace/TestTraceSchema.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
174c93956SWalter Erquinigoimport lldb
2bf9f21a2SWalter Erquinigofrom intelpt_testcase import *
374c93956SWalter Erquinigofrom lldbsuite.test.lldbtest import *
474c93956SWalter Erquinigofrom lldbsuite.test import lldbutil
574c93956SWalter Erquinigofrom lldbsuite.test.decorators import *
674c93956SWalter Erquinigo
774c93956SWalter Erquinigo
8*2238dcc3SJonas Devlieghereclass TestTraceLoad(TraceIntelPTTestCaseBase):
974c93956SWalter Erquinigo    def testSchema(self):
106a5355e8SWalter Erquinigo        self.expect("trace schema intel-pt", substrs=["triple", "threads", "iptTrace"])
1174c93956SWalter Erquinigo
1274c93956SWalter Erquinigo    def testInvalidPluginSchema(self):
13*2238dcc3SJonas Devlieghere        self.expect(
14*2238dcc3SJonas Devlieghere            "trace schema invalid-plugin",
15*2238dcc3SJonas Devlieghere            error=True,
16*2238dcc3SJonas Devlieghere            substrs=[
17*2238dcc3SJonas Devlieghere                'error: no trace plug-in matches the specified type: "invalid-plugin"'
18*2238dcc3SJonas Devlieghere            ],
19*2238dcc3SJonas Devlieghere        )
20ea1f4974SWalter Erquinigo
21ea1f4974SWalter Erquinigo    def testAllSchemas(self):
22*2238dcc3SJonas Devlieghere        self.expect(
23*2238dcc3SJonas Devlieghere            "trace schema all",
24*2238dcc3SJonas Devlieghere            substrs=[
25*2238dcc3SJonas Devlieghere                """{
26ea1f4974SWalter Erquinigo  "type": "intel-pt",
270b697561SWalter Erquinigo  "cpuInfo": {
28fc5ef57cSWalter Erquinigo    // CPU information gotten from, for example, /proc/cpuinfo.
29fc5ef57cSWalter Erquinigo
30fc5ef57cSWalter Erquinigo    "vendor": "GenuineIntel" | "unknown",
31ea1f4974SWalter Erquinigo    "family": integer,
32ea1f4974SWalter Erquinigo    "model": integer,
33ea1f4974SWalter Erquinigo    "stepping": integer
34*2238dcc3SJonas Devlieghere  },"""
35*2238dcc3SJonas Devlieghere            ],
36*2238dcc3SJonas Devlieghere        )
37