- build_dos.sh: Linux-friendly cross-compile to DOS via OpenWatcom V2.
OpenWatcom's wmake on Linux can't apply the .c.obj implicit rule for
subdirectory paths, and Makefile.dos / Makefile.dos16 rely on DOS-
only commands like 'del'. Script invokes wcc / wcc386 directly,
tracks 16-bit vs 32-bit mode via a stamp file (auto-cleans on
switch), generates a wlink directive file (the brace-delimited file
list wouldn't survive shell quoting), and supports clean. The DOS
Makefiles still work on Windows / DOS hosts.
- tests/run_compiler_tests.sh: AOT compiler harness. For each .bas
in tests/programs/, compiles via gwbasic-compile -c, runs the
resulting executable, normalizes output and diffs against the
golden file from tests/expected/. Skip list covers chain/common
multi-file flows, hardware/timing-dependent programs, unnumbered
direct-mode programs (compiler requires line numbers), and
misc_stmts/run_file (interpreter-vs-compiler ON ERROR divergence).
Result: 56/56 pass.
- tests/run_dos_smoke.sh + dos_smoke.bas + expected: runs gwbasic16.exe
under DOSBox-X (flatpak) with a program that exercises arithmetic,
strings, control flow, GOSUB, FOR/NEXT, DATA/READ, DEF FN, OPEN/
PRINT#/CLOSE, and diffs against the interpreter's golden output.
Uses $HOME for the staging dir (DOSBox-X flatpak doesn't see /tmp).
- pkg/GWBASIC.LSM + pkg/build_pkg.sh: FreeDOS submission package.
Produces dist/gwbasic-<VERSION>.zip with the standard FreeDOS
layout (APPINFO/GWBASIC.LSM, BIN/GWBASIC.EXE, DOC/GWBASIC/{README,
CHANGES,LICENSE} with CRLF, SOURCE/GWBASIC/<full source>). Source
tree is filtered through git ls-files to exclude build artifacts.
- docs/Makefile: standard Sphinx Makefile so 'cd docs && make html'
works as documented in README.md.
- .github/workflows/ci.yml: split into two jobs. build-and-test now
also runs the compiler harness. New dos-cross-compile job caches
~/openwatcom-v2, downloads the OpenWatcom V2 snapshot if not
cached, builds both 16-bit and 32-bit DOS binaries, asserts size
bounds, and uploads them as artifacts.
- .gitignore: ignore .dos_build_mode (script's stamp), .link_dir/
(transient wlink directive dir), dist/ (package output).
61 lines
2.0 KiB
Bash
Executable File
61 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Run gwbasic16.exe under DOSBox-X with tests/dos_smoke.bas and compare
|
|
# output against the golden file generated from the Linux interpreter.
|
|
# Verifies the BIOS-rendered TUI doesn't crash and that core features
|
|
# (arithmetic, strings, control flow, GOSUB, FOR/NEXT, DATA/READ, DEF FN,
|
|
# file I/O via OPEN/PRINT#) all work in the 16-bit DOS build.
|
|
set -u
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
EXE="${PROJECT_DIR}/gwbasic16.exe"
|
|
SMOKE="${SCRIPT_DIR}/dos_smoke.bas"
|
|
EXPECTED="${SCRIPT_DIR}/expected/dos_smoke.expected"
|
|
DOSBOX_CONF="${SCRIPT_DIR}/dosbox-compat.conf"
|
|
|
|
if [ ! -f "$EXE" ]; then
|
|
echo "ERROR: $EXE not found. Run ./build_dos.sh 16 first." >&2
|
|
exit 1
|
|
fi
|
|
if ! flatpak list --app 2>/dev/null | grep -q com.dosbox_x.DOSBox-X; then
|
|
echo "ERROR: DOSBox-X flatpak not installed (com.dosbox_x.DOSBox-X)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# DOSBox-X (flatpak) can only access $HOME, not /tmp.
|
|
WORK=$(mktemp -d --tmpdir="$HOME" gw_dos_smoke.XXXXXX)
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
cp "$EXE" "$WORK/GWBASIC.EXE"
|
|
cp "$SMOKE" "$WORK/SMOKE.BAS"
|
|
sed -i 's/$/\r/' "$WORK/SMOKE.BAS"
|
|
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy \
|
|
timeout 30 flatpak run com.dosbox_x.DOSBox-X \
|
|
-conf "$DOSBOX_CONF" \
|
|
-c "MOUNT C $WORK" \
|
|
-c "C:" \
|
|
-c "GWBASIC.EXE SMOKE.BAS" \
|
|
-c "EXIT" \
|
|
>/dev/null 2>&1
|
|
|
|
if [ ! -f "$WORK/OUT.TXT" ]; then
|
|
echo "FAIL: gwbasic16.exe produced no OUT.TXT under DOSBox-X" >&2
|
|
exit 1
|
|
fi
|
|
|
|
actual=$(mktemp)
|
|
normalized_expected=$(mktemp)
|
|
trap 'rm -rf "$WORK" "$actual" "$normalized_expected"' EXIT
|
|
sed 's/\r//g; s/[[:space:]]*$//' "$WORK/OUT.TXT" | sed '/^$/d' > "$actual"
|
|
sed 's/\r//g; s/[[:space:]]*$//' "$EXPECTED" | sed '/^$/d' > "$normalized_expected"
|
|
|
|
if diff -q "$normalized_expected" "$actual" >/dev/null; then
|
|
echo "PASS: gwbasic16.exe smoke test matches golden output"
|
|
exit 0
|
|
else
|
|
echo "FAIL: gwbasic16.exe output differs from expected"
|
|
diff -u "$normalized_expected" "$actual" | head -40
|
|
exit 1
|
|
fi
|