[Libre-soc-bugs] [Bug 730] adapt ALU test cases to include expected results

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Oct 26 04:47:00 BST 2021


Jacob Lifshay <programmerjake at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |programmerjake at gmail.com

--- Comment #17 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to klehman9 from comment #15)
> https://git.libre-soc.org/?p=openpower-isa.git;a=commit;
> h=1b2f031b2a2cc3b6473f4965345f21547164c5c3
> https://git.libre-soc.org/?p=openpower-isa.git;a=commit;
> h=0e32ffeccef54c27f8d7300260fd75eecb4dde2e
> Sub directories now created based on the test cases filename.

You can use get_test_path from nmutil, it handles creating a unique path each
time it's called that is derived from the test case's name as well as the
current test method's name:


example code (in src/demo.py):

class MyTest(unittest.TestCase):
    def test_fn(self):
        # code below should be put in common function:
        path = get_test_path(test_case, "test_outputs")
        # path is a pathlib.Path instance
        path.mkdir(parents=True, exist_ok=True)
        file_path = path / "file.py"
        with open(file_path, "wt") as file:
            pass # write to file

that creates a file:

where the 0 is automatically incremented if you call get_test_path more than
once in the same unit test function.

/test_outputs should be added to .gitignore

I did a very similar thing in:

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list