Skip to content

Commit

Permalink
docs: improve docs for hacking on mayastor
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Maisenbacher <[email protected]>
  • Loading branch information
MaisenbacherD committed Nov 25, 2024
1 parent 77310c8 commit 6632613
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ cargo build --release
```
**Want to run or hack on Mayastor?** _You need more configuration!_ See
[running][doc-running], then [testing][doc-testing].
[running][doc-run], then [testing][doc-test].
Whilst the nix develop will allow you to build mayastor exactly as the image build, it might not have all the necessary
components required for testing.
Expand Down
29 changes: 28 additions & 1 deletion doc/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ Mayastor's unit tests, integration tests, and documentation tests via the conven
Mayastor uses [spdk][spdk] which is quite senistive to threading. This means tests need to run one at a time:

```bash
cargo test -- --test-threads 1
cd io-engine
RUST_LOG=TRACE cargo test -- --test-threads 1 --nocapture
```

## Testing your own SPDK version
To test your custom SPDK version please refere to the [spdk-rs documentation](https://github.com/openebs/spdk-rs/blob/develop/README.md#custom-spdk)

## Running the end-to-end test suite

Mayastor does more complete, end-to-end testing testing with [`mocha`][mocha]. It requires some extra setup.
Expand All @@ -55,6 +59,29 @@ Then, to run the tests:
./node_modules/mocha/bin/mocha test_csi.js
```

## Using PCIe NVMe devices in cargo tests while developing

When developing new features, testing those with real PCIe devices in the process might come in handy.
In order to do so, the PCIe device first needs to be bound to the vfio driver:

```bash
sudo PCI_ALLOWED="<PCI-ADDRESS>" ./spdk-rs/spdk/scripts/setup.sh
```

The bdev name in the cargo test case can then follow the PCIe URI pattern:

```rust
static BDEVNAME1: &str = "pcie:///<PCI-ADDRESS>";
```

After testing the device may be rebound to the NVMe driver:

```bash
sudo PCI_ALLOWED="<PCI-ADDRESS>" ./spdk-rs/spdk/scripts/setup.sh reset
```

Please do not submit pull requests with active cargo test cases that require PCIe devices to be present.

[spdk]: https://spdk.io/
[doc-run]: ./run.md
[mocha]: https://mochajs.org/
Expand Down

0 comments on commit 6632613

Please sign in to comment.