Each PRG file's preprocessor instance was set up with only its OWN
directory on the include search path (`filepath.Dir(prgFile)`).
That worked for self-contained files but broke any multi-file
build where one PRG `#include`s a header that lives next to a
SIBLING PRG — the other file's directory wasn't on the path, so
the include silently failed and PP just skipped it ("// #include
\"FiveSqlDef.ch\" — not found (skipped)").
This was the root cause behind test_sql_standards's mass-failure
pattern. The test does
#include "FiveSqlDef.ch"
...
Assert( ..., h["columns"][1][1][1] == ND_FN .AND. ... )
`FiveSqlDef.ch` lives in `_FiveSql2/src/` (next to TSqlExecutor.prg
and friends), but the test source sits in `_FiveSql2/test/`.
Building with `./five build _FiveSql2/test/test_sql_standards.prg
_FiveSql2/src/*.prg` should resolve the header from a sibling
input file's directory — but only the test's own dir was searched,
so ND_FN / ND_LIT / ND_BIN / ND_UNI all stayed undefined and the
identifiers fell through to runtime memvar lookup, returning NIL.
Every assertion that compared against the constants therefore
silently failed (24 / 64 passing because non-constant assertions
still worked).
buildMultiPRGWithIncludes now seeds the user-include list with the
directory of every input PRG before handing off to buildMultiPRG.
A test under one directory can now resolve a `#include` that lives
next to a sibling source file in the same multi-file build.
Result: test_sql_standards goes from 24 / 64 to **64 / 64**. The
parser was already correct end-to-end — every SQL:2003-2023
construct it had been advertising actually worked; the test just
couldn't read the constants it was asserting against.
Wired test_sql_standards into the std.ch runner with a per-test
override so it picks up the FiveSql2 src files. Suite stands at
17/17.
Other gates green:
go test ./... : PASS
FiveSql2 SQL:1999 : 43/43
FiveSql2 standards : 64/64 (was 24/64)
Harbour compat : 56/56
std.ch suite : 17/17
FRB suite : 7/7
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
85 lines
2.2 KiB
Bash
Executable File
85 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# std.ch regression runner. Build each PRG against the current Five
|
|
# compiler (caller's PWD must be the repo root) and execute it; non-zero
|
|
# exit or "FAIL"/"NOT REJECTED" in stdout marks the run as failed.
|
|
#
|
|
# This deliberately runs in a temp scratch directory so the DBF/NTX
|
|
# artifacts don't collide with each other across tests.
|
|
set -e
|
|
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
FIVE="$ROOT/five"
|
|
if [ ! -x "$FIVE" ]; then
|
|
echo "five binary not found at $FIVE — run 'go build -o five ./cmd/five' first" >&2
|
|
exit 2
|
|
fi
|
|
|
|
TESTS=(
|
|
test_pp_stdch
|
|
test_count
|
|
test_sum_avg
|
|
test_sum_multi
|
|
test_copy
|
|
test_sort
|
|
test_list
|
|
test_list_to_file
|
|
test_total
|
|
test_join
|
|
test_update
|
|
test_set_deleted
|
|
test_unsupported
|
|
test_block_comma
|
|
test_compound_lhs
|
|
test_join_hash
|
|
test_sql_standards
|
|
)
|
|
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "$work"' EXIT
|
|
|
|
pass=0
|
|
fail=0
|
|
for name in "${TESTS[@]}"; do
|
|
src="$ROOT/tests/std_ch/${name}.prg"
|
|
# test_sql_standards lives in our suite but its `#include
|
|
# "FiveSqlDef.ch"` resolves only when the FiveSql2 src files
|
|
# are part of the same build (they sit alongside the .ch).
|
|
# Other tests build standalone.
|
|
extras=()
|
|
if [ "$name" = "test_sql_standards" ]; then
|
|
src="$ROOT/_FiveSql2/test/test_sql_standards.prg"
|
|
extras=( $ROOT/_FiveSql2/src/*.prg )
|
|
fi
|
|
bin="$work/${name}"
|
|
if ! "$FIVE" build "$src" "${extras[@]}" -o "$bin" >/dev/null 2>"$work/${name}.err"; then
|
|
echo "FAIL build $name"
|
|
cat "$work/${name}.err" | sed 's/^/ /'
|
|
fail=$((fail+1))
|
|
continue
|
|
fi
|
|
pushd "$work" >/dev/null
|
|
if ! out="$("$bin" 2>&1)"; then
|
|
echo "FAIL run $name"
|
|
echo "$out" | sed 's/^/ /'
|
|
fail=$((fail+1))
|
|
popd >/dev/null
|
|
continue
|
|
fi
|
|
popd >/dev/null
|
|
if echo "$out" | grep -qE 'FAIL|NOT REJECTED|expect.*got'; then
|
|
echo "FAIL assert $name"
|
|
echo "$out" | sed 's/^/ /'
|
|
fail=$((fail+1))
|
|
continue
|
|
fi
|
|
echo "PASS $name"
|
|
pass=$((pass+1))
|
|
done
|
|
|
|
echo
|
|
echo "================================================================"
|
|
echo " Results: $pass / $((pass+fail)) passed"
|
|
echo "================================================================"
|
|
[ $fail -eq 0 ]
|