Overriding DUT Pre/Post Stages
Override DUT-level pre-stage and post-stage operations for tests that require custom setup or teardown.
When to Use
- Test requires different firmware than other tests on the same DUT
- Specific hardware configuration needed for one test only
- Custom initialization that shouldn’t affect other tests
How It Works
Specify pre-stage or post-stage sections directly in your test file. These override the default stages defined in the DUT configuration (pre.yaml and post.yaml).
Example
# Custom Test Configuration
name: Custom Test
description: This test includes custom pre-stage and post-stage commands.
defaults:
transport: &transport
proto: ssh
options:
host: "[[attributes.Host]]"
user: root
password: root
pre-stage:
- cmd: dutctl
name: Shutdown the DUT.
parameters:
host: "[[attributes.Flasher]]"
command: power
args: ["off"]
- cmd: dutctl
name: Flash the firmware binary.
parameters:
host: "[[attributes.Flasher]]"
command: flash
args: [write, "[[input.Binary]]"]
- cmd: dutctl
name: Turn the DUT on
parameters:
host: "[[attributes.Flasher]]"
command: power
args: ["hardreset"]
options:
timeout: 2m
stages:
- name: Main Test Stage
steps:
- cmd: ping
name: Wait for SSH service
options:
timeout: 2m
parameters:
host: "[[attributes.Host]]"
- cmd: cmd
name: Run main test command
transport: *transport
parameters:
executable: echo
args: ["Hello World!"]
post-stage:
- cmd: dutctl
name: Clean up. Shutdown the DUT.
parameters:
host: "[[attributes.Flasher]]"
command: power
args: ["off"]