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 15 matching lines...) Expand all Loading... |
26 do_testcase() { | 26 do_testcase() { |
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 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ |
| 37 -Xclang with-ast-visitor" |
| 38 |
36 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ | 39 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ |
37 -Wno-inconsistent-missing-override \ | 40 -Wno-inconsistent-missing-override \ |
38 -Xclang -load -Xclang "${PLUGIN_PATH}" \ | 41 -Xclang -load -Xclang "${PLUGIN_PATH}" \ |
39 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" | 42 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" |
40 local diffout="$(echo "${output}" | diff - "${2}")" | 43 local diffout="$(echo "${output}" | diff - "${2}")" |
41 if [ "${diffout}" = "" ]; then | 44 if [ "${diffout}" = "" ]; then |
42 echo "PASS: ${1}" | 45 echo "PASS: ${1}" |
43 else | 46 else |
44 failed_any_test=yes | 47 failed_any_test=yes |
45 echo "FAIL: ${1}" | 48 echo "FAIL: ${1}" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 88 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
86 done | 89 done |
87 | 90 |
88 for input in *.c; do | 91 for input in *.c; do |
89 do_testcase "${input}" "${input%c}txt" "${input%c}flags" | 92 do_testcase "${input}" "${input%c}txt" "${input%c}flags" |
90 done | 93 done |
91 | 94 |
92 if [[ "${failed_any_test}" ]]; then | 95 if [[ "${failed_any_test}" ]]; then |
93 exit ${E_FAILEDTEST} | 96 exit ${E_FAILEDTEST} |
94 fi | 97 fi |
OLD | NEW |