gccsnapshot_sanitize_tests.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. export CC=gcc
  3. export CXX=g++
  4. if [ "$NEWCC" != "" ]; then
  5. export CC="$NEWCC"
  6. fi
  7. if [ "$NEWCXX" != "" ]; then
  8. export CXX="$NEWCXX"
  9. fi
  10. if [ "$FLAGS" == "" ]; then
  11. export FLAGS="gccsnapshot.sh"
  12. fi
  13. export LOGFILE=gcc-snapshot.log
  14. export PATH=/usr/lib/gcc-snapshot/bin:$PATH
  15. source ./tools/ci/scripts/init.sh
  16. export CXXFLAGS="$CXXFLAGS -pedantic -ggdb3 -O2 -Wstrict-aliasing=2 \
  17. -D_GLIBCXX_SANITIZE_VECTOR \
  18. -fno-omit-frame-pointer \
  19. -Wstrict-overflow=1 -Wformat=1 -D_FORTIFY_SOURCE=2 \
  20. -fsanitize=address -fsanitize=undefined \
  21. -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable \
  22. -fsanitize=vla-bound -fsanitize=null -fsanitize=return \
  23. -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment \
  24. -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow \
  25. -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool \
  26. -fsanitize=enum -fsanitize=vptr -fsanitize=bounds-strict \
  27. -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak \
  28. -fsanitize=shift-exponent -fsanitize=shift-base -fsanitize=bounds-strict \
  29. -fsanitize=pointer-overflow -fsanitize=builtin \
  30. -fsanitize-address-use-after-scope \
  31. -std=gnu++1z -Wformat=1 \
  32. -Wno-attributes \
  33. -Wno-deprecated-copy"
  34. export LDFLAGS="$LDFLAGS -lm -ldl"
  35. #source ./tools/ci/flags/${FLAGS}
  36. export CXXFLAGS="$CXXFLAGS $POST_CXXFLAGS"
  37. do_init
  38. run_configure --enable-unittests=yes $*
  39. export SDL_VIDEODRIVER=dummy
  40. export ASAN_OPTIONS=detect_leaks=0:detect_stack_use_after_return=true:strict_init_order=true
  41. export LSAN_OPTIONS=suppressions=$(pwd)/tools/ci/scripts/lsansuppression_tests.txt
  42. run_make_check
  43. source ./tools/ci/scripts/exit.sh
  44. exit 0