-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation: Structural changes #969
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
946d925
Documentation: Structural changes
adpaco-aws 91c3f92
Rename "Verification results" examples
adpaco-aws 7e2910d
Revert some changes
adpaco-aws c4a82bf
Add suggestions on usage
adpaco-aws e5e5148
Rename: "Limitations"->"Rust feature support"
adpaco-aws 52db3ae
Undo example path renaming to introduction
adpaco-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
# The Kani Rust Verifier | ||
|
||
- [Getting started with Kani](./getting-started.md) | ||
- [Getting started](./getting-started.md) | ||
- [Installation](./install-guide.md) | ||
- [Comparison with other tools](./tool-comparison.md) | ||
- [Kani on a single file](./kani-single-file.md) | ||
- [Kani on a package](./cargo-kani.md) | ||
- [Kani result types](./kani-result-types.md) | ||
- [Debugging failures]() | ||
- [Debugging non-termination]() | ||
- [Debugging coverage]() | ||
- [Usage](./usage.md) | ||
- [On a single file](./kani-single-file.md) | ||
- [On a package](./cargo-kani.md) | ||
- [Verification results](./verification-results.md) | ||
|
||
- [Kani tutorial](./kani-tutorial.md) | ||
- [First steps with Kani](./tutorial-first-steps.md) | ||
- [Tutorial](./kani-tutorial.md) | ||
- [First steps](./tutorial-first-steps.md) | ||
- [Failures that Kani can spot](./tutorial-kinds-of-failure.md) | ||
- [Loops, unwinding, and bounds](./tutorial-loops-unwinding.md) | ||
- [Creating non-deterministic variables](./tutorial-nondeterministic-variables.md) | ||
- [Loop unwinding](./tutorial-loop-unwinding.md) | ||
- [Nondeterministic variables](./tutorial-nondeterministic-variables.md) | ||
- [Where to start on real code](./tutorial-real-code.md) | ||
|
||
- [Kani developer documentation](./dev-documentation.md) | ||
- [Working with `RUSTC`](./rustc-hacks.md) | ||
- [Testing](./kani-testing.md) | ||
- [Book runner](./bookrunner.md) | ||
- [Developer documentation](dev-documentation.md) | ||
- [Command cheat sheets](./cheat-sheets.md) | ||
- [Working with `rustc`](./rustc-hacks.md) | ||
- [Testing](./testing.md) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I similarly don't think this page and nesting is adding anything here |
||
- [Regression testing](./kani-testing.md) | ||
- [Book runner](./bookrunner.md) | ||
|
||
- [Limitations](./limitations.md) | ||
- [Rust feature support](./rust-feature-support.md) | ||
- [Overrides](./overrides.md) | ||
|
||
--- | ||
|
||
[Comparison with other tools](./tool-comparison.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Kani developer documentation | ||
|
||
## Build command cheat sheet | ||
|
||
```bash | ||
# Build all packages in the repository | ||
cargo build | ||
``` | ||
|
||
```bash | ||
# Full regression suite (does not run bookrunner) | ||
./scripts/kani-regression.sh | ||
``` | ||
```bash | ||
# Delete regression test caches | ||
# Use build/x86_64-apple-darwin/tests for MacOs | ||
rm -r build/x86_64-unknown-linux-gnu/tests/ | ||
``` | ||
```bash | ||
# Test suite run (we can only run one at a time) | ||
# cargo run -p compiletest -- --suite ${suite} --mode ${mode} | ||
cargo run -p compiletest -- --suite kani --mode kani | ||
``` | ||
```bash | ||
# Book runner run | ||
./scripts/setup/install_bookrunner_deps.sh | ||
cargo run -p bookrunner | ||
``` | ||
```bash | ||
# Documentation build | ||
cd docs | ||
./build-docs.sh | ||
``` | ||
|
||
### Resolving development issues | ||
|
||
```bash | ||
# Error "'rustc' panicked at 'failed to lookup `SourceFile` in new context'" | ||
# or similar error? Clean kani-compiler build: | ||
cargo clean -p kani-compiler | ||
cargo build -p kani-compiler | ||
``` | ||
|
||
## Git command cheat sheet | ||
|
||
Kani follows the "squash and merge pull request" pattern. | ||
As a result, the "main commit message" will be the title of your pull request. | ||
The individual commit message bodies you commit during development will by default be a bulleted list in the squashed commit message body, but these are editable at merge time. | ||
So you don't have to worry about a series of "oops typo fix" messages while fixing up your pull request, these can be edited out of the final message when you click merge. | ||
|
||
```bash | ||
# Set up your git fork | ||
git remote add fork git@github.com:${USER}/kani.git | ||
``` | ||
```bash | ||
# Reset everything. Don't have any uncommitted changes! | ||
git clean -xffd | ||
git submodule foreach --recursive git clean -xffd | ||
git submodule update --init | ||
``` | ||
```bash | ||
# Done with that PR, time for a new one? | ||
git switch main | ||
git pull origin | ||
git submodule update --init | ||
cd src/kani-compiler | ||
cargo build | ||
``` | ||
```bash | ||
# Need to update local branch (e.g. for an open pull request?) | ||
git fetch origin | ||
git merge origin/main | ||
# Or rebase, but that requires a force push, | ||
# and because we squash and merge, an extra merge commit in a PR doesn't hurt. | ||
``` | ||
```bash | ||
# Checkout a pull request locally without the github cli | ||
git fetch origin pull/$ID/head:pr/$ID | ||
git switch pr/$ID | ||
``` | ||
```bash | ||
# Search only git-tracked files | ||
git grep codegen_panic | ||
``` | ||
```bash | ||
# See all commits that are part of Kani, not part of Rust | ||
git log --graph --oneline origin/upstream-rustc..origin/main | ||
``` | ||
```bash | ||
# See all files modified by Kani (compared to upstream Rust) | ||
git diff --stat origin/upstream-rustc..origin/main | ||
``` | ||
|
||
## Kani command cheat sheet | ||
|
||
These can help understand what Kani is generating or encountering on an example or test file: | ||
|
||
```bash | ||
# Enable `debug!` macro logging output when running Kani: | ||
kani --debug file.rs | ||
``` | ||
```bash | ||
# Keep CBMC Symbol Table and Goto-C output (.json and .goto) | ||
kani --keep-temps file.rs | ||
``` | ||
```bash | ||
# Generate "C code" from CBMC IR (.c) | ||
kani --gen-c file.rs | ||
``` | ||
|
||
## CBMC command cheat sheet | ||
|
||
```bash | ||
# See CBMC IR from a C file: | ||
goto-cc file.c -o file.out | ||
goto-instrument --print-internal-representation file.out | ||
# or (for json symbol table) | ||
cbmc --show-symbol-table --json-ui file.out | ||
# or (an alternative concise format) | ||
cbmc --show-goto-functions file.out | ||
``` | ||
```bash | ||
# Recover C from goto-c binary | ||
goto-instrument --dump-c file.out > file.gen.c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,8 @@ | ||
# Kani developer documentation | ||
# Developer documentation | ||
|
||
## Build command cheat sheet | ||
Kani is an open source project open to external contributions. | ||
|
||
```bash | ||
# Build all packages in the repository | ||
cargo build | ||
``` | ||
|
||
```bash | ||
# Full regression suite (does not run bookrunner) | ||
./scripts/kani-regression.sh | ||
``` | ||
```bash | ||
# Delete regression test caches | ||
# Use build/x86_64-apple-darwin/tests for MacOs | ||
rm -r build/x86_64-unknown-linux-gnu/tests/ | ||
``` | ||
```bash | ||
# Test suite run (we can only run one at a time) | ||
# cargo run -p compiletest -- --suite ${suite} --mode ${mode} | ||
cargo run -p compiletest -- --suite kani --mode kani | ||
``` | ||
```bash | ||
# Book runner run | ||
./scripts/setup/install_bookrunner_deps.sh | ||
cargo run -p bookrunner | ||
``` | ||
```bash | ||
# Documentation build | ||
cd docs | ||
./build-docs.sh | ||
``` | ||
|
||
### Resolving development issues | ||
|
||
```bash | ||
# Error "'rustc' panicked at 'failed to lookup `SourceFile` in new context'" | ||
# or similar error? Clean kani-compiler build: | ||
cargo clean -p kani-compiler | ||
cargo build -p kani-compiler | ||
``` | ||
|
||
## Git command cheat sheet | ||
|
||
Kani follows the "squash and merge pull request" pattern. | ||
As a result, the "main commit message" will be the title of your pull request. | ||
The individual commit message bodies you commit during development will by default be a bulleted list in the squashed commit message body, but these are editable at merge time. | ||
So you don't have to worry about a series of "oops typo fix" messages while fixing up your pull request, these can be edited out of the final message when you click merge. | ||
|
||
```bash | ||
# Set up your git fork | ||
git remote add fork git@github.com:${USER}/kani.git | ||
``` | ||
```bash | ||
# Reset everything. Don't have any uncommitted changes! | ||
git clean -xffd | ||
git submodule foreach --recursive git clean -xffd | ||
git submodule update --init | ||
``` | ||
```bash | ||
# Done with that PR, time for a new one? | ||
git switch main | ||
git pull origin | ||
git submodule update --init | ||
cd src/kani-compiler | ||
cargo build | ||
``` | ||
```bash | ||
# Need to update local branch (e.g. for an open pull request?) | ||
git fetch origin | ||
git merge origin/main | ||
# Or rebase, but that requires a force push, | ||
# and because we squash and merge, an extra merge commit in a PR doesn't hurt. | ||
``` | ||
```bash | ||
# Checkout a pull request locally without the github cli | ||
git fetch origin pull/$ID/head:pr/$ID | ||
git switch pr/$ID | ||
``` | ||
```bash | ||
# Search only git-tracked files | ||
git grep codegen_panic | ||
``` | ||
```bash | ||
# See all commits that are part of Kani, not part of Rust | ||
git log --graph --oneline origin/upstream-rustc..origin/main | ||
``` | ||
```bash | ||
# See all files modified by Kani (compared to upstream Rust) | ||
git diff --stat origin/upstream-rustc..origin/main | ||
``` | ||
|
||
## Kani command cheat sheet | ||
|
||
These can help understand what Kani is generating or encountering on an example or test file: | ||
|
||
```bash | ||
# Enable `debug!` macro logging output when running Kani: | ||
kani --debug file.rs | ||
``` | ||
```bash | ||
# Keep CBMC Symbol Table and Goto-C output (.json and .goto) | ||
kani --keep-temps file.rs | ||
``` | ||
```bash | ||
# Generate "C code" from CBMC IR (.c) | ||
kani --gen-c file.rs | ||
``` | ||
|
||
## CBMC command cheat sheet | ||
|
||
```bash | ||
# See CBMC IR from a C file: | ||
goto-cc file.c -o file.out | ||
goto-instrument --print-internal-representation file.out | ||
# or (for json symbol table) | ||
cbmc --show-symbol-table --json-ui file.out | ||
# or (an alternative concise format) | ||
cbmc --show-goto-functions file.out | ||
``` | ||
```bash | ||
# Recover C from goto-c binary | ||
goto-instrument --dump-c file.out > file.gen.c | ||
``` | ||
The easiest way to contribute is to [report any | ||
issue](https://github.com/model-checking/kani/issues/new/choose) you encounter | ||
while using the tool. If you want to contribute to its development, | ||
we recommend looking into [these issues](https://github.com/model-checking/kani/contribute). |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Overrides | ||
|
||
As explained in [Comparison with other | ||
tools](./tool-comparison.md#comparison-with-other-tools), Kani is based on a | ||
technique called model checking, which verifies a program without actually | ||
executing it. It does so through encoding the program and analyzing the encoded | ||
version. The encoding process often requires "modeling" some of the library | ||
functions to make them suitable for analysis. Typical examples of functionality | ||
that requires modeling are system calls and I/O operations. In some cases, Kani | ||
performs such encoding through overriding some of the definitions in the Rust | ||
standard library. The following table lists some of the symbols that Kani | ||
overrides and a description of their behavior compared to the `std` versions: | ||
|
||
Name | Description | | ||
--- | --- | | ||
`print`, `eprint`, `println`, and `eprintln` macros | Kani's version of these macros skips functionality that is not relevant for verification, e.g., string formatting and I/O operations | | ||
`assert`, `assert_eq`, and `assert_ne` macros | Kani overrides these macros in order to skip string formatting code, control the message that is displayed in the verification report for those asserts, and perform some instrumentation. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Testing | ||
|
||
Testing in Kani is carried out in multiple ways. There are at least | ||
two very good reasons to do it: | ||
1. **Software regression**: A regression is a type of bug | ||
that appears after a change is introduced where a feature that | ||
was previously working has unexpectedly stopped working. | ||
|
||
Regression testing allows one to prevent a software regression | ||
from happening by running a comprehensive set of working tests | ||
before any change is committed to the project. | ||
2. **Software metrics**: A metric is a measure of software | ||
characteristics which are quantitative and countable. Metrics are | ||
particularly valuable for project management purposes. | ||
|
||
We recommend reading our section on [Regression Testing](#regression-testing) | ||
if you are interested in Kani development. At present, we obtain metrics based | ||
on the [book runner](./bookrunner.md). |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for this page, or putting the below in a sublist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think splitting into subsections here (and in the next case) provides a much cleaner and organized look to our documentation. In my opinion, the previous version was a little "too flat", so adding subsections where we can may help with readability and navigation.