2023-09-06 12:53:36 +00:00
|
|
|
#!/bin/bash
|
2023-09-22 10:49:02 +00:00
|
|
|
# usage: compare-diffs.sh [-d <output-dir>] <differ-A> <differ-B>
|
2023-09-06 12:53:36 +00:00
|
|
|
|
2023-09-20 06:07:22 +00:00
|
|
|
set -e
|
2023-09-06 12:53:36 +00:00
|
|
|
|
2023-09-22 10:49:02 +00:00
|
|
|
while getopts d: opt; do
|
|
|
|
case $opt in
|
|
|
|
d) output_dir="$OPTARG"
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
|
|
|
|
A=${1:-geth}
|
|
|
|
B=${2:-plugeth}
|
|
|
|
|
|
|
|
if [[ -n "$output_dir" ]]; then
|
|
|
|
mkdir -p $output_dir
|
|
|
|
A_OUTPUT="$output_dir/A"
|
|
|
|
B_OUTPUT="$output_dir/B"
|
|
|
|
else
|
|
|
|
A_OUTPUT=$(mktemp -d -t A_XXXX)
|
|
|
|
B_OUTPUT=$(mktemp -d -t B_XXXX)
|
|
|
|
fi
|
|
|
|
|
|
|
|
./dumpdiff.$A $A_OUTPUT
|
|
|
|
./dumpdiff.$B $B_OUTPUT
|
2023-09-06 12:53:36 +00:00
|
|
|
|
2023-09-22 10:49:02 +00:00
|
|
|
tmpfile=$(mktemp)
|
2023-09-06 12:53:36 +00:00
|
|
|
|
2023-09-22 10:49:02 +00:00
|
|
|
for file in $(ls $A_OUTPUT); do
|
|
|
|
for dir in "$A_OUTPUT" "$B_OUTPUT"; do
|
|
|
|
sort -u "$dir/$file" > $tmpfile
|
|
|
|
mv $tmpfile "$dir/$file"
|
|
|
|
done
|
|
|
|
(set -x; diff "${A_OUTPUT}/$file" "${B_OUTPUT}/$file")
|
2023-09-20 06:07:22 +00:00
|
|
|
echo Files match: "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file"
|
2023-09-06 12:53:36 +00:00
|
|
|
done
|