check_ci_log.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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(1)
  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(1)
  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(1)
  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(1)
  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(1)
  38. sys.exit(0)