diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-09 02:20:11 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-09 02:20:11 +0000 |
commit | 89c89b763413e868fcd98e823c3df5d28bca87ac (patch) | |
tree | 0fcf22b86d07595db0d885c0ea96f4c122490b52 /tools/clang/plugins | |
parent | 5c20eb6ec073b378887a799047113ba4b2a549fd (diff) | |
download | chromium_src-89c89b763413e868fcd98e823c3df5d28bca87ac.zip chromium_src-89c89b763413e868fcd98e823c3df5d28bca87ac.tar.gz chromium_src-89c89b763413e868fcd98e823c3df5d28bca87ac.tar.bz2 |
clang: Cleanup style/security issues in the test.sh script.
- Function names:
Lower-case, with underscores to separate words. Parentheses are required after
the function name. The keyword function is disallowed.
- Use "$(...)" for commands.
- Test:
[ ... ] is preferred over [[, test and /usr/bin/[.
[[ ... ]] is not available in POSIX shell or dash. For testing string equality use =, as == is not in POSIX.
BUG=None
TEST=./test.sh ../../../../third_party/llvm-build/Release+Asserts/
Review URL: http://codereview.chromium.org/6628082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang/plugins')
-rwxr-xr-x | tools/clang/plugins/tests/test.sh | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/clang/plugins/tests/test.sh b/tools/clang/plugins/tests/test.sh index 03c583d..ef0070f 100755 --- a/tools/clang/plugins/tests/test.sh +++ b/tools/clang/plugins/tests/test.sh @@ -10,20 +10,21 @@ E_BADARGS=65 # Prints usage information. -function usage() { - echo "Usage: `basename $0` <Path to the llvm build dir, usually Release+Asserts>" +usage() { + echo "Usage: $(basename "${0}")" \ + "<Path to the llvm build dir, usually Release+Asserts>" echo "" echo " Runs all the libFindBadConstructs unit tests" echo "" } # Runs a single test case. -function do_testcase { - local output=`${CLANG_DIR}/bin/clang -cc1 \ - -load ${CLANG_DIR}/lib/libFindBadConstructs.so \ - -plugin find-bad-constructs ${1} 2>&1` - local diffout=`echo "${output}" | diff - ${2}` - if [[ ${diffout} == "" ]]; then +do_testcase() { + local output="$("${CLANG_DIR}"/bin/clang -cc1 \ + -load "${CLANG_DIR}"/lib/libFindBadConstructs.so \ + -plugin find-bad-constructs ${1} 2>&1)" + local diffout="$(echo "${output}" | diff - "${2}")" + if [ "${diffout}" = "" ]; then echo "PASS: ${1}" else echo "FAIL: ${1}" @@ -46,5 +47,5 @@ else fi for input in *.cpp; do - do_testcase $input ${input%cpp}txt + do_testcase "${input}" "${input%cpp}txt" done |