Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Side by Side Diff: tools/clang/plugins/tests/test.sh

Issue 597863002: Update plugin to handle new style rules for virtual annotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/annotation/specifier/g Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \ 36 local output="$("${CLANG_PATH}" -fsyntax-only -c -Wno-c++11-extensions \
hans 2014/09/26 01:29:29 can probably drop the -c now that we pass -fsyntax
dcheng 2014/09/26 07:07:14 Done.
37 -Xclang -load -Xclang "${PLUGIN_PATH}" \ 37 -Xclang -load -Xclang "${PLUGIN_PATH}" \
38 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)" 38 -Xclang -add-plugin -Xclang find-bad-constructs ${flags} ${1} 2>&1)"
39 local diffout="$(echo "${output}" | diff - "${2}")" 39 local diffout="$(echo "${output}" | diff - "${2}")"
40 if [ "${diffout}" = "" ]; then 40 if [ "${diffout}" = "" ]; then
41 echo "PASS: ${1}" 41 echo "PASS: ${1}"
42 else 42 else
43 failed_any_test=yes 43 failed_any_test=yes
44 echo "FAIL: ${1}" 44 echo "FAIL: ${1}"
45 echo "Output of compiler:" 45 echo "Output of compiler:"
46 echo "${output}" 46 echo "${output}"
47 cat > ${2}-actual << EOF
hans 2014/09/26 01:29:29 Won't this leave a file in the source tree? It see
dcheng 2014/09/26 07:07:14 Only if there's a diff. It makes it much easier to
hans 2014/09/27 00:36:09 Oh, right. That makes sense.
48 ${output}
49 EOF
50
47 echo "Expected output:" 51 echo "Expected output:"
48 cat "${2}" 52 cat "${2}"
49 echo 53 echo
50 fi 54 fi
51 } 55 }
52 56
53 # Validate input to the script. 57 # Validate input to the script.
54 if [[ -z "${1}" ]]; then 58 if [[ -z "${1}" ]]; then
55 usage 59 usage
56 exit ${E_BADARGS} 60 exit ${E_BADARGS}
(...skipping 23 matching lines...) Expand all
80 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" 84 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags"
81 done 85 done
82 86
83 for input in *.c; do 87 for input in *.c; do
84 do_testcase "${input}" "${input%c}txt" "${input%c}flags" 88 do_testcase "${input}" "${input%c}txt" "${input%c}flags"
85 done 89 done
86 90
87 if [[ "${failed_any_test}" ]]; then 91 if [[ "${failed_any_test}" ]]; then
88 exit ${E_FAILEDTEST} 92 exit ${E_FAILEDTEST}
89 fi 93 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698