00_bootstrap.py 2.8 KB

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