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        exe = self.getBuildArtifact("a.out")
21        target = self.dbg.CreateTarget(exe)
22        self.assertTrue(target and target.IsValid(), "Target is valid")
23
24        breakpoint = target.BreakpointCreateByName("main")
25        self.assertTrue(
26            breakpoint and breakpoint.IsValid(),
27            "Breakpoint is valid")
28
29        # Run the program.
30        process = target.LaunchSimple(
31            None, None, self.get_process_working_directory())
32        self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
33        self.assertEqual(
34            process.GetState(),
35            lldb.eStateStopped,
36            PROCESS_STOPPED)
37
38        # check the setting value
39        self.expect(
40            "settings show target.process.memory-cache-line-size",
41            patterns=[" = 2048"])
42
43        # Run to completion.
44        process.Continue()
45        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
46