suppressions.py 962 B

123456789101112131415161718192021222324
  1. def onsuppressions(unit, *args):
  2. """
  3. SUPPRESSIONS() - allows to specify files with suppression notation which will be used by
  4. address, leak or thread sanitizer runtime by default.
  5. Use asan.supp filename for address sanitizer, lsan.supp for leak sanitizer
  6. and tsan.supp for thread sanitizer suppressions respectively.
  7. See https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-memory-leaks
  8. for details.
  9. """
  10. import os
  11. valid = ("asan.supp", "tsan.supp", "lsan.supp")
  12. if unit.get("SANITIZER_TYPE") in ("leak", "address", "thread"):
  13. for x in args:
  14. if os.path.basename(x) not in valid:
  15. unit.message(
  16. [
  17. 'error',
  18. "Invalid suppression filename: {} (any of the following is expected: {})".format(x, valid),
  19. ]
  20. )
  21. return
  22. unit.onsrcs(["GLOBAL"] + list(args))