san 931 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env bash
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # san — enables an LLVM sanitizer for any wrapped cargo(1) commands.
  12. #
  13. # Example usages:
  14. #
  15. # $ bin/san address cargo run --bin sqllogictest
  16. #
  17. # $ bin/san address ci/test/slt-fast.sh
  18. #
  19. # Requires x64 and a nightly toolchain.
  20. set -euo pipefail
  21. cd "$(dirname "$0")/.."
  22. . misc/shlib/shlib.bash
  23. if [[ $# -lt 2 ]]; then
  24. die "usage: $0 <address|memory|thread|...> <command> [<arg>...]"
  25. fi
  26. MZ_DEV_SANITIZER=$1; shift
  27. CARGO=$(command -v cargo)
  28. PATH=$(pwd)/misc/sanshim:$PATH
  29. export MZ_DEV_SANITIZER CARGO PATH
  30. exec "$@"