Roger Meier | 3087738 | 2012-09-17 21:18:05 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Tests the parser, independently of whether any generators |
| 4 | # are correct or useful. |
| 5 | # Currently only tests that valid .thrift files parse cleanly. |
| 6 | # Doesn't test that correct information is extracted from them. |
| 7 | |
| 8 | shopt -s extglob |
| 9 | |
| 10 | MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 11 | ROOT_DIR=`cd $MY_DIR/../../ && pwd` |
| 12 | TEST_THRIFT_DIR=${ROOT_DIR}/test |
| 13 | THRIFT_FILES=`find ${TEST_THRIFT_DIR} -type f -name *.thrift ! -name BrokenConstants.thrift` |
| 14 | |
| 15 | OUTPUT_DIR=`mktemp -d -t test_thrift_parser.XXXXX` |
| 16 | |
| 17 | PASS=0 |
| 18 | FAIL=0 |
| 19 | for f in ${THRIFT_FILES}; |
| 20 | do |
| 21 | echo "Parsing ${f}" |
| 22 | ${MY_DIR}/thrift -o ${OUTPUT_DIR} -nowarn --allow-64bit-consts --gen cpp ${f} |
| 23 | EXIT_CODE=$? |
| 24 | if [ ${EXIT_CODE} -eq 0 ]; then |
| 25 | let PASS=PASS+1 |
| 26 | else |
| 27 | let FAIL=FAIL+1 |
| 28 | fi |
| 29 | done |
| 30 | echo |
| 31 | echo "${PASS} files parsed correctly. ${FAIL} files failed to parse." |