@@ -50,11 +50,11 @@ def test_memory_read_with_tags(self):
5050 patterns = [r"(.*\(tag: 0x[0-9a-f]\)\n){4}" ],
5151 )
5252
53- def _parse_pointer_tag (self ):
54- return re .search (r"Logical tag: (0x[0-9a-f])" , self . res . GetOutput () ).group (1 )
53+ def _parse_pointer_tag (self , output ):
54+ return re .search (r"Logical tag: (0x[0-9a-f])" , output ).group (1 )
5555
56- def _parse_memory_tags (self , expected_tag_count ):
57- tags = re .findall (r"\): (0x[0-9a-f])" , self . res . GetOutput () )
56+ def _parse_memory_tags (self , output , expected_tag_count ):
57+ tags = re .findall (r"\): (0x[0-9a-f])" , output )
5858 self .assertEqual (len (tags ), expected_tag_count )
5959 return tags
6060
@@ -77,18 +77,20 @@ def test_memory_tag_read(self):
7777 substrs = ["Logical tag: 0x" , "Allocation tags:" , "(mismatch)" ],
7878 patterns = [r"(\[.*\): 0x[0-9a-f].*\n){4}" ],
7979 )
80- self .assertEqual (self .res .GetOutput ().count ("(mismatch)" ), 2 )
81- ptr_tag = self ._parse_pointer_tag ()
82- tags = self ._parse_memory_tags (4 )
80+ output = self .res .GetOutput ()
81+ self .assertEqual (output .count ("(mismatch)" ), 2 )
82+ ptr_tag = self ._parse_pointer_tag (output )
83+ tags = self ._parse_memory_tags (output , 4 )
8384 self .assertEqual (tags [1 ], ptr_tag )
8485 self .assertEqual (tags [2 ], ptr_tag )
85- self .assertNotEqual (tags [0 ], ptr_tag )
86- self .assertNotEqual (tags [3 ], ptr_tag )
86+ self .assertNotEqual (tags [0 ], ptr_tag ) # Memory that comes before/after
87+ self .assertNotEqual (tags [3 ], ptr_tag ) # allocation has different tag.
8788
8889 # Continue running until MTE fault
89- self .runCmd ("process continue" )
90+ self .expect ("process continue" , substrs = [ "stop reason = EXC_ARM_MTE_TAG_FAULT" ] )
9091
9192 self .runCmd ("memory tag read ptr-1 ptr+33" )
92- self .assertEqual (self .res .GetOutput ().count ("(mismatch)" ), 4 )
93- tags = self ._parse_memory_tags (4 )
93+ output = self .res .GetOutput ()
94+ self .assertEqual (output .count ("(mismatch)" ), 4 )
95+ tags = self ._parse_memory_tags (output , 4 )
9496 self .assertTrue (all (t != ptr_tag for t in tags ))
0 commit comments