port: advance MSVC600 CPython compatibility frontier
This commit is contained in:
+147
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Regression tests for scripts/vc6-probe-pythoncore-frontier.sh.
|
||||
#
|
||||
# The no-toolchain checks exercise the source-list parser/normalizer and the
|
||||
# per-file define handling that make the frontier source-list-driven. When
|
||||
# Wine + MSVC600 are available, a bounded live run verifies that the harness
|
||||
# reports cl.exe's real first-blocker status.
|
||||
#
|
||||
# Usage: scripts/vc6-probe-pythoncore-frontier.test.sh
|
||||
|
||||
set -u
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PROBE="$REPO_ROOT/scripts/vc6-probe-pythoncore-frontier.sh"
|
||||
|
||||
fail=0
|
||||
pass() { echo "ok - $1"; }
|
||||
bad() { echo "not ok - $1"; fail=1; }
|
||||
|
||||
out="$($PROBE --list-only 2>&1)"
|
||||
status=$?
|
||||
|
||||
if [ "$status" -eq 0 ]; then
|
||||
pass "frontier --list-only exits 0"
|
||||
else
|
||||
bad "frontier --list-only exits 0 (got exit $status)"
|
||||
echo "$out"
|
||||
fi
|
||||
|
||||
count="$(printf '%s\n' "$out" | awk 'NF { n++ } END { print n+0 }')"
|
||||
if [ "$count" -eq 198 ]; then
|
||||
pass "frontier parses all 198 pythoncore.vcxproj ClCompile entries"
|
||||
else
|
||||
bad "frontier parses all 198 pythoncore.vcxproj ClCompile entries (got $count)"
|
||||
fi
|
||||
|
||||
first_fields="$(printf '%s\n' "$out" | awk -F '\t' 'NR == 1 { print $1 "|" $2 "|" $3 }')"
|
||||
if [ "$first_fields" = 'compile|cpython/Modules/getpath.c|..\Modules\getpath.c' ]; then
|
||||
pass "frontier normalizes the first Windows-style source path to cpython/Modules/getpath.c"
|
||||
else
|
||||
bad "frontier normalizes the first Windows-style source path to cpython/Modules/getpath.c (got: $first_fields)"
|
||||
fi
|
||||
|
||||
getpath_defs="$(printf '%s\n' "$out" | awk -F '\t' '$2 == "cpython/Modules/getpath.c" { print $4; exit }')"
|
||||
case "$getpath_defs" in
|
||||
*'PREFIX=NULL'*'EXEC_PREFIX=NULL'*'VERSION=NULL'*'VPATH="..\\.."'*'PYDEBUGEXT=""'*'PLATLIBDIR="DLLs"'*)
|
||||
pass "frontier preserves getpath.c per-file defines with project-local substitutions"
|
||||
;;
|
||||
*)
|
||||
bad "frontier preserves getpath.c per-file defines with project-local substitutions (got: $getpath_defs)"
|
||||
;;
|
||||
esac
|
||||
|
||||
sysmodule_defs="$(printf '%s\n' "$out" | awk -F '\t' '$2 == "cpython/Python/sysmodule.c" { print $4; exit }')"
|
||||
case "$sysmodule_defs" in
|
||||
*'VPATH="..\\.."'*)
|
||||
pass "frontier preserves sysmodule.c VPATH per-file define"
|
||||
;;
|
||||
*)
|
||||
bad "frontier preserves sysmodule.c VPATH per-file define (got: $sysmodule_defs)"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Source the probe after --list-only so the guarded helper definitions can be
|
||||
# tested without launching Wine or requiring MSVC600.
|
||||
# shellcheck source=scripts/vc6-probe-pythoncore-frontier.sh
|
||||
source "$PROBE"
|
||||
rendered_cmd="$(render_compile_command_for_test 'VPATH="..\\.."' 'PYDEBUGEXT=""' 'PLATLIBDIR="DLLs"')"
|
||||
case "$rendered_cmd" in
|
||||
*' /D VPATH=\"..\\\\..\"'*' /D PYDEBUGEXT=\"\"'*' /D PLATLIBDIR=\"DLLs\"'*)
|
||||
pass "frontier renders quoted per-file string defines safely for CL response files"
|
||||
;;
|
||||
*)
|
||||
bad "frontier renders quoted per-file string defines safely for CL response files (got: $rendered_cmd)"
|
||||
;;
|
||||
esac
|
||||
|
||||
if printf '%s\n' "$out" | grep -q $'^skip-generated deepfreeze source\tcpython/Python/deepfreeze/deepfreeze.c\t'; then
|
||||
pass "frontier reports the generated deepfreeze source instead of compiling it blindly"
|
||||
else
|
||||
bad "frontier reports the generated deepfreeze source instead of compiling it blindly"
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$out" | grep -q $'^skip-external IncludeExternals-conditioned source\tcpython/Modules/zlibmodule.c\t'; then
|
||||
pass "frontier reports IncludeExternals-conditioned in-tree zlibmodule.c as external"
|
||||
else
|
||||
bad "frontier reports IncludeExternals-conditioned in-tree zlibmodule.c as external"
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$out" | grep -q $'^skip-external IncludeExternals-conditioned source\t$(zlibDir)/adler32.c\t'; then
|
||||
pass "frontier reports macro-based zlibDir sources as external without normalizing outside the repo"
|
||||
else
|
||||
bad "frontier reports macro-based zlibDir sources as external without normalizing outside the repo"
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$out" | cut -f2 | grep -q '\\'; then
|
||||
bad "frontier normalized source column contains no backslashes"
|
||||
else
|
||||
pass "frontier normalized source column contains no backslashes"
|
||||
fi
|
||||
|
||||
MSVC600_ROOT="${MSVC600_ROOT:-$REPO_ROOT/MSVC600}"
|
||||
if command -v wine >/dev/null 2>&1 && [ -e "$MSVC600_ROOT/VC98/Bin/CL.EXE" ]; then
|
||||
live_out="$($PROBE --limit 1 2>&1)"
|
||||
live_status=$?
|
||||
|
||||
if [ "$live_status" -ne 0 ]; then
|
||||
pass "frontier live run reports a nonzero first-blocker status for the current first source"
|
||||
else
|
||||
pass "frontier live run compiles the first supported source (exit 0)"
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$live_out" | grep -q '^compile: cpython/Modules/getpath.c'; then
|
||||
pass "frontier live run starts from pythoncore.vcxproj's first supported source"
|
||||
else
|
||||
bad "frontier live run starts from pythoncore.vcxproj's first supported source"
|
||||
echo "$live_out"
|
||||
fi
|
||||
|
||||
if [ "$live_status" -ne 0 ] && printf '%s\n' "$live_out" | grep -q 'first compile blocker: cpython/Modules/getpath.c'; then
|
||||
pass "frontier live run names the first actionable blocker"
|
||||
elif [ "$live_status" -eq 0 ]; then
|
||||
pass "frontier live run had no blocker in the first supported source"
|
||||
else
|
||||
bad "frontier live run names the first actionable blocker"
|
||||
echo "$live_out"
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$live_out" | grep -q "frozen_modules[/\\\\]getpath.h.*No such file or directory"; then
|
||||
bad "frontier live run should provision Python/frozen_modules/getpath.h before compiling getpath.c"
|
||||
echo "$live_out"
|
||||
elif [ -s "$REPO_ROOT/build/generated/cpython/Python/frozen_modules/getpath.h" ]; then
|
||||
pass "frontier live run provisions the generated getpath.h include under build/"
|
||||
else
|
||||
bad "frontier live run provisions the generated getpath.h include under build/"
|
||||
echo "$live_out"
|
||||
fi
|
||||
else
|
||||
echo "skip - wine/MSVC600 not available; skipping live frontier integration check"
|
||||
fi
|
||||
|
||||
if [ "$fail" -ne 0 ]; then
|
||||
echo "FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "ALL TESTS PASSED"
|
||||
Reference in New Issue
Block a user