Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 # | 6 # |
| 7 # Hacky, primitive testing: This runs the style plugin for a set of input files | 7 # Hacky, primitive testing: This runs the style plugin for a set of input files |
| 8 # and compares the output with golden result files. | 8 # and compares the output with golden result files. |
| 9 | 9 |
| 10 E_BADARGS=65 | 10 E_BADARGS=65 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 flags="${flags} -isysroot $(xcrun --show-sdk-path)" | 36 flags="${flags} -isysroot $(xcrun --show-sdk-path)" |
| 37 fi | 37 fi |
| 38 if [[ "$(uname -s)" == "Darwin" && "${flags}" != *-target* ]]; then | 38 if [[ "$(uname -s)" == "Darwin" && "${flags}" != *-target* ]]; then |
| 39 flags="${flags} -stdlib=libstdc++" | 39 flags="${flags} -stdlib=libstdc++" |
| 40 fi | 40 fi |
| 41 | 41 |
| 42 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ | 42 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ |
| 43 -Xclang with-ast-visitor" | 43 -Xclang with-ast-visitor" |
| 44 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ | 44 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ |
| 45 -Xclang follow-macro-expansion" | 45 -Xclang follow-macro-expansion" |
| 46 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ | |
|
dcheng
2016/03/24 17:37:25
You might need to rebase this, since I ported the
| |
| 47 -Xclang treat-virtuals-as-complexity" | |
| 46 | 48 |
| 47 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ | 49 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ |
| 48 -Wno-inconsistent-missing-override \ | 50 -Wno-inconsistent-missing-override \ |
| 49 -isystem ${THIS_DIR}/system \ | 51 -isystem ${THIS_DIR}/system \ |
| 50 -Xclang -load -Xclang "${PLUGIN_PATH}" \ | 52 -Xclang -load -Xclang "${PLUGIN_PATH}" \ |
| 51 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" | 53 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" |
| 52 local diffout="$(echo "${output}" | diff - "${2}")" | 54 local diffout="$(echo "${output}" | diff - "${2}")" |
| 53 if [ "${diffout}" = "" ]; then | 55 if [ "${diffout}" = "" ]; then |
| 54 echo "PASS: ${1}" | 56 echo "PASS: ${1}" |
| 55 else | 57 else |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 99 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
| 98 done | 100 done |
| 99 | 101 |
| 100 for input in *.c; do | 102 for input in *.c; do |
| 101 do_testcase "${input}" "${input%c}txt" "${input%c}flags" | 103 do_testcase "${input}" "${input%c}txt" "${input%c}flags" |
| 102 done | 104 done |
| 103 | 105 |
| 104 if [[ "${failed_any_test}" ]]; then | 106 if [[ "${failed_any_test}" ]]; then |
| 105 exit ${E_FAILEDTEST} | 107 exit ${E_FAILEDTEST} |
| 106 fi | 108 fi |
| OLD | NEW |