check_ci_log.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. fileread = open(fname.strip(), "r")
  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. ):
  21. print("FATAL ERROR: Godot has been crashed.")
  22. sys.exit(52)
  23. # Finding memory leaks in Godot is quite difficult, because we need to take into
  24. # account leaks also in external libraries. They are usually provided without
  25. # debugging symbols, so the leak report from it usually has only 2/3 lines,
  26. # so searching for 5 element - "#4 0x" - should correctly detect the vast
  27. # majority of memory leaks
  28. if file_contents.find("ERROR: LeakSanitizer:") != -1:
  29. if file_contents.find("#4 0x") != -1:
  30. print("ERROR: Memory leak was found")
  31. sys.exit(53)
  32. # It may happen that Godot detects leaking nodes/resources and removes them, so
  33. # this possibility should also be handled as a potential error, even if
  34. # LeakSanitizer doesn't report anything
  35. if file_contents.find("ObjectDB instances leaked at exit") != -1:
  36. print("ERROR: Memory leak was found")
  37. sys.exit(54)
  38. # In test project may be put several assert functions which will control if
  39. # project is executed with right parameters etc. which normally will not stop
  40. # execution of project
  41. if file_contents.find("Assertion failed") != -1:
  42. print("ERROR: Assertion failed in project, check execution log for more info")
  43. sys.exit(55)
  44. # For now Godot leaks a lot of rendering stuff so for now we just show info
  45. # about it and this needs to be re-enabled after fixing this memory leaks.
  46. if file_contents.find("were leaked") != -1 or file_contents.find("were never freed") != -1:
  47. print("WARNING: Memory leak was found")
  48. sys.exit(0)