02_Thread.py 852 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/python
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = os.environ['PAL_LOADER']
  5. regression = Regression(loader, "Thread")
  6. regression.add_check(name="Thread Creation",
  7. check=lambda res: "Child Thread Created" in res[0].log and
  8. "Run in Child Thread: Hello World" in res[0].log)
  9. regression.add_check(name="Multiple Threads Run in Parallel",
  10. check=lambda res: "Threads Run in Parallel OK" in res[0].log)
  11. regression.add_check(name="Set Thread Private Segment Register",
  12. check=lambda res: "Private Message (FS Segment) 1: Hello World 1" in res[0].log and
  13. "Private Message (FS Segment) 2: Hello World 2" in res[0].log)
  14. regression.add_check(name="Thread Exit",
  15. check=lambda res: "Child Thread Exited" in res[0].log)
  16. rv = regression.run_checks()
  17. if rv: sys.exit(rv)