02_Socket.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/python
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = '../src/pal'
  5. regression = Regression(loader, "Socket")
  6. regression.add_check(name="TCP Socket Creation",
  7. check=lambda res: "TCP Creation 1 OK" in res[0].log)
  8. regression.add_check(name="TCP Socket Connection",
  9. check=lambda res: "TCP Connection 1 OK" in res[0].log)
  10. regression.add_check(name="TCP Socket Transmission",
  11. check=lambda res: "TCP Write 1 OK" in res[0].log and
  12. "TCP Read 1: Hello World 1" in res[0].log and
  13. "TCP Write 2 OK" in res[0].log and
  14. "TCP Read 2: Hello World 2" in res[0].log)
  15. regression.add_check(name="UDP Socket Creation",
  16. check=lambda res: "UDP Creation 1 OK" in res[0].log)
  17. regression.add_check(name="UDP Socket Connection",
  18. check=lambda res: "UDP Connection 1 OK" in res[0].log)
  19. regression.add_check(name="UDP Socket Transmission",
  20. check=lambda res: "UDP Write 1 OK" in res[0].log and
  21. "UDP Read 1: Hello World 1" in res[0].log and
  22. "UDP Write 2 OK" in res[0].log and
  23. "UDP Read 2: Hello World 2" in res[0].log)
  24. regression.add_check(name="Bound UDP Socket Transmission",
  25. check=lambda res: "UDP Write 3 OK" in res[0].log and
  26. "UDP Read 3: Hello World 1" in res[0].log and
  27. "UDP Write 4 OK" in res[0].log and
  28. "UDP Read 4: Hello World 2" in res[0].log)
  29. regression.run_checks()