fix test_caller_bcd_full.py not actually running correct test cases
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 7 Sep 2021 06:53:26 +0000 (23:53 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 17 Sep 2021 16:54:18 +0000 (17:54 +0100)
src/openpower/decoder/isa/test_caller_bcd_full.py

index 566b0e47d57a57e74fef28cd4b3a67710252b630..8af9e0c1a5673ceccb8668357bfbb94db360a16f 100644 (file)
@@ -7,6 +7,7 @@ from openpower.decoder.selectable_int import SelectableInt
 from openpower.decoder.isa.test_runner import run_tst
 import power_instruction_analyzer as pia
 from hashlib import sha256
+from textwrap import dedent
 
 
 class BCDFullTestCase(FHDLTestCase):
@@ -98,9 +99,11 @@ class BCDFullTestCase(FHDLTestCase):
 
 for i in range(BCDFullTestCase.TEST_INDEX_COUNT):
     for j in 'addg6s', 'cdtbcd', 'cbcdtd':
-        def tst_fn(self):
-            getattr(self, f"tst_{j}")(i)
-        setattr(BCDFullTestCase, f"test_{j}_{i}", tst_fn)
+        exec(dedent(f"""
+            def tst_{j}_{i}(self):
+                self.tst_{j}({i})
+            BCDFullTestCase.test_{j}_{i} = tst_{j}_{i}
+        """))
 
 if __name__ == "__main__":
     unittest.main()