Skip to content

Commit

Permalink
auto-sync: fix test!
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Jul 20, 2024
1 parent 389590d commit 3b6abc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ def check_patching_result(self, patch, syntax, expected, filename=""):

self.assertGreater(len(captures_bundle), 0)
for cb in captures_bundle:
self.assertEqual(patch.get_patch(cb, syntax, **kwargs), expected)
actual = patch.get_patch(cb, syntax, **kwargs)
self.assertEqual(actual, expected)

def test_addcsdetail(self):
patch = AddCSDetail(0, "ARCH")
syntax = b"int i = x; void printThumbLdrLabelOperand(MCInst *MI, unsigned OpNo, SStream *O) { int i = OpNo; }"
self.check_patching_result(
patch,
syntax,
b"void printThumbLdrLabelOperand(MCInst *MI, unsigned OpNo, SStream *O){ "
b"static inline void printThumbLdrLabelOperand(MCInst *MI, unsigned OpNo, SStream *O){ "
b"add_cs_detail(MI, ARCH_OP_GROUP_ThumbLdrLabelOperand, OpNo); "
b"int i = OpNo; "
b"}",
Expand All @@ -131,8 +132,8 @@ def test_addoperand(self):

def test_assert(self):
patch = Assert(0)
syntax = b"assert(0 == 0)"
self.check_patching_result(patch, syntax, b"")
syntax = b"assert(0 == 0);"
self.check_patching_result(patch, syntax, b"CS_ASSERT(0 == 0);")

def test_bitcaststdarray(self):
patch = BitCastStdArray(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def get_add_cs_detail(
) -> bytes:
op_group_enum = (
self.arch.encode("utf8") + b"_OP_GROUP_" + fcn_id[5:]
).upper() # Remove "print" from function id
) # Remove "print" from function id
if self.arch == "XTENSA":
op_group_enum = op_group_enum.upper()

is_template = fcn_def.prev_sibling.type == "template_parameter_list"
op_num_var_name = (
Expand Down

0 comments on commit 3b6abc2

Please sign in to comment.