diff options
author | Dan Albert <danalbert@google.com> | 2017-05-31 01:29:51 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2017-07-26 10:23:50 -0700 |
commit | c205e1bd1a26d1589ac79bfe690d1550e69c66f5 (patch) | |
tree | 6921c030aea625101f13b51507af2b73d2a89eb8 /build/ndk-build | |
parent | 2408902f29bd301d06cc761e97115ffa6d1cbf14 (diff) | |
download | ndk-c205e1bd1a26d1589ac79bfe690d1550e69c66f5.tar.gz |
Add NDK_ANALYZER_OUT, expand the test.
Allow analyzer output to be sent somewhere other than /tmp with
NDK_ANALYZER_OUT. Now that we can predict the output, improve the
test (since it clearly wasn't catching anything).
Also, remove the test config saying the test was clang specific. It
actually works with both Clang and GCC.
Test: ./run_tests.py --filter NDK_ANALYZE
Bug: https://github.com/android-ndk/ndk/issues/362
Change-Id: I7226e6fba1190573280e8b0c21b8550fb5636005
Diffstat (limited to 'build/ndk-build')
-rwxr-xr-x | build/ndk-build | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/build/ndk-build b/build/ndk-build index 84d423e72..312912d75 100755 --- a/build/ndk-build +++ b/build/ndk-build @@ -61,6 +61,7 @@ fi PROJECT_PATH= PROJECT_PATH_NEXT= +NDK_ANALYZER_OUT= for opt; do if [ -z "$PROJECT_PATH" -a "$PROJECT_PATH_NEXT" = "yes" ] ; then PROJECT_PATH=$opt @@ -79,6 +80,9 @@ for opt; do NDK_ANALYZE=*) NDK_ANALYZE=0 ;; + NDK_ANALYZER_OUT=*) + NDK_ANALYZER_OUT=${opt#NDK_ANALYZER_OUT=} + ;; NDK_TOOLCHAIN_VERSION=*) NDK_TOOLCHAIN_VERSION=${opt#NDK_TOOLCHAIN_VERSION=} ;; @@ -264,6 +268,7 @@ if [ "$NDK_ANALYZE" = 1 ]; then for ABI in $APP_ABIS; do TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $ABI` LLVM_PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$HOST_TAG + ANALYZER_OUT=`get_build_var NDK_APP_ANALYZER_OUT` if [ "$TOOLCHAIN" = "clang" ]; then ANALYZER_CC=$LLVM_PATH/bin/clang @@ -273,11 +278,17 @@ if [ "$NDK_ANALYZE" = 1 ]; then ANALYZER_CXX=${TOOLCHAIN_PREFIX}g++ fi + ANALYZER_OUT_FLAG= + if [ -n "$NDK_ANALYZER_OUT" ]; then + ANALYZER_OUT_FLAG="-o $NDK_ANALYZER_OUT/$ABI" + fi + perl $LLVM_PATH/tools/scan-build/bin/scan-build \ --use-analyzer $LLVM_PATH/bin/${ABI}/analyzer \ --use-cc $ANALYZER_CC \ --use-c++ $ANALYZER_CXX \ --status-bugs \ + $ANALYZER_OUT_FLAG \ $GNUMAKE -f $PROGDIR/core/build-local.mk "$@" APP_ABI=$ABI done else |