def dump(self, replay_log=None): """ Dumps the tests contents, on failure """ self._logger.printf("Dumping recording info for " + str(self)) self._logger.printf("All info dumped to ./test_dump") if (not os.path.isdir("./test_dump")): os.mkdir("./test_dump") outdir = ''.join(["./test_dump/", str(self)]) # If the output is already there delete it (eases testing) if (os.path.exists(outdir)): omniplay.run_shell(''.join(["rm -rf ", outdir])) os.mkdir(outdir) with open(''.join([outdir, "/fail.log"]), "w") as f: f.write(self._logger.get_logstr()) with open(''.join([outdir, "/record.dmesg"]), "w") as f: f.write(self._record_log) if replay_log is not None: with open(''.join([outdir, "/replay.dmesg"]), "w") as f: f.write(replay_log) self._mod.dump(self._state, outdir)
def parse(state): """ Does any static checking on the logs/recordings or system state """ env = state.env tmpdir = tempfile.mkdtemp() children = env.parsegroup(state.ckpt.group_id, tmpdir) env.filemap(state.tmpfilename) omniplay.run_shell("rm -rf " + tmpdir) return len(children)
def _read_dmesg(self): """ Reads the dmesg buffer into self """ with self._dmesg_lock: proc = omniplay.run_shell("sudo dmesg --read-clear", outp=omniplay.PIPE) out = proc.communicate() self._dmesg = ''.join([self._dmesg, out[0]]) return out[0]
def _clear_dmesg(self): """ Clears the dmesg buffer """ omniplay.run_shell("sudo dmesg --clear") self._dmesg = ""