sunxi-tools/tests/fextest.sh
Bernhard Nortmann cd5a0a3303 tests: Improve on testing fexc
After all .fex files can be successfully compiled, let's also
test the opposite direction by decompiling the resulting .bin.
The output then has to pass an automated diff against the source
.fex (transformed via some preprocessing with "unify-fex").

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
2016-11-12 13:38:40 +01:00

20 lines
420 B
Bash
Executable File

#!/bin/bash
echo $0 $*
FEX2BIN=../fex2bin
BIN2FEX=../bin2fex
FEX=$1
BIN=${FEX/%.fex/.bin}
REVERSE=${FEX/%.fex/.new}
${FEX2BIN} ${FEX} ${BIN}
${BIN2FEX} ${BIN} ${REVERSE}
# preprocess .fex, compare it to the bin2fex output
if ./unify-fex ${FEX} | diff -uwB - ${REVERSE}; then
# if successful, clean up the output files
rm -f ${BIN} ${REVERSE}
else
echo '***'
echo "*** ERROR processing ${FEX}"
echo '***'
exit 1
fi