Request an invite
Docs menu

Run tests on several systems

Test one script on several systems at once, each in a throwaway clone, and get a JUnit report.

Requires OSMates Pro.

Run the matrix

You need a machine or template for each system you test, and a script for Linux and macOS. For Windows, also write a .ps1, .cmd, or .bat script.

To run both scripts on five machines:

sh
osmates matrix win11 ubuntu fedora macos-26 macos-15 --script test.sh --script test.ps1

Each machine gets a clone, which runs the script for its system. The clone is deleted afterwards, also when the script fails. A line shows each machine as it starts, moves on to the next step, and ends.

The command exits 0 when every script exited 0, and 1 otherwise. Scripts run as root, or LocalSystem on Windows. To run them as the account at the screen, add --desktop.

Copy files in and out

sh
osmates matrix ubuntu fedora --script test.sh --copy-in ./src --copy-out /tmp/results.xml

--copy-in ./src puts the folder beside the script, which runs in that folder. That's /tmp/ on Linux and macOS, and C:\Users\Public\ on Windows. To copy elsewhere, add the guest path: --copy-in ./src:/opt/src.

--copy-out copies a file or folder out of each clone after the script, also when it fails. A path without a folder, such as results.xml, is read beside the script.

Read the report

The matrix writes a new folder, matrix-<date>-<time>, in the current folder. To name another, add --to <folder>.

File What it holds
junit.xml A test suite for each machine and a test case for each step
<machine>/stdout.txt and <machine>/stderr.txt The script's whole output
<machine>/artifacts/ The files --copy-out copied

Point your CI server's JUnit report at junit.xml. The script's test case holds the last MiB of its output. A step that couldn't finish, such as a clone that didn't start, is an error. The steps after it are skipped.

For a program of your own, add --json. The command reference lists every option.

Parallel clones

  • Two macOS clones run at a time. A third waits for one to end.
  • Each clone takes its machine's memory. The matrix keeps 4 GiB for your Mac, and counts the machines already running.
  • The first clone always starts, whatever its size.
  • To run fewer at once, add --parallel 2.

Stop a matrix

Press Control-C. Each clone is deleted before the command ends, and machines that haven't started don't start. The report is still written, and the command exits 130.

Report a problem with this page