From 93297fd8dbd7033e13f97f6de6d3674d872a2043 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 26 Jul 2020 10:31:49 +0100 Subject: [PATCH] add common test base class for "accumulating" tests to run --- src/soc/fu/test/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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, -- 2.30.2