# Functest Engine The functest engine runs JSON-driven functional tests against a Windows client VM with no HLK Studio required. It is designed for testing driver behavior independently of the full HLK/HCK certification pipeline. ## Running functest ``` ./bin/auto_hck [common options] functest [functest options] ``` ### Functest options | Option | Description | |---|---| | `-p`, `--platform ` | Platform name (maps to `lib/engines/hcktest/platforms/.json`) | | `-d`, `--drivers ` | Comma-separated driver short names (maps to `lib/engines/hcktest/drivers/.json`) | | `--driver-path ` | Host path to the driver package directory; required when drivers are configured, unless `--test-binaries-path` is used instead (see [Device-only testing](#device-only-testing) below) | | `--test-binaries-path ` | Host path to binaries the test needs (e.g. an installer); available to test steps as `@test_binaries_path@` | | `--category ` | Run a named test suite; `` is the suite name from `lib/engines/functest/tests/suites/.json` | | `--testcase ` | Comma-separated list of test case names to run (e.g. `driver_sign_check,balloon/balloon_service`) | | `--select-test-names ` | Path to a text file (one test name per line); only tests whose name appears in the file are kept | | `--reject-test-names ` | Path to a text file (one test name per line); tests whose name appears in the file are skipped. Overrides the suite's own `reject_test_names`, if any. | | `--manual` | Run tests normally, then pause before VM teardown and drop into an IRB shell for manual inspection | | `--auto-manual` | Same as `--manual`, but only pauses if any test failed or an exception occurred | | `--extensions ` | Comma-separated list of extension names to activate (e.g. `driver_verifier`); each maps to `lib/engines/hcktest/extensions/.json` | Exactly one of `--category` or `--testcase` is required. All common options (`--verbose`, `--config`, `--id`, etc.) apply as documented in [Home](Home.md). `--select-test-names`/`--reject-test-names` are the same flags used by the `hcktest` engine; the "test name" they match against is the test case identifier as written in `--testcase`/a suite's `tests` array (e.g. `balloon/balloon_service`), not the `name` field inside the test case's own JSON. ### Examples #### Run a test suite ```bash ./bin/auto_hck functest \ -p Win2025x64_gui \ -d Balloon \ --driver-path /path/to/balloon/driver \ --category balloon_driver_tests ``` #### Run individual test cases ```bash ./bin/auto_hck functest \ -p Win2025x64_gui \ -d Balloon \ --driver-path /path/to/balloon/driver \ --testcase driver_sign_check,driver_update ``` For test cases in subdirectories, use the relative path from `lib/engines/functest/tests/cases/` as the name: ```bash --testcase balloon/balloon_service,driver_sign_check ``` #### Narrow down a suite Given a suite with many tests, run only a subset of them, or skip a few, without editing the suite file or hand-listing everything via `--testcase`: ```bash ./bin/auto_hck functest \ -p Win2025x64_gui \ -d Balloon \ --driver-path /path/to/balloon/driver \ --category balloon_driver_tests \ --select-test-names /path/to/select_names.txt ``` ```bash ./bin/auto_hck functest \ -p Win2025x64_gui \ -d Balloon \ --driver-path /path/to/balloon/driver \ --category balloon_driver_tests \ --reject-test-names /path/to/reject_names.txt ``` Where each file contains one test name per line, e.g.: ``` balloon/balloon_service driver_update ``` ### Device-only testing Pass `--test-binaries-path ` without `--driver-path` to attach configured devices (`-d`) while skipping driver installation. The content of `--test-binaries-path` is uploaded to the client VM automatically (to `C:\AutoHCK\test_binaries`). The host path is exposed to test steps as `@test_binaries_path@`, and the uploaded guest path as `@test_binaries_dir@`. ```bash ./bin/auto_hck functest \ -p Win2025x64_gui \ -d Balloon \ --test-binaries-path /path/to/installer \ --testcase ``` | `--driver-path` | `--test-binaries-path` | Result | |---|---|---| | set | any | Normal driver installation | | nil | set | Driver installation skipped; devices still attached | | nil | nil | Error: `--driver-path is required when drivers are configured` | ## Directory Layout ``` lib/engines/functest/ functest.json Engine configuration tests/ suites/ Test suite definitions (*.json) cases/ Individual test cases (*/*.json or *.json) scripts/ Scripts used by guest_run_file (PowerShell) and host_run_file (shell) steps ``` ## Engine Configuration `lib/engines/functest/functest.json` controls engine-level defaults: | Field | Description | |---|---| | `name` | Engine identifier | | `description` | Human-readable description | | `test_definitions_path` | Root directory for test case and suite JSON files | | `default_timeout` | Default step timeout in seconds (used when a step does not specify `timeout`) | | `result_format` | Output formats for results (e.g. `["json", "junit"]`) | ## Extensions Extensions inject commands around test cases without modifying test case JSON files. They are stored in `lib/engines/hcktest/extensions/` and activated via `--extensions ` (comma-separated for multiple). Execution order per test: ``` extension pre_test_commands (e.g. enable DV + reboot) test pre_test_commands test_steps test cleanup extension post_test_commands (e.g. disable DV + reboot) ``` A failure in extension `pre_test_commands` marks the test failed. A failure in `post_test_commands` is logged as a warning only. ### Extension JSON format | Field | Description | |---|---| | `extra_software` | Packages to pre-install on the guest before any tests run | | `tests_config` | Array of per-test hook entries | Each `tests_config` entry: | Field | Description | |---|---| | `tests` | Regex patterns matched against the test case `name` field. Use `[".*"]` for all tests. | | `pre_test_commands` | Steps run before each matching test | | `post_test_commands` | Steps run after each matching test | > `tests` matches the `name` field inside the test case JSON, **not** the path used in a suite. A test at `balloon/balloon_service` has `name` = `balloon_service`. Multiple extensions can be listed with `--extensions EXT1,EXT2`. The order follows the CLI argument order — EXT1 pre commands run before EXT2 pre commands, and the same for post commands. ### Available extensions | Name | Description | |---|---| | `driver_verifier` | Enables Driver Verifier (standard flags) before each test and disables it after, with a reboot on each side. | --- ## Test Suite Format A suite is an ordered list of test case references, plus optional metadata. Suites are stored in `lib/engines/functest/tests/suites/`. ### Suite Fields | Field | Required | Description | |---|---|---| | `name` | Yes | Suite name; used in log output | | `description` | No | Human-readable description | | `test_system_ref` | No | Reference to an issue or ticket | | `tests` | Yes | Ordered list of test case names to execute | | `requirements.drivers` | No | Informational only — not enforced at runtime | | `requirements.platforms` | No | Informational only — not enforced at runtime | | `reject_test_names` | No | Test case names to always skip when running this suite. Ignored if `--reject-test-names` is passed on the CLI. | | `known_issues` | No | Test cases that are known to fail; see [Known Issues](#known-issues) below. | ### Example See [`lib/engines/functest/tests/suites/balloon_driver_tests.json`](../lib/engines/functest/tests/suites/balloon_driver_tests.json) for a full example. ```json { "name": "balloon_driver_tests", "description": "Driver qualification tests for balloon", "test_system_ref": "VIRT-250", "tests": [ "driver_sign_check", "balloon/balloon_service", "driver_update" ], "requirements": { "drivers": [ "Balloon" ], "platforms": [ "Win10x64", "Win2019x64" ] } } ``` ### Known Issues Some test cases are known to fail for reasons unrelated to the driver or feature under test. `known_issues` lets a suite declare these ahead of time: a failing test case that matches an entry is reported as **passed with errata** instead of a genuine failure, while still recording why. Each entry is checked against a test case only after that test case has actually failed — it never masks a step's failure while the test is running, it only changes how the final result is reported. | Field | Required | Description | |---|---|---| | `tests` | Yes | List of regexes matched against the test case `name` field (same matching style as extensions' `tests_config`). | | `platforms` | No | Platform names (e.g. `"Win2022x64"`) this known issue applies to. Empty (default) matches every platform. | | `reason` | Yes | Human-readable explanation of the known issue, shown in the JUnit/HTML reports. | > `tests` matches the `name` field inside the test case JSON, **not** the path used in a suite. A test at `balloon/balloon_service` has `name` = `balloon_service`. Granularity is per test case: a test case either matches a known issue or it doesn't. ```json "known_issues": [ { "tests": ["balloon_service"], "platforms": ["Win2022x64"], "reason": "Balloon service test - known failure on Win2022" } ] ``` ## Test Case Format A test case defines an ordered sequence of steps and optional cleanup steps. Cases are stored in `lib/engines/functest/tests/cases/`. ### Test Case Fields | Field | Required | Description | |---|---|---| | `name` | Yes | Machine identifier for the test; used in log output, result file names, and suite/CLI references | | `display_name` | No | Human-friendly label shown in HTML and JUnit reports instead of `name`. Falls back to `name` when omitted. | | `description` | No | Human-readable description | | `test_system_ref` | No | Reference to an issue or ticket | | `extra_software` | No | List of software packages to install on the guest before any tests run | | `pre_test_commands` | No | Steps run before test start; a failure aborts remaining steps | | `cycles` | No | Allow to repeat test_steps several times | | `test_steps` | Yes | Ordered array of step objects; a failure aborts remaining steps | | `cleanup` | No | Steps run after test completes (pass or fail); errors here do not change test status | | `clients` | No | Client ids (e.g. `[1, 2]`) this test case needs booted. Default: `[1]`. See [Multi-Client Support](#multi-client-support). | | `clean_boot` | No | If `true`, throw away the client's current VM state and boot fresh from the clean base image before running `test_steps`. Can't be used together with `boot_from_snapshot_tag`. Default: `false`. | | `boot_from_snapshot_tag` | No | Name of a snapshot tag saved earlier in the suite by another test's `save_snapshot_as`. Boots from that tag before running `test_steps`. Can't be used together with `clean_boot`. | | `save_snapshot_as` | No | After `test_steps` pass, save the VM's disk as a snapshot tag with this name, then reboot from it. Other tests can later boot from this tag using `boot_from_snapshot_tag`. | ### VM Snapshots `clean_boot`, `boot_from_snapshot_tag`, and `save_snapshot_as` let tests in a suite share VM state, so a later test can reuse what an earlier one set up instead of doing it again: | Order | Test | Field | Effect | |---|---|---|---| | 1 | `test_a` | `save_snapshot_as: "state_x"` | Runs as normal; if it passes, saves the VM's disk as tag `state_x`. | | 2 | `test_b` | `boot_from_snapshot_tag: "state_x"` | Boots from tag `state_x` instead of continuing from `test_a`. | | 3 | `test_c` | `boot_from_snapshot_tag: "state_x"` | Also boots from `state_x`, separately from `test_b`. | | 4 | `test_d` | `clean_boot: true` | Ignores all tags; boots from the clean base image. | | 5 | `test_e` | *(none)* | No change; just keeps using the VM as `test_d` left it. | A tag has to be created by an earlier test's `save_snapshot_as` before another test can use it with `boot_from_snapshot_tag`. Using a tag that doesn't exist yet fails the test with an error. Tag files (`*-snapshot-.qcow2` in the workspace directory) are never deleted automatically, whether the suite passes or fails. You can always boot from one later by hand to check the state it holds. ### Example See [`lib/engines/functest/tests/cases/driver_sign_check.json`](../lib/engines/functest/tests/cases/driver_sign_check.json) for a full example. ```json { "name": "driver_sign_check", "description": "Verify the installed driver .sys is digitally signed", "test_system_ref": "VIRT-200", "test_steps": [ ... ], "cleanup": [ ... ] } ``` ## Step Types > Each step object must have **exactly one** step-type field (`guest_run`, `guest_run_file`, `guest_reboot`, `host_run`, `host_run_file`, `files_action`, `files_transfer`, `qmp_command`, `qmp_wait_event`, `barrier`, `set_variable`, `parallel`). All other fields are optional modifiers. ### Common Step Fields | Field | Description | |---|---| | `desc` | Human-readable description; logged and shown in results. | | `timeout` | Step timeout in seconds; overrides the engine default of 300s. Not applicable to `files_action` or `files_transfer` steps — file transfers run without a timeout. | | `ignore_errors` | If `true`, a failure in this step does not abort the test. Useful for optional steps in `test_steps`. Default: `false`. | | `variables` | Maps `@placeholder@` strings to existing context variable names for extra substitution within this step. | | `capture_output` | Name of a variable to store the step's output in, e.g. `"capture_output": "driver_version"` makes it available as `@driver_version@` later. Supported by `guest_run`/`guest_run_file`, `host_run`/`host_run_file`, `qmp_command`, and `qmp_wait_event`. On a multi-client step, only the primary target's output is captured. | | `expected_output_contains` | The step fails if the output does not contain this string. Only for `guest_run`/`guest_run_file`/`host_run`/`host_run_file`. Checked against every client the step ran on. | | `expected_output_matches` | The step fails if the output does not match this regex. Only for `guest_run`/`guest_run_file`/`host_run`/`host_run_file`. Checked against every client the step ran on. | | `expected_output_matches_encoding` | Controls regex encoding options for `expected_output_matches`. Currently only `Regexp::NOENCODING` is supported (binary match). Do not set to use default encoding. | | `clients` | Client ids (e.g. `[2]`) this step targets. Applies to `guest_run`/`guest_run_file`, `guest_reboot`, `files_action`, `files_transfer`, `qmp_command`, `qmp_wait_event`; `host_run`/`host_run_file` always run once on the host regardless. Omitted/empty broadcasts to every client booted for the test case. See [Multi-Client Support](#multi-client-support). | --- ### `guest_run` Runs an inline command on the client VM via WinRM. ```json { "desc": "Stop balloon service", "guest_run": "Stop-Service BalloonService -Force; Write-Output 'done'", "expected_output_contains": "done", "timeout": 30 } ``` --- ### `guest_run_file` Reads a local script file and executes its content on the client VM. The path is relative to the AutoHCK root. AutoHCK prepends `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force` so the script can dot-source files already on the guest when the image policy is Restricted (for example Win10 x86). The override lasts only for that WinRM session; the guest policy is not changed. ```json { "desc": "Verify driver is signed", "guest_run_file": "lib/engines/functest/tests/scripts/verify_driver_signed.ps1", "expected_output_contains": "PASS:", "timeout": 60 } ``` --- ### `guest_reboot` Reboots the client VM and waits for it to come back online before proceeding. ```json { "desc": "Reboot to apply driver installation", "guest_reboot": true } ``` --- ### `host_run` Runs a command on the host machine running AutoHCK. The command runs with the workspace as its working directory, so relative paths resolve inside the workspace. Pass/fail is determined by the command's exit code (non-zero exit fails the step) or by `expected_output_contains`/`expected_output_matches` patterns. When `capture_output` is set, the command's output is stored in the named variable for later use. ```json { "desc": "Extract driver package on host", "host_run": "unzip /tmp/driver.zip -d /tmp/driver_extracted" } ``` --- ### `host_run_file` Reads a local script file and runs its content on the host machine running AutoHCK, the host-side equivalent of `guest_run_file`. The path is relative to the AutoHCK root. Like `host_run`, the script runs with the workspace as its working directory and pass/fail is determined by the exit code. Note: Only Bash scripts are supported; shebang lines are not honored. --- ### `files_action` Transfer files or directories between the host and the client VM. > **Note:** `files_action` steps run without a step-level timeout. The `timeout` field is ignored for this step type, as file transfers may take an indeterminate amount of time. ```json { "desc": "Upload driver package to VM", "files_action": [ { "local_path": "@driver_path@", "remote_path": "C:\\AutoHCK\\driver_pkg", "direction": "local-to-remote" } ] } ``` #### File Operation Fields | Field | Required | Description | |---|---|---| | `local_path` | Yes | Path to the file or directory on the host. | | `remote_path` | Yes | Path to the file or directory on the client VM. | | `direction` | No | `local-to-remote` to upload, `remote-to-local` to download. Default: `remote-to-local` | | `move` | No | If `true`, delete the source after transfer. Default: `false` (copy). | | `allow_missing` | No | If `true`, skip silently when the source does not exist. Default: `false` (raise error). | --- ### `files_transfer` Uploads a list of test files to `C:\AutoHCK`. This step type is allowed only in `pre_test_commands`. Each source keeps its basename, and AutoHCK removes the uploaded files automatically after the test cleanup and extension post-test commands run. An existing destination is overwritten so every test can stage its own required files. ```json { "desc": "Upload test scripts", "files_transfer": [ "lib/engines/functest/tests/scripts/check_driver_installed.ps1", "lib/engines/functest/tests/scripts/verify_driver_signed.ps1" ] } ``` Replacement tokens in each source path are expanded separately for every target client by the existing `files_action` upload implementation. Use paths relative to the AutoHCK root as shown above, or absolute host paths. With multiple clients, the files are uploaded to and automatically removed from every client targeted by the step. Cleanup failures are logged as warnings and do not change the test result. Use `files_action` instead when a test needs a custom destination, download, transfer during `test_steps`, or other explicit file-operation behavior. --- ### `qmp_command` Send a QEMU Monitor Protocol (QMP) command to the client VM at the hypervisor level. The JSON mirrors the QMP wire format exactly. ```json { "desc": "Balloon VM memory to 512 MB", "qmp_command": { "execute": "balloon", "arguments": { "value": 536870912 } } } ``` #### `qmp_command` Fields | Field | Required | Description | |---|---|---| | `execute` | Yes | QMP command name (e.g. `"balloon"`, `"query-balloon"`) | | `arguments` | No | Command arguments as a JSON object | --- ### `qmp_wait_event` Blocks until one of the given QEMU events is received from the client VM. `events` is a list of event names; this returns as soon as any one of them is seen — useful for devices that may emit one of several events depending on guest state: ```json { "desc": "Wait for balloon change event", "qmp_wait_event": { "events": ["BALLOON_CHANGE"], "timeout": 30 } } ``` ```json { "desc": "Wait for a guest crash event from the pvpanic device", "qmp_wait_event": { "events": ["GUEST_PANICKED", "GUEST_CRASHLOADED"], "timeout": 120 } } ``` #### `qmp_wait_event` Fields | Field | Required | Description | |---|---|---| | `events` | Yes | Array of QMP event names to wait for (e.g. `["BALLOON_CHANGE"]`); returns as soon as any one occurs | | `timeout` | No | Maximum seconds to wait. Defaults to the engine `default_timeout`. | > Use `capture_output` to record which event actually fired (the full event payload, including its `event` name, is captured) so a later step can branch on it. --- ### `barrier` A named synchronization point. It only logs the barrier name and does nothing else. --- ### `set_variable` Sets one or more context variables directly. Values support `@variable@` substitution. ```json { "desc": "Set hotplug disk number", "set_variable": { "disk_number": "2" } } ``` The variable is then available as `@disk_number@` in all subsequent steps. Overwriting an existing variable is allowed and logged. Multiple variables can be set in a single step: ```json { "desc": "Set test parameters", "set_variable": { "disk_number": "2", "bus_slot": "0x04" } } ``` --- ### `parallel` Runs two or more named branches at the same time, each one in its own thread. Inside a branch, its steps still run one after another, same as normal `test_steps`. The engine always waits for every branch to finish (or stop) before moving on to the next step. Here's an example with two branches, one on the host and one on the guest: ```json { "desc": "Say hello from host and guest at the same time", "parallel": { "branches": { "host_branch": [ { "desc": "Say hello from host", "host_run": "echo 'hello from host'" } ], "guest_branch": [ { "desc": "Say hello from guest", "guest_run": "Write-Output 'hello from guest'" } ] } } } ``` #### `parallel` Fields | Field | Required | Description | |---|---|---| | `branches` | Yes | An object mapping a branch name to its own ordered list of steps. Every branch runs at the same time as every other branch in the block. | | `fail_fast` | No | Default: `true`. If a branch fails, every other still-running branch is stopped too (a branch always finishes the step it's currently on first, then stops before starting its next one). Set to `false` to let every branch run to the end no matter what fails elsewhere. Either way, the `parallel` step only fails once every branch has stopped. | The step's own `timeout` (engine default if unset) is the deadline for the **whole block**, not just one branch — a branch's own steps still keep their own `timeout` inside that. If the deadline is hit, any branches still running are stopped right away and the step fails with a timeout error. #### Constraints These are checked before the test's own steps start running, so a bad `parallel` block always fails immediately with a clear error, instead of failing partway through a real run: - A `parallel` block needs at least two branches. - Every branch step must resolve to exactly one step type (same rule as any other step), and it must be one of the types allowed inside a parallel branch. - Two branches can't target the same client through the same interface. `guest_run`/`guest_run_file`/`files_action` use the WinRM interface, while `qmp_command`/`qmp_wait_event` use the QMP interface. Different interfaces can target the same client concurrently, so a WinRM branch and a QMP branch can operate on one guest at the same time. `host_run`/`host_run_file` don't target a client interface, so any number of branches can run those at once. - A branch can't contain another `parallel` step. No nesting. - A branch can't use `guest_reboot` or `set_variable`. Do these outside the `parallel` block instead. - `capture_output` names must be different across every branch in the block. Two branches capturing to the same name is almost always a mistake, so it's rejected up front instead of letting one silently overwrite the other. Reusing a name across sequential steps within the *same* branch is fine. - A `parallel` step can't also have another step-type field, like `guest_run`, on the same step object. #### Variable capture While a branch is running, its `capture_output` values are only visible to later steps in that same branch — other branches can't see them yet. When the block completes without timing out, captured variables from branches that did not fail are added to the shared test context and become available to every later step (this is safe because of the uniqueness rule above). Captures from a failed branch are discarded; if the whole block times out, no branch's captures are published. #### Result reporting In `functest_results.json`, a `parallel` step also gets a `branches` key showing what each branch did: ```json { "index": 3, "description": "Say hello from host and guest at the same time", "status": "passed", "branches": { "host_branch": { "status": "passed", "steps": [ { "index": 0, "description": "Say hello from host", "status": "passed", "start_time": "...", "end_time": "...", "duration": 0.05 } ] }, "guest_branch": { "status": "passed", "steps": [ { "index": 0, "description": "Say hello from guest", "status": "passed", "start_time": "...", "end_time": "...", "duration": 0.08 } ] } } } ``` A branch that `fail_fast` stopped early (because another branch failed first) gets `"status": "cancelled"` instead, with whatever steps it managed to run before stopping (possibly none). A branch still running when the whole block's own timeout expires gets `"status": "timeout"`, likewise with whatever steps it managed to finish first. --- ## Multi-Client Support A test case can declare multiple clients via its top-level `clients` field, and a step can target one of them via its own `clients` field. Both use plain client ids (`1`, `2`, ...), mapped by position to the platform JSON's `clients` map — id `1` is its 1st entry, `2` its 2nd, etc. That entry's `name` (`CL1`, etc.) is the actual VM. ```json { "name": "multi_client_example", "clients": [1, 2], "test_steps": [ { "desc": "Runs only on client 1", "clients": [1], "guest_run": "Write-Output 'hello from client 1'" }, { "desc": "Runs on every client booted for this test case", "guest_run": "Write-Output 'hello from everyone'" } ] } ``` - `clients` defaults to `[1]`, so existing single-client tests are unaffected. `FunctestEngine` boots the union of `clients` across every selected test, once, up front. - A step's `clients` must be a subset of its test case's `clients`, and each id's corresponding role (`"c"`) must be declared in the platform JSON — otherwise the step fails. - `capture_output` stores only the primary target's output; `expected_output_contains`/`expected_output_matches` are checked against every machine the step ran on. --- ## Variable Substitution Variables are substituted in `desc`, `guest_run`, `guest_run_file` (script body), `host_run`, `host_run_file` (script body), `local_path`, and `remote_path` fields using the `@variable_name@` syntax. ### Built-in Variables These are populated automatically from CLI arguments and driver configuration: | Variable | Description | |---|---| | `@driver_path@` | Local path to the driver package directory (`--driver-path` CLI option) | | `@driver_module@` | Driver module name derived from the INF filename (e.g. `balloon` from `balloon.inf`). Not set for `no-drv` drivers, which have no INF. | | `@driver_inf@` | INF filename of the driver (e.g. `balloon.inf`). Not set for `no-drv` drivers, which have no INF. | | `@driver_name@` | Full driver name as defined in the driver JSON configuration | | `@test_binaries_path@` | Local host path to test binaries content (`--test-binaries-path` CLI option); see [Device-only testing](#device-only-testing) | | `@test_binaries_dir@` | Guest path where `--test-binaries-path` content was uploaded (`C:\AutoHCK\test_binaries`) | | `@spare_pcie_root_port_N@` (`N` = `0`, `1`, ...) | Bus id of the Nth spare, empty `pcie-root-port` allocated at boot via `--pcie-spare-root-ports ` (e.g. `@spare_pcie_root_port_0@` → `root2.0`). The max value of `N` depends on QEMU | | `@client_id@` | Zero-padded client id (e.g. `01`, `02`). Varies per target machine in `guest_run`/`guest_run_file`/`files_action`. | ### Step-level Variable Overrides The `variables` field on any step maps additional `@placeholder@` strings to existing context variable names. This lets a generic command use a different `@alias@` name for a variable that was already set under a different name. In the example below, the command uses `@inf_file@` as a placeholder, which is remapped to the built-in context variable `driver_inf` (whose value is e.g. `balloon.inf`): ```json { "desc": "Install specific INF", "guest_run": "pnputil -i -a C:\\pkg\\@inf_file@", "variables": { "@inf_file@": "driver_inf" } } ``` ### Captured Output Variables Use `capture_output` to store a step's output into a named variable and reference it in later steps: ```json { "desc": "Get driver version", "guest_run": "(Get-Item C:\\Windows\\System32\\drivers\\@driver_module@.sys).VersionInfo.FileVersion", "capture_output": "driver_version" }, { "desc": "Log driver version", "host_run": "echo 'Driver version: @driver_version@'" } ``` --- ## Workspace Output The workspace is created at `/functest///`, where `` is `-` when drivers are specified, or `functest-` when no drivers are specified. The following files are written by functest: | File | Description | |---|---| | `functest_results.json` | Full structured results: total, passed, failed, per-test status, per-step status, durations, error messages | | `.log` | Full engine log (e.g. `Balloon-Win2025x64_gui.log` or `functest-Win2025x64_gui.log`) | | `junit.xml` | JUnit-format results | | `results.html` | HTML results report | | `results.yaml` | YAML results report | | `_minidumps.zip` | Minidump archive collected from `%SystemRoot%\Minidump` after each test; only created if dumps exist | The workspace also contains setup manager infrastructure files (`qemuhck.txt`, `pid`, `swtpm_*`, `uefi_*`, etc.). The engine exits `0` if all tests passed, `1` if any test failed.