#!/usr/bin/env bash # # Regression tests for the narrow VC6 compat/msvc600/stdint.h shim. # # Skipped (not failed) when Wine + MSVC600 are unavailable, matching the other # VC6 probe test scripts. The live check is compile-only: it verifies that the # fixture using representative uint8_t/uint32_t/uint64_t load/store/rotate # patterns (the exact subset cpython/Modules/_blake2/impl/blake2-impl.h uses) # reaches cl.exe exit 0, and that and can both be # included in the same translation unit without a duplicate-typedef error. # # Usage: scripts/vc6-probe-stdint.test.sh set -u REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" PROBE="$REPO_ROOT/scripts/vc6-probe-core.sh" fail=0 pass() { echo "ok - $1"; } bad() { echo "not ok - $1"; fail=1; } if grep -q 'include "inttypes.h"' "$REPO_ROOT/compat/msvc600/stdint.h" && \ grep -q 'defined(_MSC_VER).*1200\|_MSC_VER >= 1300' "$REPO_ROOT/compat/msvc600/stdint.h"; then pass "compat/msvc600/stdint.h is a VC6-scoped forward to inttypes.h" else bad "compat/msvc600/stdint.h is a VC6-scoped forward to inttypes.h" fi MSVC600_ROOT="${MSVC600_ROOT:-$REPO_ROOT/MSVC600}" if command -v wine >/dev/null 2>&1 && [ -e "$MSVC600_ROOT/VC98/Bin/CL.EXE" ]; then out="$($PROBE scripts/fixtures/vc6_stdint_smoke.c 2>&1)" status=$? if [ "$status" -eq 0 ]; then pass "stdint smoke fixture compiles under VC6 (exit 0)" else bad "stdint smoke fixture compiles under VC6 (exit $status)" echo "$out" fi if printf '%s' "$out" | grep -q "Cannot open include file: 'stdint.h'"; then bad "stdint smoke fixture does not regress to missing stdint.h" else pass "stdint smoke fixture does not regress to missing stdint.h" fi if printf '%s' "$out" | grep -qi 'error'; then bad "stdint smoke fixture: no compiler errors in output" else pass "stdint smoke fixture: no compiler errors in output" fi else echo "skip - wine/MSVC600 not available; skipping live stdint integration check" fi if [ "$fail" -ne 0 ]; then echo "FAILED" exit 1 fi echo "ALL TESTS PASSED"