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 23 matching lines...) Expand all Loading... |
34 # TODO(thakis): Remove once the tests are standalone, http://crbug.com/486559 | 34 # TODO(thakis): Remove once the tests are standalone, http://crbug.com/486559 |
35 if [[ "$(uname -s)" == "Darwin" ]]; then | 35 if [[ "$(uname -s)" == "Darwin" ]]; then |
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 \ |
| 45 -Xclang follow-macro-expansion" |
44 | 46 |
45 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ | 47 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ |
46 -Wno-inconsistent-missing-override \ | 48 -Wno-inconsistent-missing-override \ |
47 -isystem ${THIS_DIR}/system \ | 49 -isystem ${THIS_DIR}/system \ |
48 -Xclang -load -Xclang "${PLUGIN_PATH}" \ | 50 -Xclang -load -Xclang "${PLUGIN_PATH}" \ |
49 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" | 51 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" |
50 local diffout="$(echo "${output}" | diff - "${2}")" | 52 local diffout="$(echo "${output}" | diff - "${2}")" |
51 if [ "${diffout}" = "" ]; then | 53 if [ "${diffout}" = "" ]; then |
52 echo "PASS: ${1}" | 54 echo "PASS: ${1}" |
53 else | 55 else |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 97 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
96 done | 98 done |
97 | 99 |
98 for input in *.c; do | 100 for input in *.c; do |
99 do_testcase "${input}" "${input%c}txt" "${input%c}flags" | 101 do_testcase "${input}" "${input%c}txt" "${input%c}flags" |
100 done | 102 done |
101 | 103 |
102 if [[ "${failed_any_test}" ]]; then | 104 if [[ "${failed_any_test}" ]]; then |
103 exit ${E_FAILEDTEST} | 105 exit ${E_FAILEDTEST} |
104 fi | 106 fi |
OLD | NEW |