02_Memory.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/python
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = '../src/pal'
  5. regression = Regression(loader, "Memory")
  6. regression.add_check(name="Memory Allocation",
  7. check=lambda res: "Memory Allocation OK" in res[0].log)
  8. regression.add_check(name="Memory Allocation with Address",
  9. check=lambda res: "Memory Allocation with Address OK" in res[0].log)
  10. regression.add_check(name="Memory Protection",
  11. check=lambda res: "Memory Allocation Protection (RW) OK" in res[0].log and
  12. "Memory Protection (R) OK" in res[0].log)
  13. regression.add_check(name="Memory Deallocation",
  14. check=lambda res: "Memory Deallocation OK" in res[0].log)
  15. def check_quota(res):
  16. for line in res[0].log:
  17. if line.startswith("Total Memory:"):
  18. return line != "Total Memory: 0"
  19. return False
  20. regression.add_check(name="Get Memory Total Quota", check=check_quota)
  21. regression.add_check(name="Get Memory Available Quota",
  22. check=lambda res: "Get Memory Available Quota OK" in res[0].log)
  23. regression.run_checks()