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

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

Issue 572413002: Revert "Roll Clang 214024:216630 (+216684) and switch to CMake (try 2)" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « tools/clang/blink_gc_plugin/Makefile ('k') | tools/clang/plugins/CMakeLists.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 E_FAILEDTEST=1 11 E_FAILEDTEST=1
12 12
13 failed_any_test= 13 failed_any_test=
14 14
15 # Prints usage information. 15 # Prints usage information.
16 usage() { 16 usage() {
17 echo "Usage: $(basename "${0}")" \ 17 echo "Usage: $(basename "${0}")" \
18 "<path to clang>" \ 18 "<Path to the llvm build dir, usually Release+Asserts>"
19 "<path to plugin>"
20 echo "" 19 echo ""
21 echo " Runs all the libBlinkGCPlugin unit tests" 20 echo " Runs all the libBlinkGCPlugin unit tests"
22 echo "" 21 echo ""
23 } 22 }
24 23
25 # Runs a single test case. 24 # Runs a single test case.
26 do_testcase() { 25 do_testcase() {
27 local flags="" 26 local flags=""
28 if [ -e "${3}" ]; then 27 if [ -e "${3}" ]; then
29 flags="$(cat "${3}")" 28 flags="$(cat "${3}")"
30 fi 29 fi
31 local output="$("${CLANG_PATH}" -c -Wno-c++11-extensions \ 30 local output="$("${CLANG_DIR}"/bin/clang -c -Wno-c++11-extensions \
32 -Xclang -load -Xclang "${PLUGIN_PATH}" \ 31 -Xclang -load -Xclang "${CLANG_DIR}"/lib/lib${LIBNAME}.${LIB} \
33 -Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)" 32 -Xclang -add-plugin -Xclang blink-gc-plugin ${flags} ${1} 2>&1)"
34 local json="${input%cpp}graph.json" 33 local json="${input%cpp}graph.json"
35 if [ -f "$json" ]; then 34 if [ -f "$json" ]; then
36 output="$(python ../process-graph.py -c ${json} 2>&1)" 35 output="$(python ../process-graph.py -c ${json} 2>&1)"
37 fi 36 fi
38 local diffout="$(echo "${output}" | diff - "${2}")" 37 local diffout="$(echo "${output}" | diff - "${2}")"
39 if [ "${diffout}" = "" ]; then 38 if [ "${diffout}" = "" ]; then
40 echo "PASS: ${1}" 39 echo "PASS: ${1}"
41 else 40 else
42 failed_any_test=yes 41 failed_any_test=yes
43 echo "FAIL: ${1}" 42 echo "FAIL: ${1}"
44 echo "Output of compiler:" 43 echo "Output of compiler:"
45 echo "${output}" 44 echo "${output}"
46 echo "Expected output:" 45 echo "Expected output:"
47 cat "${2}" 46 cat "${2}"
48 echo 47 echo
49 fi 48 fi
50 } 49 }
51 50
52 # Validate input to the script. 51 # Validate input to the script.
53 if [[ -z "${1}" ]]; then 52 if [[ -z "${1}" ]]; then
54 usage 53 usage
55 exit ${E_BADARGS} 54 exit ${E_BADARGS}
56 elif [[ -z "${2}" ]]; then 55 elif [[ ! -d "${1}" ]]; then
57 usage 56 echo "${1} is not a directory."
58 exit ${E_BADARGS}
59 elif [[ ! -x "${1}" ]]; then
60 echo "${1} is not an executable"
61 usage
62 exit ${E_BADARGS}
63 elif [[ ! -f "${2}" ]]; then
64 echo "${2} could not be found"
65 usage 57 usage
66 exit ${E_BADARGS} 58 exit ${E_BADARGS}
67 else 59 else
68 export CLANG_PATH="${1}" 60 export CLANG_DIR="${PWD}/${1}"
69 export PLUGIN_PATH="${2}" 61 echo "Using clang directory ${CLANG_DIR}..."
70 echo "Using clang ${CLANG_PATH}..."
71 echo "Using plugin ${PLUGIN_PATH}..."
72 62
73 # The golden files assume that the cwd is this directory. To make the script 63 # The golden files assume that the cwd is this directory. To make the script
74 # work no matter what the cwd is, explicitly cd to there. 64 # work no matter what the cwd is, explicitly cd to there.
75 cd "$(dirname "${0}")" 65 cd "$(dirname "${0}")"
66
67 export LIBNAME=$(grep LIBRARYNAME ../Makefile | cut -d ' ' -f 3)
68 if [ "$(uname -s)" = "Linux" ]; then
69 export LIB=so
70 elif [ "$(uname -s)" = "Darwin" ]; then
71 export LIB=dylib
72 fi
76 fi 73 fi
77 74
78 for input in *.cpp; do 75 for input in *.cpp; do
79 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags" 76 do_testcase "${input}" "${input%cpp}txt" "${input%cpp}flags"
80 done 77 done
81 78
82 if [[ "${failed_any_test}" ]]; then 79 if [[ "${failed_any_test}" ]]; then
83 exit ${E_FAILEDTEST} 80 exit ${E_FAILEDTEST}
84 fi 81 fi
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/Makefile ('k') | tools/clang/plugins/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698