Skip to main content
This guide walks you through a complete test workflow — from verifying connectivity to running an automated Python script. By the end, you’ll have used the CLI interactively and written your first Lager test script.
This tutorial assumes you have completed the Getting Started guide: the CLI is installed, your box is added, and your instruments are configured with nets.

Part 1: CLI Walkthrough

Let’s step through a typical test flow using individual CLI commands. This is useful for ad-hoc testing, debugging, and getting familiar with your setup.

Step 1: Verify your box is online

Expected output:

Step 2: Check connected instruments

This shows all instruments the box can see. Confirm your power supply, debug probe, and any other instruments appear.

Step 3: View your configured nets

This shows the named nets you’ll use in subsequent commands. Note the net names — you’ll need them below.

Step 4: Set defaults to reduce typing

With defaults set, you can omit --box and net names from subsequent commands.

Step 5: Flash firmware

Expected output:

Step 6: Power on your device

Step 7: Take a measurement

Expected output:

Step 8: Power down

Always disable power supplies when you’re done testing.

Part 2: Your First Python Script

Now let’s convert the manual CLI steps into a repeatable Python script. The key advantage of a script is that it always cleans up after itself (disabling power) even if an error occurs. Create a file called my_first_test.py:
The try/finally block ensures the power supply is always disabled, even if the script encounters an error. This is important for protecting your hardware.

Part 3: Running It

Execute the script on your Lager Box:
Expected output:
If you need to send additional files along with your script (firmware binaries, config files), use --add-file:

What’s Next

You’ve completed your first test with Lager. Here are some directions to explore: For a more comprehensive automation example combining robot arm control, USB hub power cycling, debug probe flashing, and ADC measurement, see the demo script.