02_Misc.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python2
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = os.environ['PAL_LOADER']
  5. regression = Regression(loader, "Misc", timeout=5000)
  6. regression.add_check(name="Query System Time",
  7. check=lambda res: "Query System Time OK" in res[0].log)
  8. regression.add_check(name="Delay Execution for 10000 Microseconds",
  9. check=lambda res: "Delay Execution for 10000 Microseconds OK" in res[0].log)
  10. regression.add_check(name="Delay Execution for 3 Seconds",
  11. check=lambda res: "Delay Execution for 3 Seconds OK" in res[0].log)
  12. regression.add_check(name="Generate Random Bits",
  13. check=lambda res: "Generate Random Bits OK" in res[0].log)
  14. rv = regression.run_checks()
  15. if rv: sys.exit(rv)
  16. regression = Regression(loader, "Hex")
  17. regression.add_check(name="Hex 2 String Helper Function",
  18. check=lambda res: "Hex test 1 is deadbeef" in res[0].log and \
  19. "Hex test 2 is cdcdcdcdcdcdcdcd" in res[0].log)
  20. rv = regression.run_checks()
  21. if rv: sys.exit(rv)
  22. regression = Regression(loader, "Exit")
  23. regression.add_check(name="Exit Code Propagation",
  24. check=lambda res: 112 == res[0].code)
  25. rv = regression.run_checks()
  26. if rv: sys.exit(rv)