Fix check-magic-strings.sh to return with non-zero if error happens (#2525)

Running `tools/run_tests.py --check-magic-strings` causes an IndexError,
but the script exits with 0, indicating error-less run.
Added error checking to the file, to indicate errors in the future.

Fixes #2522

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
This commit is contained in:
Tóth Béla 2018-09-14 13:37:48 +02:00 committed by László Langó
parent 0d05dfcd68
commit 2d83d8ed17

View File

@ -20,13 +20,17 @@ MAGIC_STRINGS_TEMP=`mktemp lit-magic-strings.inc.h.XXXXXXXXXX`
cp $MAGIC_STRINGS_INC_H $MAGIC_STRINGS_TEMP
$MAGIC_STRINGS_GEN
diff -q $MAGIC_STRINGS_INC_H $MAGIC_STRINGS_TEMP
DIFF_RESULT=$?
if [ $DIFF_RESULT -eq 0 ]
then
diff -q $MAGIC_STRINGS_INC_H $MAGIC_STRINGS_TEMP
DIFF_RESULT=$?
if [ $DIFF_RESULT -ne 0 ]
then
echo -e "\e[1;33m$MAGIC_STRINGS_INC_H must be re-generated. Run $MAGIC_STRINGS_GEN\e[0m"
fi
fi
mv $MAGIC_STRINGS_TEMP $MAGIC_STRINGS_INC_H
if [ $DIFF_RESULT -ne 0 ]
then
echo -e "\e[1;33m$MAGIC_STRINGS_INC_H must be re-generated. Run $MAGIC_STRINGS_GEN\e[0m"
fi
exit $DIFF_RESULT