зеркало из https://github.com/github/vitess-gh.git
add a test to validate sql.go matches goyacc output
Add a test script that regenerates the contents of sql.go into a temp file and then compares to the current contents in order to make sure that the version checked in matches the output of the expected toolchain.
This commit is contained in:
Родитель
e92ab80470
Коммит
05c1de8006
|
@ -210,6 +210,17 @@
|
||||||
"site_test"
|
"site_test"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"parser_generator": {
|
||||||
|
"File": "",
|
||||||
|
"Args": [],
|
||||||
|
"Command": [
|
||||||
|
"tools/test_parser_generator.sh"
|
||||||
|
],
|
||||||
|
"Manual": false,
|
||||||
|
"Shard": 0,
|
||||||
|
"RetryMax": 0,
|
||||||
|
"Tags": []
|
||||||
|
},
|
||||||
"php": {
|
"php": {
|
||||||
"File": "",
|
"File": "",
|
||||||
"Args": [],
|
"Args": [],
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Validate that the current version of the generated parser matches the output
|
||||||
|
# generated by the version of goyacc installed on the local system.
|
||||||
|
#
|
||||||
|
# This is used in travis to verify that the currently committed version was
|
||||||
|
# generated with the proper version of goyacc.
|
||||||
|
|
||||||
|
CUR="sql.go"
|
||||||
|
TMP="/tmp/sql.$$.go"
|
||||||
|
|
||||||
|
cd go/vt/sqlparser/
|
||||||
|
|
||||||
|
goyacc -o $TMP sql.y
|
||||||
|
gofmt -w $TMP
|
||||||
|
|
||||||
|
diff -q $CUR $TMP > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [ $? != 0 ] ; then
|
||||||
|
echo "ERROR: Regenerated parser $TMP does not match current version `pwd`/sql.go:"
|
||||||
|
diff -u $CUR $TMP
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm $TMP
|
Загрузка…
Ссылка в новой задаче