Skip to content

Instantly share code, notes, and snippets.

@abaire
Created March 23, 2022 15:19
Show Gist options
  • Save abaire/f566977419b3b3eb0537d3b4246de22f to your computer and use it in GitHub Desktop.
Save abaire/f566977419b3b3eb0537d3b4246de22f to your computer and use it in GitHub Desktop.
CI results comparator
#!/usr/bin/env bash
set -eu
set -o pipefail
hw_dir=hw
function check () {
local test_dir="${1}"
local diff_dir="${2}"
local test_name="${3}"
echo "Checking ${test_dir} ${test_name}"
echo "Writing diffs to ${diff_dir}"
local hw_results="${hw_dir}/${test_name}"
mkdir -p "${diff_dir}"
for img in "${test_dir}/"*.png; do
filename=$(basename "${img}")
hw_image="${hw_results}/${filename}"
diff_file="${diff_dir}/${filename}"
set +e
perceptualdiff "${hw_image}" "${img}" -verbose -output "${diff_file}"
different=$?
set -e
if [[ ${different} -ne 0 ]]; then
echo "${img} differs: ${different}"
else
rm "${diff_file}"
fi
done
}
for result_set in *; do
result_dir="${result_set}/TestNXDKPgraphTests"
if [[ -d "${result_dir}" ]]; then
diff_dir="${result_dir}/_diffs"
for test in "${result_dir}/"*; do
test_name=$(basename "${test}")
if [[ "${test_name}" == "_diffs" ]]; then
continue
fi
if [[ -d "${test}" ]]; then
check "${test}" "${diff_dir}/${test_name}" "${test_name}"
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment