Skip to content

Test batch/WSH (VBScript, JScript) lessons under Wine on Linux/macOS #5

Description

@darkn3rd

Motivation

While testing lessons/win_scripts/batch/run (a wrapper for running .cmd
lessons from git-bash/MSYS2/Cygwin), we noticed MSYS2 can hand .cmd/.bat
files straight to Windows' own CreateProcess, which auto-invokes cmd.exe
for you. That raised the question: could Wine provide the same kind of
bridge on real Linux/macOS, letting batch, wsh.vbscript, and
wsh.jscript run in CI (currently ubuntu-latest-only) and locally on
non-Windows machines, rather than being Windows-only?

Wine ships its own cmd.exe, cscript/wscript, and JScript/VBScript
engine implementations (jscript.dll/vbscript.dll) - built out because so
many real Windows installers depend on them - so this seems plausible
without heroics.

Proposed approach

  1. Manual smoke test first (before any harness work): run each lesson
    category under Wine by hand:

    wine cmd /c a00.output.cmd
    wine cscript //Nologo a00.output.vbs
    wine cscript //Nologo a00.output.js

    Confirm how much of the existing lesson set actually passes as-is.
    Batch is the safer bet; WSH is the bigger unknown since scripts commonly
    reach into the broader COM object model (WScript.Shell,
    FileSystemObject, WScript.Arguments/StdIn), and Wine's coverage of
    those peripheral objects is patchier than the language engines
    themselves.

  2. Harness changes (testbox/Script.rb) - native_unix? currently
    gates :cmd/:js/:vbs out entirely on real Linux/macOS (they're only
    ever expected to run under CommandShellScript/native Windows). Needs a
    real branch resolving to wine cmd/wine cscript instead of failing
    the "cannot find X on PATH" check, plus @@option/invocation_name
    adjustments since Wine changes the actual command line shape.

  3. CI wiring (.github/workflows/ci.yml) - add batch, wsh.vbscript,
    wsh.jscript matrix entries on ubuntu-latest, with an "install Wine if
    missing" step matching the existing pwsh/dash/bc pattern already
    used for powershell/posix/bash.

Open questions / risks

  • How complete is Wine's cmd.exe batch interpreter vs. real Windows for
    the constructs these lessons actually use (for, delayed expansion,
    goto)?
  • Does Wine's WSH/COM coverage extend far enough for the d0/n0-style
    lessons that read input or enumerate environment variables?
  • First-run Wine prefix initialization (Gecko/Mono prompts) needs to be
    handled non-interactively for CI.
  • Performance overhead per invocation, multiplied across ~48 lessons per
    language, in a CI job.

Out of scope for now

No harness/CI changes until the manual smoke test in step 1 confirms this
is worth building.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions