From: klehman Date: Mon, 25 Oct 2021 20:19:16 +0000 (-0400) Subject: tests now dump into caller dirs X-Git-Tag: sv_maxu_works-initial~773 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e32ffeccef54c27f8d7300260fd75eecb4dde2e;p=openpower-isa.git tests now dump into caller dirs --- diff --git a/src/openpower/test/runner.py b/src/openpower/test/runner.py index 9215f0f5..ff4ab26b 100644 --- a/src/openpower/test/runner.py +++ b/src/openpower/test/runner.py @@ -259,7 +259,8 @@ class TestRunnerBase(FHDLTestCase): # setting expected state to last_sim if test.expected is None: e = ExpectedState() - e.dump_state_tofile(last_sim, test.name) + e.dump_state_tofile(last_sim, test.name, + test.test_file) # compare against expected results if test.expected is not None: diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index 2b00fbd1..d932ed38 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -216,14 +216,18 @@ class ExpectedState(State): def get_mem(self): if False: yield - def dump_state_tofile(self, state, testname): + def dump_state_tofile(self, state, testname, testfile): """dump_state_tofile: Takes a passed in teststate object along - with a test name and generates a code file located at /tmp/testname - to set an expected state object + with a test name and generates a code file located at + /tmp/testfile/testname to set an expected state object """ lindent = ' '*8 # indent for code - path = "/tmp/expected/" # temp for now + # create the path + path = "/tmp/expected/" + if testfile is not None: + path += testfile + '/' os.makedirs(path, exist_ok=True) + with open("%s%s.py" % (path, testname), "w") as sout: # pc and intregs sout.write("%se = ExpectedState(pc=%d)\n" % (lindent, state.pc))