1"""
2Verify the default cache line size for android targets
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class DefaultCacheLineSizeTestCase(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    @skipUnlessTargetAndroid
18    def test_cache_line_size(self):
19        self.build(dictionary=self.getBuildFlags())
20        target = self.createTestTarget()
21        self.assertTrue(target and target.IsValid(), "Target is valid")
22
23        breakpoint = target.BreakpointCreateByName("main")
24        self.assertTrue(
25            breakpoint and breakpoint.IsValid(),
26            "Breakpoint is valid")
27
28        # Run the program.
29        process = target.LaunchSimple(
30            None, None, self.get_process_working_directory())
31        self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
32        self.assertEqual(
33            process.GetState(),
34            lldb.eStateStopped,
35            PROCESS_STOPPED)
36
37        # check the setting value
38        self.expect(
39            "settings show target.process.memory-cache-line-size",
40            patterns=[" = 2048"])
41
42        # Run to completion.
43        process.Continue()
44        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
45