Skip to content

Run install.ps1 behavior tests on Windows - #208

Merged
ysyneu merged 2 commits into
feat/skill-command-namefrom
fix/install-ps1-test
Oct 8, 2026
Merged

ysyneu merged 2 commits into
feat/skill-command-namefrom
fix/install-ps1-test

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

install.ps1 had no test that executes it; install.sh is covered by tests/install_sh_sudo_test.sh. This adds tests/install_ps1_test.ps1 and a windows-latest job in install-scripts.yml that runs it under Windows PowerShell 5.1 and PowerShell 7.

The test is hermetic: it go builds a stub flashduty-cli.exe per version (it prints its version; sleep keeps it running), zips it with a checksums.txt, and serves the archives through an Invoke-WebRequest function that shadows the cmdlet, so no network is used. Cases:

  • default name installs flashduty.exe
  • INSTALLED_NAME=fduty installs fduty.exe; INSTALLED_NAME=FDUTY.EXE installs FDUTY.exe
  • reinstall while the installed exe is running replaces it; the running process keeps going
  • reinstall while the moved-aside copy from the previous reinstall is still running
  • three installs in a row leave one moved-aside copy

The test found a bug: reinstalling while the copy moved aside by an earlier reinstall is still running failed with "Cannot create a file when that file already exists", because the exe was always moved to the fixed name <name>.exe.old, which a running process locks. install.ps1 now moves the exe aside under a unique <name>.exe.<guid>.old and deletes earlier copies that are no longer running.

The mirror job is unchanged.

🤖 Generated with Claude Code

ysyneu added 2 commits October 8, 2026 06:15
Builds stub release archives locally and serves them through an
Invoke-WebRequest stand-in, then checks the default name, INSTALLED_NAME
in either case, and reinstalling while the installed exe (or its
moved-aside copy) is running, under Windows PowerShell 5.1 and
PowerShell 7.
Each reinstall moved the existing exe to the fixed name <name>.exe.old.
If the copy moved aside by an earlier reinstall was still running, that
file could be neither deleted nor replaced, so the next reinstall failed
with "Cannot create a file when that file already exists". Move the
exe aside under a unique name instead and delete earlier copies that are
no longer running.
@ysyneu
ysyneu merged commit 7b3c005 into feat/skill-command-name Oct 8, 2026
15 checks passed
@ysyneu
ysyneu deleted the fix/install-ps1-test branch October 8, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant