check_ci_log.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. 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(1)
  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(1)
  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(1)
  40. sys.exit(0)