Skip to content

Commit

Permalink
Restyled by prettier-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and hicklin committed Aug 19, 2024
1 parent 0c2650a commit 53225ef
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,17 +499,28 @@ Fabric admin for default controller:

## Automating manual steps

Some test plans have manual steps that require the tester to manually change the state of the DUT. To run these tests in a CI environment, specific example apps can be built such that these manual steps can be achieved by matter or named-pipe commands.
Some test plans have manual steps that require the tester to manually change the
state of the DUT. To run these tests in a CI environment, specific example apps
can be built such that these manual steps can be achieved by matter or
named-pipe commands.

In the case that all the manual steps in a test scricpt can be achieved just using matter commands, you can check if the `PICS_SDK_CI_ONLY` PICS is set to decide if the test script should send the required matter commands to perform the manual step.
In the case that all the manual steps in a test scricpt can be achieved just
using matter commands, you can check if the `PICS_SDK_CI_ONLY` PICS is set to
decide if the test script should send the required matter commands to perform
the manual step.

```python
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
```

In the case that a test script requires the use of name-pipe commands to achieve the manual steps, you can use the `write_to_app_pipe(command)` to send these commands. This command requires the test class to define a `self.app_pipe` string value with the name of the pipe. This depends on how the app is set up.
In the case that a test script requires the use of name-pipe commands to achieve
the manual steps, you can use the `write_to_app_pipe(command)` to send these
commands. This command requires the test class to define a `self.app_pipe`
string value with the name of the pipe. This depends on how the app is set up.

If the name of the pipe is dynamic and based on the app's PID, the following snippet can be added to the start of tests that use the `write_to_app_pipe` method.
If the name of the pipe is dynamic and based on the app's PID, the following
snippet can be added to the start of tests that use the `write_to_app_pipe`
method.

```python
app_pid = self.matter_test_config.app_pid
Expand All @@ -518,17 +529,27 @@ if app_pid != 0:
self.app_pipe = "/tmp/chip_<app name>_fifo_" + str(app_pid)
```

This requires the test to be executed with the `--app-pid` flag set if the manual steps should be executed by the script. This flag sets the process ID of the DUT's matter application.
This requires the test to be executed with the `--app-pid` flag set if the
manual steps should be executed by the script. This flag sets the process ID of
the DUT's matter application.

### Running on a separate machines

If the DUT and test script are running on different machines, the `write_to_app_pipe` method can send named-pipe commands to the DUT via ssh. This requires two additional environment variables:
- `LINUX_DUT_IP` sets the DUT's IP address
- `LINUX_DUT_UNAME` sets the DUT's ssh username. If not set, this is assumed to be `root`.
If the DUT and test script are running on different machines, the
`write_to_app_pipe` method can send named-pipe commands to the DUT via ssh. This
requires two additional environment variables:

- `LINUX_DUT_IP` sets the DUT's IP address
- `LINUX_DUT_UNAME` sets the DUT's ssh username. If not set, this is assumed
to be `root`.

The `write_to_app_pipe` also requires that ssh-keys are set up to access the DUT
from the machine running the test script without a password. You can follow
these steps to set this up:

The `write_to_app_pipe` also requires that ssh-keys are set up to access the DUT from the machine running the test script without a password. You can follow these steps to set this up:
1. If you do not have a key, create one using `ssh-keygen`.
2. Authorise this key on the remote host: run `ssh-copy-id user@ip` once, using your password.
2. Authorise this key on the remote host: run `ssh-copy-id user@ip` once, using
your password.
3. From now on `ssh user@ip` will no longer ask for your password.

## Other support utilities
Expand Down

0 comments on commit 53225ef

Please sign in to comment.