Files
scylladb/test/lib/mutation_diff
Konstantin Osipov 8047d24c48 tests: move .hh files and resources to new locations
The plan is to move the unstructured content of tests/ directory
into the following directories of test/:

test/lib - shared header and source files for unit tests
test/boost - boost unit tests
test/unit - non-boost unit tests
test/manual - tests intended to be run manually
test/resource - binary test resources and configuration files

In order to not break git bisect and preserve the file history,
first move most of the header files and resources.
Update paths to these files in .cc files, which are not moved.
2019-12-16 17:47:42 +03:00

36 lines
719 B
Bash
Executable File

#!/usr/bin/env bash
#
# Converts assertion failure text involving two mutations to a diff.
#
cmd="colordiff -u"
while getopts ":d:" opt; do
case $opt in
d)
cmd="$OPTARG";;
*)
echo "Usage: $0 [-d diff_command] [<path-to-test-output-file>]" 1>&2
exit 1;;
esac
done
shift $((OPTIND-1))
file="$1"
if [ -z "$file" -o "$file" = "-" ]; then
tmpfile=$(mktemp)
cat > "$tmpfile"
file="$tmpfile"
fi
function filter {
sed 's/@0x[0-9a-f]*//g'
}
$cmd <(sed -n '/expected/,/got:/p' "$file" | head -n-1 | sed 's/.*expected /&\n/' | filter) \
<(sed -n '/got:/,/^$/p' "$file" | sed 's/.*got: /&\n/' | filter) | less -R
if [ -n "$tmpfile" ]; then
rm -f "$tmpfile"
fi