Esempio n. 1
0
    def test_writeread(self):
        config = self._getConfig()
        testutils.prepareFs(config)

        # get some example corpus
        corpusData = self._getCorpusData(config)

        # assume this corpus crashed the server
        crashData = CrashData(config, corpusData)
        crashData.setCrashInformation(asanOutput="meh")

        # write it
        crashData.writeToFile()

        # try to read it again
        crashData2 = CrashData(config, filename=crashData.filename)
        crashData2.readFromFile()

        # test an example of each layer
        self.assertEqual(
            crashData.asanOutput,
            crashData2.asanOutput)
        self.assertEqual(
            crashData.corpusData.filename,
            crashData2.corpusData.filename)
        self.assertEqual(
            crashData.corpusData.networkData.messages[0]['data'],
            crashData2.corpusData.networkData.messages[0]['data'],
        )
Esempio n. 2
0
 def _getCrashData(self, config):
     corpusData = self._getCorpusData(config)
     crashData = CrashData(config, corpusData, '-')
     crashData.setCrashInformation(asanOutput="meh")
     return crashData