testUndefinedBehaviorSanitizer.cmake 691 B

123456789101112131415161718192021
  1. # this file simulates a program that has been built with
  2. # UndefinedBehaviorSanitizer options
  3. message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]")
  4. string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}")
  5. message("LOG_FILE=[${LOG_FILE}]")
  6. # if we are not asked to simulate address sanitizer don't do it
  7. if(NOT "$ENV{UBSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1")
  8. return()
  9. endif()
  10. # clear the log file
  11. file(REMOVE "${LOG_FILE}.2343")
  12. # create an error like undefined behavior santizer creates;
  13. # these names come from ubsan_diag.cc and ubsan_handlers.cc
  14. # in llvm
  15. file(APPEND "${LOG_FILE}.2343"
  16. "<unknown>: runtime error: left shift of negative value -256
  17. ")