Add DOS build script, compiler/DOS test harnesses, FreeDOS package, CI
- 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).
This commit is contained in:
@@ -24,5 +24,60 @@ jobs:
|
||||
cmake ..
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Test
|
||||
- name: Interpreter tests
|
||||
run: bash tests/run_tests.sh
|
||||
|
||||
- name: Compiler tests
|
||||
run: bash tests/run_compiler_tests.sh
|
||||
|
||||
dos-cross-compile:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache OpenWatcom V2
|
||||
id: cache-watcom
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/openwatcom-v2
|
||||
key: openwatcom-v2-snapshot
|
||||
|
||||
- name: Install OpenWatcom V2
|
||||
if: steps.cache-watcom.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p ~/openwatcom-v2
|
||||
curl -L -o /tmp/ow-snapshot.tar.xz \
|
||||
https://github.com/open-watcom/open-watcom-v2/releases/download/Last-CI-build/ow-snapshot.tar.xz
|
||||
tar -xJf /tmp/ow-snapshot.tar.xz -C ~/openwatcom-v2
|
||||
rm -f /tmp/ow-snapshot.tar.xz
|
||||
|
||||
- name: Build 16-bit DOS target
|
||||
run: ./build_dos.sh 16
|
||||
|
||||
- name: Build 32-bit DOS target
|
||||
run: |
|
||||
./build_dos.sh clean
|
||||
./build_dos.sh 32
|
||||
|
||||
- name: Verify binary sizes look sane
|
||||
run: |
|
||||
test -f gwbasic.exe
|
||||
# 32-bit LE executable; should be a few hundred KB
|
||||
size=$(stat -c%s gwbasic.exe)
|
||||
echo "gwbasic.exe = $size bytes"
|
||||
[ "$size" -gt 100000 ] && [ "$size" -lt 500000 ]
|
||||
# Rebuild 16-bit too for the artifact upload
|
||||
./build_dos.sh clean
|
||||
./build_dos.sh 16
|
||||
test -f gwbasic16.exe
|
||||
size16=$(stat -c%s gwbasic16.exe)
|
||||
echo "gwbasic16.exe = $size16 bytes"
|
||||
[ "$size16" -gt 80000 ] && [ "$size16" -lt 200000 ]
|
||||
|
||||
- name: Upload DOS artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dos-binaries
|
||||
path: |
|
||||
gwbasic16.exe
|
||||
gwbasic.exe
|
||||
|
||||
Reference in New Issue
Block a user