Packages
evision
0.2.17-rc2
1.0.1-rc.0
1.0.0
1.0.0-rc.0
0.2.17
0.2.17-rc2
0.2.17-rc1
0.2.16
0.2.16-pre.2
0.2.16-pre
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.2-rc2
0.2.1
0.2.0
0.1.39
0.1.38
0.1.37
0.1.36
0.1.35
0.1.34
0.1.33
0.1.32
retired
0.1.31
0.1.30
0.1.29
0.1.28
0.1.27
0.1.26
0.1.26-rc3
0.1.26-rc2
0.1.26-rc1
0.1.26-rc0
0.1.25
0.1.24
0.1.23
0.1.22
0.1.21
0.1.20
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
OpenCV-Erlang/Elixir binding.
Current section
Files
Jump to
Current section
Files
scripts/golden_diff.sh
#!/usr/bin/env bash
# Regression harness for the py_src refactor.
#
# Replays gen2.py with the exact 4.11.0 build config that produced the
# committed lib-4.11.0/ and src-4.11.0/ baselines, then diffs the result.
#
# Generates into .golden/ (staging) rather than in-tree lib/generated and
# src/generated so the working tree stays clean during refactor work.
#
# First-run bootstraps the baselines from the staging output if they are
# empty (Erlang baseline was missing because the user originally only
# generated Elixir).
#
# Empty diff output = byte-equivalent = refactor step is safe.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
# Drop leaked pkg-config from a gstreamer-using sibling repo.
unset PKG_CONFIG_PATH
# Canonical 4.11.0 modules list, copied from
# _build/test/lib/evision/cmake_evision/CMakeCache.txt at the time the
# Elixir baseline was generated.
MODULES="calib3d,core,dnn,features2d,flann,highgui,imgcodecs,imgproc,ml,photo,stitching,ts,video,videoio,aruco,barcode,bgsegm,bioinspired,dnn_superres,face,hfs,img_hash,line_descriptor,mcc,plot,quality,rapid,reg,rgbd,saliency,shape,stereo,structured_light,surface_matching,text,tracking,wechat_qrcode,xfeatures2d,ximgproc,xphoto"
LANG_FLAG="${EVISION_LANG:-elixir,erlang}"
STAGING="${EVISION_GOLDEN_STAGING:-.golden}"
# Staging c_src mirrors in-tree c_src (modules/ feeds the // @evision scan).
# Using rsync so subsequent runs only sync diffs.
mkdir -p "$STAGING/c_src" "$STAGING/lib/generated" "$STAGING/src/generated"
rsync -a --delete c_src/ "$STAGING/c_src/"
echo ">> running gen2.py (lang=$LANG_FLAG) -> $STAGING/"
python3 py_src/gen2.py \
--c_src="$STAGING/c_src" \
--elixir_gen="$STAGING/lib/generated" \
--erlang_gen="$STAGING/src/generated" \
--headers=c_src/headers-contrib.txt \
--lang="$LANG_FLAG" \
--modules="$MODULES"
bootstrap_dir() {
local src=$1 dst=$2
if [ ! -d "$dst" ] || [ -z "$(ls -A "$dst" 2>/dev/null || true)" ]; then
echo ">> bootstrap $dst <- $src"
mkdir -p "$dst"
cp -a "$src"/. "$dst"/
fi
}
bootstrap_dir "$STAGING/lib/generated" lib-4.11.0/generated
bootstrap_dir "$STAGING/src/generated" src-4.11.0/generated
elixir_diff=$(diff -rq "$STAGING/lib/generated" lib-4.11.0/generated 2>&1 || true)
erlang_diff=$(diff -rq "$STAGING/src/generated" src-4.11.0/generated 2>&1 || true)
echo "=== Elixir diff (current vs lib-4.11.0/generated) ==="
if [ -z "$elixir_diff" ]; then
echo " (byte-equivalent)"
else
echo "$elixir_diff"
fi
echo "=== Erlang diff (current vs src-4.11.0/generated) ==="
if [ -z "$erlang_diff" ]; then
echo " (byte-equivalent)"
else
echo "$erlang_diff"
fi
if [ -n "$elixir_diff" ] || [ -n "$erlang_diff" ]; then
exit 1
fi