Last active
February 8, 2021 07:58
-
-
Save aqjune/85b696292fd4f1685a3f71f7d8e3390d to your computer and use it in GitHub Desktop.
list-nodiffs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tempsrc=`mktemp` | |
temptgt=`mktemp` | |
# 1. src.ll/tgt.ll tests | |
for i in `find . -name "*.src.ll"`; do | |
itgt="${i%.src.ll}.tgt.ll" | |
grep -v '^;' $i | awk 'NF' >$tempsrc # ignore comments and whitespaces | |
grep -v '^;' $itgt | awk 'NF' >$temptgt | |
diff ${tempsrc} ${temptgt} >/dev/null | |
if [ "$?" == 0 ]; then | |
echo "NODIFF: $i" | |
fi | |
done | |
# 2. .srctgt.ll tests | |
temptxt=`mktemp` | |
for i in `find . -name "*.srctgt.ll"`; do | |
grep -v '^;' $i | awk 'NF' >$temptxt # ignore comments and whitespaces | |
rm -f $tempsrc $temptgt | |
dest= | |
while read -r line; do | |
if [[ $line == *"@src"* ]]; then | |
dest=$tempsrc | |
elif [[ $line == *"@tgt"* ]]; then | |
if [[ ! -f $tempsrc ]]; then | |
# no @src() but yes @tgt()? | |
break | |
fi | |
dest=$temptgt | |
fi | |
if [[ $dest != "" ]]; then | |
echo $line >>$dest | |
fi | |
done < $temptxt | |
if [ ! -f $temptgt ]; then | |
# it does not have @tgt() | |
echo "ill-formed test: $i" | |
continue | |
fi | |
sed 's/@tgt/@src/g' $temptgt >$temptxt | |
diff ${tempsrc} ${temptxt} >/dev/null | |
if [ "$?" == 0 ]; then | |
echo "NODIFF: $i" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment