02_Semaphore.py 689 B

123456789101112131415161718
  1. import os, sys, mmap, random, string
  2. from regression import Regression
  3. loader = os.environ['PAL_LOADER']
  4. # Running Semaphore
  5. regression = Regression(loader, "Semaphore")
  6. regression.add_check(name="Semaphore: Timeout on Locked Semaphores",
  7. check=lambda res: "Locked binary semaphore timed out (1000)." in res[0].log and
  8. "Locked binary semaphore timed out (0)." in res[0].log)
  9. regression.add_check(name="Semaphore: Acquire Unlocked Semaphores",
  10. check=lambda res: "Locked binary semaphore successfully (-1)." in res[0].log and
  11. "Locked binary semaphore successfully (0)." in res[0].log)
  12. rv = regression.run_checks()
  13. if rv: sys.exit(rv)