每轮只推进合理适量的上下文、禁止顺手扩功能 smoke:源码链接构建约束
This commit is contained in:
@@ -4,6 +4,32 @@ set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
manifest=${1:-linuxcnc-rs274-wasm-source-files.txt}
|
||||
self_checks=${CNC_SIM_WASM_BLOCKERS_SELF_CHECKS:-0}
|
||||
if [[ "$self_checks" != "0" && "$self_checks" != "1" ]]; then
|
||||
echo "CNC_SIM_WASM_BLOCKERS_SELF_CHECKS must be 0 or 1: $self_checks" >&2
|
||||
exit 1
|
||||
fi
|
||||
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
||||
cache_dir=${CNC_SIM_WASM_BLOCKERS_CACHE_DIR-${CNC_SIM_PREFLIGHT_CACHE_DIR:-build/wasm-blocker-cache}}
|
||||
if [[ -z "$cache_dir" ]]; then
|
||||
echo "CNC_SIM_WASM_BLOCKERS_CACHE_DIR must not be empty" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$cache_dir" =~ [[:space:]] ]]; then
|
||||
echo "CNC_SIM_WASM_BLOCKERS_CACHE_DIR must not contain whitespace: $cache_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$cache_dir"
|
||||
cache_dir=$(cd "$cache_dir" && pwd)
|
||||
if [[ "$cache_dir" == "/" ]]; then
|
||||
echo "CNC_SIM_WASM_BLOCKERS_CACHE_DIR must not be the filesystem root" >&2
|
||||
exit 1
|
||||
fi
|
||||
LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs-cached.sh --cache-dir "$cache_dir/preflight" "$manifest"
|
||||
manifest=$(cd "$(dirname "$manifest")" && pwd)/$(basename "$manifest")
|
||||
linuxcnc_root=$(cd "$linuxcnc_root" && pwd)
|
||||
|
||||
if [[ "$self_checks" == "1" ]]; then
|
||||
|
||||
missing_manifest=${TMPDIR:-/tmp}/cnc_sim_missing_wasm_blocker_manifest.txt
|
||||
missing_manifest_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_missing_wasm_blocker_manifest.XXXXXX.log")
|
||||
@@ -49,8 +75,6 @@ if ! grep -F "missing LinuxCNC root: $missing_root" "$missing_root_log" >/dev/nu
|
||||
exit 1
|
||||
fi
|
||||
|
||||
output=$(./analyze-linuxcnc-wasm-blockers.sh "$manifest")
|
||||
|
||||
printf 'blocked:src/emc/tooldata/does_not_exist.cc:test missing blocked source\n' >"$missing_source_manifest"
|
||||
if ./analyze-linuxcnc-wasm-blockers.sh "$missing_source_manifest" >"$missing_source_log" 2>&1; then
|
||||
echo "wasm blocker analyzer accepted missing manifest source" >&2
|
||||
@@ -91,6 +115,57 @@ if ! grep -F "missing blocked replacement mapping: src/emc/tooldata/tooldata_db.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
manifest_key=$(printf '%s' "$manifest" | sha256sum | awk '{ print $1 }')
|
||||
exec 8>"$cache_dir/wasm-blockers.lock"
|
||||
flock 8
|
||||
cache_signature="$cache_dir/wasm-blockers.${manifest_key}.signature"
|
||||
cache_output="$cache_dir/wasm-blockers.${manifest_key}.out"
|
||||
next_signature="$cache_signature.next"
|
||||
write_manifest_source_stats() {
|
||||
local group path note source_path
|
||||
while IFS=: read -r group path note; do
|
||||
case "$group" in
|
||||
""|\#*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
[[ -z "${path:-}" ]] && continue
|
||||
source_path="$linuxcnc_root/$path"
|
||||
[[ -f "$source_path" ]] || return 1
|
||||
stat -c 'SOURCE=%n:%s:%y' "$source_path"
|
||||
done < "$manifest"
|
||||
}
|
||||
write_shim_source_hashes() {
|
||||
local shim_source
|
||||
while IFS= read -r shim_source; do
|
||||
[[ -n "$shim_source" ]] || continue
|
||||
[[ -f "$shim_source" ]] || return 1
|
||||
sha256sum "$shim_source"
|
||||
done < <(./list-linuxcnc-wasm-safe-shims.sh)
|
||||
}
|
||||
{
|
||||
printf 'ANALYZER='
|
||||
sha256sum analyze-linuxcnc-wasm-blockers.sh
|
||||
printf 'SHIM_LISTER='
|
||||
sha256sum list-linuxcnc-wasm-safe-shims.sh
|
||||
printf 'MANIFEST_PATH=%s\n' "$manifest"
|
||||
printf 'MANIFEST='
|
||||
sha256sum "$manifest"
|
||||
printf 'LINUXCNC_ROOT=%s\n' "$linuxcnc_root"
|
||||
write_manifest_source_stats
|
||||
write_shim_source_hashes
|
||||
} > "$next_signature"
|
||||
if [[ -f "$cache_signature" && -f "$cache_output" ]] && cmp -s "$cache_signature" "$next_signature"; then
|
||||
output=$(cat "$cache_output")
|
||||
rm -f "$next_signature"
|
||||
else
|
||||
output=$(CNC_SIM_PREFLIGHT_CACHE_DIR="$cache_dir/preflight" LINUXCNC_ROOT="$linuxcnc_root" ./analyze-linuxcnc-wasm-blockers.sh "$manifest")
|
||||
printf '%s\n' "$output" > "$cache_output"
|
||||
mv "$next_signature" "$cache_signature"
|
||||
fi
|
||||
|
||||
grep -F "[manifest]" <<<"$output" >/dev/null
|
||||
grep -F "core=25" <<<"$(sed -n '/^\[manifest\]/,/^$/p' <<<"$output")" >/dev/null
|
||||
grep -F "blocked=9" <<<"$(sed -n '/^\[manifest\]/,/^$/p' <<<"$output")" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user