eth-statediff-compliance/scripts/compare-diffs.sh
Roy Crihfield fbcb133735
All checks were successful
Test / Run unit tests (push) Successful in 12m36s
Add full diff objects to output (#4)
Reviewed-on: #4
2023-09-27 16:46:13 +00:00

36 lines
615 B
Bash
Executable File

#!/bin/bash
# usage: compare-diffs.sh [-d <output-dir>] <differ-A> <differ-B>
set -e
while getopts d: opt; do
case $opt in
d) output_dir="$OPTARG"
esac
done
shift $((OPTIND - 1))
A=${1:-geth}
B=${2:-plugeth}
if [[ -z "$output_dir" ]]; then
output_dir=$(mktemp -d)
fi
A_OUTPUT="$output_dir/A"
B_OUTPUT="$output_dir/B"
./dumpdiff.$A $A_OUTPUT
./dumpdiff.$B $B_OUTPUT
tmpfile=$(mktemp)
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")
done