| Index: tools/clang/plugins/tests/test.sh
|
| diff --git a/tools/clang/plugins/tests/test.sh b/tools/clang/plugins/tests/test.sh
|
| index cbb32e77359fb011ffbdbe979da1e330212a3a3d..7946325c539dd36ea9c8c9b35a9cbbaae8c0af48 100755
|
| --- a/tools/clang/plugins/tests/test.sh
|
| +++ b/tools/clang/plugins/tests/test.sh
|
| @@ -15,7 +15,8 @@ failed_any_test=
|
| # Prints usage information.
|
| usage() {
|
| echo "Usage: $(basename "${0}")" \
|
| - "<Path to the llvm build dir, usually Release+Asserts>"
|
| + "<path to clang>" \
|
| + "<path to plugin>"
|
| echo ""
|
| echo " Runs all the libFindBadConstructs unit tests"
|
| echo ""
|
| @@ -32,8 +33,8 @@ do_testcase() {
|
| flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++"
|
| fi
|
|
|
| - local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
|
| - -Xclang -load -Xclang "${CLANG_DIR}"/lib/libFindBadConstructs.${LIB} \
|
| + local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \
|
| + -Xclang -load -Xclang "${PLUGIN_PATH}" \
|
| -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)"
|
| local diffout="$(echo "${output}" | diff - "${2}")"
|
| if [ "${diffout}" = "" ]; then
|
| @@ -53,23 +54,26 @@ do_testcase() {
|
| if [[ -z "${1}" ]]; then
|
| usage
|
| exit ${E_BADARGS}
|
| -elif [[ ! -d "${1}" ]]; then
|
| - echo "${1} is not a directory."
|
| +elif [[ -z "${2}" ]]; then
|
| + usage
|
| + exit ${E_BADARGS}
|
| +elif [[ ! -x "${1}" ]]; then
|
| + echo "${1} is not an executable"
|
| + usage
|
| + exit ${E_BADARGS}
|
| +elif [[ ! -f "${2}" ]]; then
|
| + echo "${2} could not be found"
|
| usage
|
| exit ${E_BADARGS}
|
| else
|
| - export CLANG_DIR="${PWD}/${1}"
|
| - echo "Using clang directory ${CLANG_DIR}..."
|
| + export CLANG_PATH="${1}"
|
| + export PLUGIN_PATH="${2}"
|
| + echo "Using clang ${CLANG_PATH}..."
|
| + echo "Using plugin ${PLUGIN_PATH}..."
|
|
|
| # The golden files assume that the cwd is this directory. To make the script
|
| # work no matter what the cwd is, explicitly cd to there.
|
| cd "$(dirname "${0}")"
|
| -
|
| - if [ "$(uname -s)" = "Linux" ]; then
|
| - export LIB=so
|
| - elif [ "$(uname -s)" = "Darwin" ]; then
|
| - export LIB=dylib
|
| - fi
|
| fi
|
|
|
| for input in *.cpp; do
|
|
|