From: Luke Kenneth Casson Leighton Date: Sun, 26 Jul 2020 09:31:49 +0000 (+0100) Subject: add common test base class for "accumulating" tests to run X-Git-Tag: semi_working_ecp5~539 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93297fd8dbd7033e13f97f6de6d3674d872a2043;p=soc.git add common test base class for "accumulating" tests to run --- diff --git a/src/soc/fu/test/common.py b/src/soc/fu/test/common.py index ce4f21fe..c7f87dd9 100644 --- a/src/soc/fu/test/common.py +++ b/src/soc/fu/test/common.py @@ -7,6 +7,17 @@ from soc.decoder.power_enums import XER_bits, CryIn, spr_dict from soc.regfile.util import fast_reg_to_spr # HACK! from soc.regfile.regfiles import FastRegs +class TestAccumulatorBase: + + def __init__(self): + self.test_data = [] + # automatically identifies anything starting with "case_" and + # runs it. very similar to unittest auto-identification except + # we need a different system + for n, v in self.__class__.__dict__.items(): + if n.startswith("case_") and callable(v): + v(self) + class TestCase: def __init__(self, program, name, regs=None, sprs=None, cr=0, mem=None,