check_ci_log.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import sys
  4. if len(sys.argv) < 2:
  5. print("ERROR: You must run program with file name as argument.")
  6. sys.exit(50)
  7. fname = sys.argv[1]
  8. with open(fname.strip(), "r", encoding="utf-8") as fileread:
  9. file_contents = fileread.read()
  10. # If find "ERROR: AddressSanitizer:", then happens invalid read or write
  11. # This is critical bug, so we need to fix this as fast as possible
  12. if file_contents.find("ERROR: AddressSanitizer:") != -1:
  13. print("FATAL ERROR: An incorrectly used memory was found.")
  14. sys.exit(51)
  15. # There is also possible, that program crashed with or without backtrace.
  16. if (
  17. file_contents.find("Program crashed with signal") != -1
  18. or file_contents.find("Dumping the backtrace") != -1
  19. or file_contents.find("Segmentation fault (core dumped)") != -1
  20. or file_contents.find("Aborted (core dumped)") != -1
  21. or file_contents.find("terminate called without an active exception") != -1
  22. ):
  23. print("FATAL ERROR: Godot has been crashed.")
  24. sys.exit(52)
  25. # Finding memory leaks in Godot is quite difficult, because we need to take into
  26. # account leaks also in external libraries. They are usually provided without
  27. # debugging symbols, so the leak report from it usually has only 2/3 lines,
  28. # so searching for 5 element - "#4 0x" - should correctly detect the vast
  29. # majority of memory leaks
  30. if file_contents.find("ERROR: LeakSanitizer:") != -1:
  31. if file_contents.find("#4 0x") != -1:
  32. print("ERROR: Memory leak was found")
  33. sys.exit(53)
  34. # It may happen that Godot detects leaking nodes/resources and removes them, so
  35. # this possibility should also be handled as a potential error, even if
  36. # LeakSanitizer doesn't report anything
  37. if file_contents.find("ObjectDB instances leaked at exit") != -1:
  38. print("ERROR: Memory leak was found")
  39. sys.exit(54)
  40. # In test project may be put several assert functions which will control if
  41. # project is executed with right parameters etc. which normally will not stop
  42. # execution of project
  43. if file_contents.find("Assertion failed") != -1:
  44. print("ERROR: Assertion failed in project, check execution log for more info")
  45. sys.exit(55)
  46. # For now Godot leaks a lot of rendering stuff so for now we just show info
  47. # about it and this needs to be re-enabled after fixing this memory leaks.
  48. if file_contents.find("were leaked") != -1 or file_contents.find("were never freed") != -1:
  49. print("WARNING: Memory leak was found")
  50. sys.exit(0)