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 13 matching lines...) Expand all Loading... |
24 echo "" | 24 echo "" |
25 } | 25 } |
26 | 26 |
27 # Runs a single test case. | 27 # Runs a single test case. |
28 do_testcase() { | 28 do_testcase() { |
29 local flags="" | 29 local flags="" |
30 if [ -e "${3}" ]; then | 30 if [ -e "${3}" ]; then |
31 flags="$(cat "${3}")" | 31 flags="$(cat "${3}")" |
32 fi | 32 fi |
33 | 33 |
34 if [ "$(uname -s)" = "Darwin" ]; then | 34 # TODO(thakis): Remove once the tests are standalone, http://crbug.com/486559 |
35 flags="${flags} -isysroot $(xcrun --show-sdk-path) -stdlib=libstdc++" | 35 if [[ "$(uname -s)" == "Darwin" ]]; then |
| 36 flags="${flags} -isysroot $(xcrun --show-sdk-path)" |
| 37 fi |
| 38 if [[ "$(uname -s)" == "Darwin" && "${flags}" != *-target* ]]; then |
| 39 flags="${flags} -stdlib=libstdc++" |
36 fi | 40 fi |
37 | 41 |
38 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ | 42 flags="${flags} -Xclang -plugin-arg-find-bad-constructs \ |
39 -Xclang with-ast-visitor" | 43 -Xclang with-ast-visitor" |
40 | 44 |
41 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ | 45 local output="$("${CLANG_PATH}" -fsyntax-only -Wno-c++11-extensions \ |
42 -Wno-inconsistent-missing-override \ | 46 -Wno-inconsistent-missing-override \ |
43 -isystem ${THIS_DIR}/system \ | 47 -isystem ${THIS_DIR}/system \ |
44 -Xclang -load -Xclang "${PLUGIN_PATH}" \ | 48 -Xclang -load -Xclang "${PLUGIN_PATH}" \ |
45 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" | 49 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 95 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
92 done | 96 done |
93 | 97 |
94 for input in *.c; do | 98 for input in *.c; do |
95 do_testcase "${input}" "${input%c}txt" "${input%c}flags" | 99 do_testcase "${input}" "${input%c}txt" "${input%c}flags" |
96 done | 100 done |
97 | 101 |
98 if [[ "${failed_any_test}" ]]; then | 102 if [[ "${failed_any_test}" ]]; then |
99 exit ${E_FAILEDTEST} | 103 exit ${E_FAILEDTEST} |
100 fi | 104 fi |
OLD | NEW |