02_Semaphore.py 713 B

1234567891011121314151617181920
  1. #!/usr/bin/env python2
  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 binary semaphore timed out (0)." in res[0].log)
  10. regression.add_check(name="Semaphore: Acquire Unlocked Semaphores",
  11. check=lambda res: "Locked binary semaphore successfully (-1)." in res[0].log and
  12. "Locked binary semaphore successfully (0)." in res[0].log)
  13. rv = regression.run_checks()
  14. if rv: sys.exit(rv)