| 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 16 matching lines...) Expand all Loading... |
| 27 local flags="" | 27 local flags="" |
| 28 if [ -e "${3}" ]; then | 28 if [ -e "${3}" ]; then |
| 29 flags="$(cat "${3}")" | 29 flags="$(cat "${3}")" |
| 30 fi | 30 fi |
| 31 | 31 |
| 32 if [ "$(uname -s)" = "Darwin" ]; then | 32 if [ "$(uname -s)" = "Darwin" ]; then |
| 33 flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++" | 33 flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++" |
| 34 fi | 34 fi |
| 35 | 35 |
| 36 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ | 36 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ |
| 37 -Wno-inconsistent-missing-override \ |
| 37 -Xclang -load -Xclang "${PLUGIN_PATH}" \ | 38 -Xclang -load -Xclang "${PLUGIN_PATH}" \ |
| 38 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" | 39 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" |
| 39 local diffout="$(echo "${output}" | diff - "${2}")" | 40 local diffout="$(echo "${output}" | diff - "${2}")" |
| 40 if [ "${diffout}" = "" ]; then | 41 if [ "${diffout}" = "" ]; then |
| 41 echo "PASS: ${1}" | 42 echo "PASS: ${1}" |
| 42 else | 43 else |
| 43 failed_any_test=yes | 44 failed_any_test=yes |
| 44 echo "FAIL: ${1}" | 45 echo "FAIL: ${1}" |
| 45 echo "Output of compiler:" | 46 echo "Output of compiler:" |
| 46 echo "${output}" | 47 echo "${output}" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 85 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
| 85 done | 86 done |
| 86 | 87 |
| 87 for input in *.c; do | 88 for input in *.c; do |
| 88 do_testcase "${input}" "${input%c}txt" "${input%c}flags" | 89 do_testcase "${input}" "${input%c}txt" "${input%c}flags" |
| 89 done | 90 done |
| 90 | 91 |
| 91 if [[ "${failed_any_test}" ]]; then | 92 if [[ "${failed_any_test}" ]]; then |
| 92 exit ${E_FAILEDTEST} | 93 exit ${E_FAILEDTEST} |
| 93 fi | 94 fi |
| OLD | NEW |