microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
.github/copilot-instructions.md
29lines · modecode
| 1 | This is a Rust based repository. Please follow these guidelines when contributing: |
| 2 | |
| 3 | ## Code Standards |
| 4 | |
| 5 | ### Required Before Each Commit |
| 6 | - Run `cargo xtask fmt --fix` before committing any changes to ensure proper code formatting. |
| 7 | - This will ensure all source code and generated pipeline files maintain consistent style and content. |
| 8 | - Cross-compile by targeting `x86_64` and `aarch64` processors, and Windows and Linux environments. |
| 9 | |
| 10 | ## Key Guidelines |
| 11 | 1. Follow Rust best practices and idiomatic patterns. |
| 12 | 2. Maintain existing code structure and organization. |
| 13 | 3. Write unit tests for new functionality. |
| 14 | 4. Document public APIs and complex logic. Suggest changes to the `Guide/` folder when appropriate. |
| 15 | |
| 16 | ## Domain-specific Guidelines |
| 17 | Both OpenVMM and OpenHCL processes data from untrusted sources. OpenHCL runs in a constrained environment. |
| 18 | |
| 19 | When possible: |
| 20 | 1. Avoid `unsafe` code. |
| 21 | 2. Avoid taking new external dependencies, or those that can significantly increase binary size. |
| 22 | |
| 23 | ## Testing |
| 24 | The OpenVMM project contains several types of tests. |
| 25 | - **Unit tests** are spread throughout crates, and are marked by a `#[cfg(test)]` code block. |
| 26 | - **VMM tests** are integration tests. These are found in the `vmm_tests` folder, and use the code in `petri` as a framework to help create Hyper-V and OpenVMM based VMs. |
| 27 | - **Fuzz tests** are nondeterminstic, and are used to ensure that the code does not panic across trust boundaries. |
| 28 | |
| 29 | Whenever possible, thoroughly test the code with unit tests. Add a test case to the VMM tests if there is an interesting integration point. |
| 30 | |