def test_values_are_all_greater_than_zero(self): # Best we can do is test that something is returned mem = MemoryStats() self.assertTrue(hasattr(mem, "update")) self.assertTrue(mem.availMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.totalMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.residentMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.virtualMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.getFreeRatio() > 0.0, "Value should be larger than 0.0") if sys.platform == 'win32': self.assertTrue(mem.reservedMem() > 0.0, "Value should be larger than 0.0") else: self.assertEqual(mem.reservedMem(), 0.0, "Value should 0.0")
def __init__(self): super(MantidStressTest, self).__init__() # A list of things not to check when validating self.disableChecking = [] # Whether or not to strip off whitespace when doing simple ascii diff self.stripWhitespace = True # Tolerance self.tolerance = 0.00000001 # Store the resident memory of the system (in MB) before starting the test FrameworkManager.clear() self.memory = MemoryStats().residentMem()/1024
def __verifyMemory(self): """Do we need to skip due to lack of memory?""" required = self.requiredMemoryMB() if required <= 0: return # Check if memory is available MB_avail = MemoryStats().availMem()/(1024.) if (MB_avail < required): print("Insufficient memory available to run test! %g MB available, need %g MB." % (MB_avail, required)) sys.exit(TestRunner.SKIP_TEST)
def test_values_are_all_greater_than_zero(self): # Best we can do is test that something is returned mem = MemoryStats() self.assertTrue(hasattr(mem, "update")) self.assertTrue(mem.availMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.totalMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.residentMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.virtualMem() > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.getFreeRatio() > 0.0, "Value should be larger than 0.0") if sys.platform == 'win32': self.assertTrue(mem.reservedMem() > 0.0, "Value should be larger than 0.0") else: self.assertTrue(mem.reservedMem() == 0.0, "Value should 0.0")
def test_values_are_all_greater_than_zero(self): # Best we can do is test that something is returned mem = MemoryStats() self.assertTrue(hasattr(mem, "update")) self.assertTrue(mem.availMem > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.totalMem > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.residentMem > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.virtualMem > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.reservedMem > 0.0, "Value should be larger than 0.0") self.assertTrue(mem.getFreeRatio > 0.0, "Value should be larger than 0.0")
def returnValidationCode(self, code): """ Calls doValidation() and returns 0 in success and code if failed. This will be used as return code from the calling python subprocess """ if self.doValidation(): retcode = 0 else: retcode = code if retcode == 0: self._success = True else: self._success = False # Now the validation is complete we can clear out all the stored data and check memory usage FrameworkManager.clear() # Get the resident memory again and work out how much it's gone up by (in MB) memorySwallowed = MemoryStats().residentMem()/1024 - self.memory # Store the result self.reportResult('memory footprint increase', memorySwallowed) return retcode