| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 # Runs a single test case. | 24 # Runs a single test case. |
| 25 do_testcase() { | 25 do_testcase() { |
| 26 local flags="" | 26 local flags="" |
| 27 if [ -e "${3}" ]; then | 27 if [ -e "${3}" ]; then |
| 28 flags="$(cat "${3}")" | 28 flags="$(cat "${3}")" |
| 29 fi | 29 fi |
| 30 local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \ | 30 local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \ |
| 31 -Xclang -load -Xclang "${CLANG_DIR}"/lib/lib${LIBNAME}.${LIB} \ | 31 -Xclang -load -Xclang "${CLANG_DIR}"/lib/lib${LIBNAME}.${LIB} \ |
| 32 -Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)" | 32 -Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)" |
| 33 local json="${input%cpp}graph.json" |
| 34 if [ -f "$json" ]; then |
| 35 output="$(python ../process-graph.py -c ${json} 2>&1)" |
| 36 fi |
| 33 local diffout="$(echo "${output}" | diff - "${2}")" | 37 local diffout="$(echo "${output}" | diff - "${2}")" |
| 34 if [ "${diffout}" = "" ]; then | 38 if [ "${diffout}" = "" ]; then |
| 35 echo "PASS: ${1}" | 39 echo "PASS: ${1}" |
| 36 else | 40 else |
| 37 failed_any_test=yes | 41 failed_any_test=yes |
| 38 echo "FAIL: ${1}" | 42 echo "FAIL: ${1}" |
| 39 echo "Output of compiler:" | 43 echo "Output of compiler:" |
| 40 echo "${output}" | 44 echo "${output}" |
| 41 echo "Expected output:" | 45 echo "Expected output:" |
| 42 cat "${2}" | 46 cat "${2}" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 fi | 72 fi |
| 69 fi | 73 fi |
| 70 | 74 |
| 71 for input in *.cpp; do | 75 for input in *.cpp; do |
| 72 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" | 76 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" |
| 73 done | 77 done |
| 74 | 78 |
| 75 if [[ "${failed_any_test}" ]]; then | 79 if [[ "${failed_any_test}" ]]; then |
| 76 exit ${E_FAILEDTEST} | 80 exit ${E_FAILEDTEST} |
| 77 fi | 81 fi |
| OLD | NEW |