00_bootstrap.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python2
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = sys.argv[1]
  5. # Running Bootstrap
  6. regression = Regression(loader, "bootstrap")
  7. regression.add_check(name="Basic Bootstrapping",
  8. check=lambda res: "User Program Started" in res[0].out)
  9. regression.add_check(name="One Argument Given",
  10. check=lambda res: "# of Arguments: 1" in res[0].out and \
  11. "argv[0] = file:bootstrap" in res[0].out)
  12. regression.add_check(name="Five Arguments Given",
  13. args = ['a', 'b', 'c', 'd'],
  14. check=lambda res: "# of Arguments: 5" in res[0].out and \
  15. "argv[0] = file:bootstrap" in res[0].out and \
  16. "argv[1] = a" in res[0].out and "argv[2] = b" in res[0].out and \
  17. "argv[3] = c" in res[0].out and "argv[4] = d" in res[0].out)
  18. rv = regression.run_checks()
  19. if rv: sys.exit(rv)
  20. # Running Exec
  21. regression = Regression(loader, "exec")
  22. regression.add_check(name="2 page child binary",
  23. check=lambda res: "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 " in res[0].out)
  24. rv = regression.run_checks()
  25. if rv: sys.exit(rv)
  26. # Shared Object Test
  27. regression = Regression(loader, "shared_object")
  28. regression.add_check(name="Shared Object",
  29. check=lambda res: "Hello world" in res[0].out)
  30. rv = regression.run_checks()
  31. if rv: sys.exit(rv)
  32. regression = Regression(loader, "exit")
  33. regression.add_check(name="Exit Code Propagation",
  34. check=lambda res: 113 == res[0].code)
  35. rv = regression.run_checks()
  36. if rv: sys.exit(rv)