02_Semaphore.py 1.2 KB

12345678910111213141516171819202122232425
  1. #!/usr/bin/python
  2. import os, sys, mmap, random, string
  3. from regression import Regression
  4. loader = os.environ['PAL_LOADER']
  5. # Running Semaphore
  6. regression = Regression(loader, "Semaphore")
  7. regression.add_check(name="Semaphore: Timeout on Locked Semaphores",
  8. check=lambda res: "Locked binary semaphore timed out (1000)." in res[0].log and
  9. "Locked non-binary semaphore timed out (1000)." in res[0].log and
  10. "Two locked semaphores timed out (1000)." in res[0].log and
  11. "Locked binary semaphore timed out (0)." in res[0].log and
  12. "Locked non-binary semaphore timed out (0)." in res[0].log and
  13. "Two locked semaphores timed out (0)." in res[0].log)
  14. regression.add_check(name="Semaphore: Acquire Unlocked Semaphores",
  15. check=lambda res: "Locked binary semaphore successfully (-1)." in res[0].log and
  16. "Locked non-binary semaphore successfully (-1)." in res[0].log and
  17. "Locked binary semaphore successfully (0)." in res[0].log and
  18. "Locked non-binary semaphore successfully (0)." in res[0].log)
  19. regression.run_checks()