eth-statediff-compliance/scripts/compare-diffs.sh
Roy Crihfield 8d80d36aa2
All checks were successful
Test / Run unit tests (pull_request) Successful in 12m16s
Add plugin-parallel
2023-09-21 23:23:55 +08:00

39 lines
752 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 [[ -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
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")
echo Files match: "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file"
done