From: Fish Date: Wed, 8 Jul 2020 00:42:33 +0000 (-0700) Subject: Fix the non-determinism in test_dwarf_expr. (#324) X-Git-Tag: v0.27~19 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1fc159c2c7315c6acff65470399da332ef9db5b;p=pyelftools.git Fix the non-determinism in test_dwarf_expr. (#324) --- diff --git a/test/test_dwarf_expr.py b/test/test_dwarf_expr.py index 42186ba..1e9949e 100644 --- a/test/test_dwarf_expr.py +++ b/test/test_dwarf_expr.py @@ -53,8 +53,11 @@ class TestExprDumper(unittest.TestCase): self.assertEqual(self.visitor.dump_expr([0x1d, 0x1e, 0x1d, 0x1e, 0x1d, 0x1e]), 'DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul; DW_OP_mod; DW_OP_mul') - self.assertEqual(self.visitor.dump_expr([0x08, 0x0f, 0xe0]), - 'DW_OP_const1u: 15; DW_OP_GNU_push_tls_address') + self.assertIn(self.visitor.dump_expr([0x08, 0x0f, 0xe0]), + ('DW_OP_const1u: 15; DW_OP_GNU_push_tls_address', + 'DW_OP_const1u: 15; DW_OP_lo_user', + ) + ) class TestParseExpr(unittest.TestCase): @@ -75,7 +78,11 @@ class TestParseExpr(unittest.TestCase): self.assertEqual(lst, [DWARFExprOp(op=0x90, op_name='DW_OP_regx', args=[16])]) lst = p.parse_expr([0xe0]) - self.assertEqual(lst, [DWARFExprOp(op=0xe0, op_name='DW_OP_GNU_push_tls_address', args=[])]) + self.assertEqual(len(lst), 1) + self.assertIn(lst[0], [ + DWARFExprOp(op=0xe0, op_name='DW_OP_GNU_push_tls_address', args=[]), + DWARFExprOp(op=0xe0, op_name='DW_OP_lo_user', args=[]) + ]) if __name__ == '__main__':