def testDisabledCoreDumpsChannel(self): result = TestCaseResult() device = commons.FakeDevice() self.testResult._coreDumps.setEnabled(False) self.testResult.startTest(result, device) core = os.path.join(self._TEST_CORE_DIR, self._TEST_CORE_FILE) commons.createRandomSizeFile(core) self.testResult.stopTest(result, device) execResult = result.device(device) self.failIf(execResult.cores)
def _createCore(self, dirname, name): dirpath = os.path.join(self._TEST_CORE_DIR, dirname) if not os.path.exists(dirpath): os.makedirs(dirpath) dirs = [d for d in self.coreDumps._dirs] dirs.append(dirpath) self.coreDumps._dirs.set(','.join(dirs)) path = os.path.join(dirpath, name + '.' + self._TEST_CORE_EXT) createRandomSizeFile(path) return path
def testEnebledCoreDumpsChannel(self): result = TestCaseResult() device = commons.FakeDevice() self.testResult._coreDumps.setEnabled(True) self.testResult.startTest(result, device) core = os.path.join(self._TEST_CORE_DIR, self._TEST_CORE_FILE) commons.createRandomSizeFile(core) self.testResult.stopTest(result, device) execResult = result.device(device) self.failUnlessEqual(len(execResult.cores), 1) self.failUnless(core in execResult.cores)