| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Test that we pass ASAN.  Spec tests and benchmarks should do this too.
 | 
| 4 | #
 | 
| 5 | # Usage:
 | 
| 6 | #   test/asan.sh <function name>
 | 
| 7 | 
 | 
| 8 | set -o nounset
 | 
| 9 | set -o pipefail
 | 
| 10 | set -o errexit
 | 
| 11 | 
 | 
| 12 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
 | 
| 13 | 
 | 
| 14 | # Check that we don't have any leaks!
 | 
| 15 | soil-run() {
 | 
| 16 |   ninja _bin/cxx-asan/osh
 | 
| 17 | 
 | 
| 18 |   OILS_GC_ON_EXIT=1 _bin/cxx-asan/osh --version
 | 
| 19 | 
 | 
| 20 |   OILS_GC_ON_EXIT=1 _bin/cxx-asan/osh -c 'echo hi'
 | 
| 21 | }
 | 
| 22 | 
 | 
| 23 | cpython-smoke() {
 | 
| 24 |   ### Similar to what benchmarks do
 | 
| 25 | 
 | 
| 26 |   local bin=_bin/cxx-asan/osh
 | 
| 27 |   local dir=_tmp/cpython-smoke
 | 
| 28 | 
 | 
| 29 |   ninja $bin
 | 
| 30 | 
 | 
| 31 |   mkdir -p $dir
 | 
| 32 | 
 | 
| 33 |   pushd $dir
 | 
| 34 | 
 | 
| 35 |   # Run CPython configure with ASAN
 | 
| 36 |   $REPO_ROOT/$bin $REPO_ROOT/Python-2.7.13/configure
 | 
| 37 | 
 | 
| 38 |   popd
 | 
| 39 | }
 | 
| 40 | 
 | 
| 41 | "$@"
 |