01_Exception.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/python
  2. import os, sys, mmap
  3. from regression import Regression
  4. loader = '../src/pal'
  5. regression = Regression(loader, "Exception")
  6. def check_exception1(res):
  7. for line in res[0].log:
  8. if not line:
  9. continue
  10. if line.startswith('Div-by-Zero Exception Handler'):
  11. return True
  12. return False
  13. regression.add_check(name="Exception Handling (Div-by-Zero)", check=check_exception1)
  14. def check_exception2(res):
  15. for line in res[0].log:
  16. if not line:
  17. continue
  18. if line.startswith('Memory Fault Exception Handler'):
  19. return True
  20. return False
  21. regression.add_check(name="Exception Handling (Memory Fault)", check=check_exception2)
  22. def check_exception3(res):
  23. found1 = False
  24. found2 = False
  25. for line in res[0].log:
  26. if not line:
  27. continue
  28. if line.startswith('Div-by-Zero Exception Handler 1'):
  29. found1 = True
  30. if line.startswith('Div-by-Zero Exception Handler 2'):
  31. found2 = True
  32. return found1 and found2
  33. regression.add_check(name="Exception Handler Swap", check=check_exception3)
  34. def check_exception4(res):
  35. found = 0
  36. for line in res[0].log:
  37. if not line:
  38. continue
  39. if line.startswith('Div-by-Zero Exception Handler 1'):
  40. found += 1
  41. return found == 1
  42. regression.add_check(name="Exception Handling (Set Context)", check=check_exception4)
  43. regression.run_checks()