A flat illustration of many kinds of windows overlapping on a sage background: a plain modern frame, a carved Gothic arch, an arched stained-glass window, a white double-hung sash, a diamond-paned leaded casement and a large dark-framed picture window

This week’s saw is a short one, and a little sideways. reva-fork Forth is heading for desktop installers on Linux, macOS and now Windows, the first step toward a Windows installer for my private CoSy fork. Testing that on a Windows VM in CI meant my regression tester, reg-rs, had to run on Windows first.

Resource Link
reg-rs reg-rs, TBT: its history
reva-fork reva-fork, Saw #16
The series Sharpen the Saw: every post
“Sharpen the Saw” The 7 Habits of Highly Effective People (Stephen Covey)
Comments Discord

Why Windows now

reva-fork runs Reva’s Forth unchanged on a small x86 virtual machine written in Rust, with CoSy on top (Saw #16). Its plan now has three steps for the desktop: CI on GitHub Actions that covers Windows, desktop installers, and tests of those installers. The choices so far: GitHub Actions, no paid code signing, and .deb and .rpm packages for Linux rather than an AppImage.

reva-fork’s gate, just check, runs its golden tests with reg-rs, and the Windows job has to run them too, in Git Bash. I had only used reg-rs on Linux and macOS, and it did not build on Windows.

Three small changes

A brass padlockA brass padlock File locking. reg-rs locks its SQLite database while it records results. The crate it used compiled Unix-only C (fcntl), and it also pulled in an old nix that no longer builds on macOS against the current libc. Rust’s standard library has had File::lock since 1.89, so the crate is gone.

A chrome stopwatchA chrome stopwatch Timeouts. A test that runs too long was stopped with kill -9, which Windows does not have. Now the wait loop polls try_wait and stops the command with Child::kill, and a new test checks that a timed-out command really stops.

A stack of three silver disks, the top one marked SQL, the usual symbol for a databaseA stack of three silver disks, the top one marked SQL, the usual symbol for a database SQLite. Windows has no system SQLite to link against, so on Windows rusqlite compiles it in (its bundled feature).

Test commands still run through sh -c on every OS; on Windows that is Git Bash’s sh, so existing test scripts keep working. A new GitHub Actions workflow runs the full build (format, clippy, tests, build of every component) on Ubuntu, macOS and Windows. Rust 1.100’s new clippy lints got fixed along the way.

The first Windows runs found a few more things, which is the point of running them. Usage text said reg-rs.exe. The default data directory needed USERPROFILE when HOME is unset. A test path like subdir/foo came back as subdir\foo.rgt. And bash on a Windows PATH can be the launcher for WSL, the Windows Subsystem for Linux, rather than Git Bash. All of them are fixed, and the workflow is green on all three systems.

Closing

This change enables porting more of my work to Windows. Most of my tools are Rust, and reg-rs is how I test them, so with it running on a Windows CI runner, any of my projects can add Windows to its checks and see what breaks before anyone installs it.