Skip to content

Commit

Permalink
chore: Add helper script to compare hex files against each other in o…
Browse files Browse the repository at this point in the history
…rder to help prevent regressions during cosmetic changes
  • Loading branch information
stylesuxx committed Sep 18, 2022
1 parent 8e0b8b0 commit 3e61070
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build
/tools/.wine
*.diff
30 changes: 30 additions & 0 deletions tools/compare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
SOURCE_DIR=$1
TARGET_DIR=$2

FILES=$(ls $SOURCE_DIR)

TOTAL=0
MATCHING=0
EXISTING=0
DIFFERENT=0

for FILE in ${FILES}; do
TOTAL=$((TOTAL+1))
if [ -f "${TARGET_DIR}/${FILE}" ]; then
EXISTING=$((EXISTING+1))
diff ${SOURCE_DIR}/${FILE} ${TARGET_DIR}/${FILE} > files.diff
if [ $? -eq 0 ]; then
MATCHING=$((MATCHING+1))
else
DIFFERENT=$((DIFFERENT+1))
fi
fi
done

echo "Total files: ${TOTAL}; New files: $((TOTAL - EXISTING))"
if [ $MATCHING -eq $EXISTING ]; then
echo "All existing files match!"
else
echo Different: ${DIFFERENT}/${EXISTING}
fi

0 comments on commit 3e61070

Please sign in to comment.