Allow comparison

This commit is contained in:
Wilson Lin 2021-08-09 20:42:47 +10:00
commit 0bed19e5ed
13 changed files with 106 additions and 37 deletions

1
debug/diff/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/outputs/

View file

@ -1 +1 @@
[compare.sh](./compare.sh) is a useful script for viewing a character-by-character diff between the minified outputs of minify-html and html-minifier for a specific test. Pass the test's file name as the first argument.
[compare](./compare) is a useful script for viewing a character-by-character diff between the minified outputs of minify-html and html-minifier for a specific input. Pass the input's file name as the first argument.

9
debug/diff/compare Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -Eeuxo pipefail
pushd "$(dirname "$0")" >/dev/null
git --no-pager diff --no-index --word-diff=color --word-diff-regex=. "outputs/html-minifier/$1" "outputs/minify-html/$1" | less
popd >/dev/null

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
git --no-pager diff --no-index --word-diff=color --word-diff-regex=. "min/html-minifier/$1.html" "min/@minify-html/js/$1.html" | less

30
debug/diff/run Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -Eeuo pipefail
shopt -s nullglob
pushd "$(dirname "$0")" >/dev/null
input_dir="$PWD/../../bench/inputs"
output_dir="$PWD/outputs"
rm -rf "$output_dir"
mkdir -p "$output_dir"
pushd "../../bench/runners" >/dev/null
for r in *; do
if [ ! -d "$r" ]; then
continue
fi
mkdir -p "$output_dir/$r"
echo "Running $r..."
pushd "$r" >/dev/null
MHB_ITERATIONS=1 MHB_INPUT_DIR="$input_dir" MHB_OUTPUT_DIR="$output_dir/$r" RUST_BACKTRACE=1 ./run >/dev/null
popd >/dev/null
done
popd >/dev/null
echo "All done!"
popd >/dev/null