30_mmap.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python2
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = sys.argv[1]
  5. try:
  6. sgx = os.environ['SGX_RUN']
  7. except KeyError:
  8. sgx = False
  9. # Running Bootstrap
  10. regression = Regression(loader, "mmap-file", None, 60000)
  11. regression.add_check(name="Private mmap beyond file range",
  12. check=lambda res: "mmap test 6 passed" in res[0].out and \
  13. "mmap test 7 passed" in res[0].out)
  14. regression.add_check(name="Private mmap beyond file range (after fork)",
  15. check=lambda res: "mmap test 1 passed" in res[0].out and \
  16. "mmap test 2 passed" in res[0].out and \
  17. "mmap test 3 passed" in res[0].out and \
  18. "mmap test 4 passed" in res[0].out)
  19. # On SGX, SIGBUS isn't always implemented correctly, for lack
  20. # of memory protection. For now, some of these cases won't work.
  21. if not sgx:
  22. regression.add_check(name="SIGBUS test",
  23. check=lambda res: "mmap test 5 passed" in res[0].out and \
  24. "mmap test 8 passed" in res[0].out)
  25. regression.run_checks()