def test_give_me_a_reason(self): with FakeResultDir() as d: job = scrape.Job(d.path, 1) assert type(scrape.give_me_a_reason(job)) == scrape.AssertionReason #Test the lockdep ordering with FakeResultDir(assertion=\ "FAILED assert common/lockdep reason\n") as d: job = scrape.Job(d.path, 1) assert type(scrape.give_me_a_reason(job)) == scrape.LockdepReason
def test_lockdepreason(self): lkReason = None with FakeResultDir(assertion=\ "FAILED assert common/lockdep reason\n") as d: job = scrape.Job(d.path, 1) assert scrape.LockdepReason.could_be(job) lkReason = scrape.LockdepReason(job) #Backtraces of same jobs must match 100% assert lkReason.match(job) with FakeResultDir(blank_backtrace=True) as d: #Corresponding to 0% match assert not lkReason.match(scrape.Job(d.path, 2))
def test_job(self): with FakeResultDir() as d: job = scrape.Job(d.path, 1) assert job.get_success() == "false" assert job.get_assertion() == "FAILED assert 1 == 2" assert job.get_last_tlog_line() ==\ b"NOTE: a copy of the executable dummy text" assert job.get_failure_reason() == "Dummy reason"
def test_genericreason(self): d1 = FakeResultDir(blank_backtrace=True) d2 = FakeResultDir(failure_reason="Dummy dummy") d3 = FakeResultDir() job1 = scrape.Job(d1.path, 1) job2 = scrape.Job(d2.path, 2) job3 = scrape.Job(d3.path, 3) reason = scrape.GenericReason(job3) assert reason.match(job2) assert not reason.match(job1) shutil.rmtree(d1.path) shutil.rmtree(d2.path) shutil.rmtree(d3.path)
def test_valgrindreason(self): vreason = None with FakeResultDir( failure_reason="saw valgrind issues", assertion= "2014-08-22T20:07:18.668 ERROR:tasks.ceph:saw valgrind issue <kind>Leak_DefinitelyLost</kind> in /var/log/ceph/valgrind/osd.3.log.gz\n" ) as d: job = scrape.Job(d.path, 1) assert scrape.ValgrindReason.could_be(job) vreason = scrape.ValgrindReason(job) assert vreason.match(job)
def test_assertionreason(self): with FakeResultDir() as d: job = scrape.Job(d.path, 1) assert scrape.AssertionReason.could_be(job)
def test_deadreason(self): with FakeResultDir() as d: job = scrape.Job(d.path, 1) #Summary is present #So this cannot be a DeadReason assert not scrape.DeadReason.could_be(job)
def test_timeoutreason(self): with FakeResultDir(failure_reason=\ "status 124: timeout '123 /home/ubuntu/cephtest/workunit.client.0/cephtool/test.sh'") as d: job = scrape.Job(d.path, 1) assert scrape.TimeoutReason.could_be(job) assert scrape.TimeoutReason(job).match(job)