blob: 066e09a6668d94c34c3abd51bdeba58e3a138972 [file] [log] [blame]
Roger Meier30877382012-09-17 21:18:05 +00001#!/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
8shopt -s extglob
9
10MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
11ROOT_DIR=`cd $MY_DIR/../../ && pwd`
12TEST_THRIFT_DIR=${ROOT_DIR}/test
13THRIFT_FILES=`find ${TEST_THRIFT_DIR} -type f -name *.thrift ! -name BrokenConstants.thrift`
14
15OUTPUT_DIR=`mktemp -d -t test_thrift_parser.XXXXX`
16
17PASS=0
18FAIL=0
19for f in ${THRIFT_FILES};
20do
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
29done
30echo
31echo "${PASS} files parsed correctly. ${FAIL} files failed to parse."