def testCoreAfterStart(self): device = FakeDevice() result = testresult.DeviceExecResult(device) self.coreDumps.startTest(result, device) self.failIf(result.cores) core = self._createCore("coredir1", "corefile11") self.coreDumps.stopTest(result, device) self.failUnless(core in result.cores)
def testCoresBeforeAfterStart(self): device = FakeDevice() result = testresult.DeviceExecResult(device) cores = [] self._createCore("coredir1", "corefile11") self._createCore("coredir2", "corefile21") self.coreDumps.startTest(result, device) self.failIf(result.cores) cores.append(self._createCore("coredir1", "corefile12")) cores.append(self._createCore("coredir2", "corefile22")) self.coreDumps.stopTest(result, device) self.failUnlessEqual(len(result.cores), 2) for core in cores: self.failUnless(core in result.cores)
def testCoreAfterStart1OverwriteAfterStart2(self): device = FakeDevice() result1 = testresult.DeviceExecResult(device) result2 = testresult.DeviceExecResult(device) self.coreDumps.startTest(result1, device) self.failIf(result1.cores) core = self._createCore("coredir1", "corefile11") self.coreDumps.startTest(result2, device) self.failUnlessEqual(len(result2.cores), 1) self.failUnless(core in result2.cores) core = self._createCore("coredir1", "corefile11") self.coreDumps.stopTest(result2, device) self.failUnlessEqual(len(result2.cores), 1) self.failUnless(core in result2.cores) self.coreDumps.stopTest(result1, device) self.failUnlessEqual(len(result1.cores), 1) self.failUnless(core in result1.cores) self.failIfEqual(id(result1.cores[0]), id(result2.cores[0]))
def deviceResult(name="Device", date=None, time=None, address=None, port=None, status=testexec.STATUS_NOT_COMPLETED): device = testresult.DeviceExecResult(FakeDevice(name)) device.description = "Description of device: %s" % name device.date = date if date else datetime.datetime.now() if time: device.time = time if address: device.address = address if port: device.port = port device.status = status device.cores = [] return device
def testCoresAfterStart1AfterStart2(self): device = FakeDevice() result1 = testresult.DeviceExecResult(device) result2 = testresult.DeviceExecResult(device) cores1 = [] cores2 = [] self.coreDumps.startTest(result1, device) self.failIf(result1.cores) cores1.append(self._createCore("coredir1", "corefile11")) cores1.append(self._createCore("coredir2", "corefile21")) self.coreDumps.startTest(result2, device) self.failUnlessEqual(len(result2.cores), 2) for core in cores1: self.failUnless(core in result2.cores) cores2.append(self._createCore("coredir1", "corefile12")) cores2.append(self._createCore("coredir2", "corefile22")) self.coreDumps.stopTest(result2, device) self.failUnlessEqual(len(result2.cores), 2) for core in cores2: self.failUnless(core in result2.cores) self.coreDumps.stopTest(result1, device) self.failUnlessEqual(len(result1.cores), 2) for core in cores1: self.failUnless(core in result1.cores)
def testEmptyCoreDirs(self): device = FakeDevice() result = testresult.DeviceExecResult(device) self.coreDumps.startTest(result, device) self.coreDumps.stopTest(result, device) self.failIf(result.cores)