Skip to content

Commit 3d8ad5f

Browse files
adpaco-awstedinski
authored andcommitted
Generate and publish dashboard into documentation (rust-lang#505)
* Generate and publish dashboard into documentation * Add Litani deps & restrict workflow to 20.04 * Add setuptools * Final edits * Conform with rebase * Install script for litani deps * Add more docs for dashboard * Enable dash run in CI (to be removed) * Include dashboard deps script * Dashboard deps permissions * Uncomment workflow condition * Update README quickstart section * minor fix
1 parent 31acdb2 commit 3d8ad5f

File tree

6 files changed

+75
-16
lines changed

6 files changed

+75
-16
lines changed

.github/workflows/rmc.yml

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
- name: Install Rust toolchain
3030
run: ./scripts/setup/install_rustup.sh
3131

32+
- name: Install dashboard dependencies
33+
if: ${{ matrix.os == 'ubuntu-20.04' && github.event_name == 'push' && startsWith('refs/heads/main', github.ref) }}
34+
run: ./scripts/setup/install_dashboard_deps.sh
35+
3236
- name: Set config.toml file
3337
run: |
3438
./configure \
@@ -49,6 +53,10 @@ jobs:
4953
- name: Execute RMC regression
5054
run: ./scripts/rmc-regression.sh
5155

56+
- name: Generate RMC dashboard
57+
if: ${{ matrix.os == 'ubuntu-20.04' && github.event_name == 'push' && startsWith('refs/heads/main', github.ref) }}
58+
run: ./x.py run -i --stage 1 dashboard
59+
5260
# On one OS only, build the documentation, too.
5361
- name: Build Documentation
5462
if: ${{ matrix.os == 'ubuntu-20.04' }}

README.md

+7-15
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,28 @@ The Rust Model Checker (RMC) aims to be a bit-precise model-checker for Rust.
33

44
## Project Status
55
RMC is currently in the initial development phase.
6-
It **does not yet support all rust language features**.
6+
It **does not yet support all Rust language features**.
77
We are working to extend our support of language features.
88
If you encounter issues when using RMC we encourage you to
99
[report them to us](https://github.com/model-checking/rmc/issues/new/choose).
1010

1111
## Quickstart
1212

13-
1. Install all dependencies required for upstream-rust, as per the
14-
[README](UPSTREAM-README.md#building-on-a-unix-like-system).
13+
1. Install the dependencies needed for [`rustc`](https://github.com/rust-lang/rust),
14+
[CBMC](https://github.com/diffblue/cbmc) and
15+
[CBMC Viewer](https://github.com/awslabs/aws-viewer-for-cbmc/releases/latest).
1516

16-
1. Install CBMC.
17-
CBMC has prebuilt releases
18-
[available for major platforms](https://github.com/diffblue/cbmc/releases).
19-
RMC currently works with CBMC versions 5.26 or greater.
20-
If you want to build CBMC from source, follow
21-
[the cmake instructions from the CBMC repo](https://github.com/diffblue/cbmc/blob/develop/COMPILING.md#working-with-cmake).
22-
We recommend using `ninja` as the CBMC build system.
23-
24-
1. Install [CBMC Viewer](https://github.com/awslabs/aws-viewer-for-cbmc/releases/latest).
17+
The [RMC Installation Guide](https://model-checking.github.io/rmc/install-guide.html)
18+
shows how to quickly install them using our setup scripts.
2519

2620
1. Configure RMC.
2721
We recommend using the following options:
2822
```
2923
./configure \
30-
--debuginfo-level-rustc=2 \
3124
--enable-debug \
3225
--set=llvm.download-ci-llvm=true \
3326
--set=rust.debug-assertions-std=false \
34-
--set=rust.deny-warnings=false \
35-
--set=rust.incremental=true
27+
--set=rust.deny-warnings=false
3628
```
3729

3830
1. Build RMC

rmc-docs/build-docs.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,25 @@ if [ ! -x mdbook ]; then
1717
tar zxf $FILE
1818
fi
1919

20+
# Publish dashboard into our documentation
21+
RMC_DIR=$SCRIPT_DIR/..
22+
HTML_DIR=$RMC_DIR/build/output/latest/html/
23+
24+
if [ -d $HTML_DIR ]; then
25+
# Litani run is copied into `src` to avoid deletion by `mdbook`
26+
cp -r $HTML_DIR src/dashboard/
27+
# Remove unnecessary artifacts to save space
28+
rm -r src/dashboard/artifacts
29+
rm -r src/dashboard/run.json
30+
else
31+
echo "WARNING: Could not find the latest dashboard run."
32+
fi
33+
2034
# Build the book into ./book/
2135
mkdir -p book
2236
./mdbook build
2337
touch book/.nojekyll
2438

2539
# TODO: Test all the code examples from our documentation
26-
# TODO: Build the dashboard and publish into our documentation
2740

2841
echo "Finished documentation build successfully."

rmc-docs/src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
- [Loops, unwinding, and bounds](./tutorial-loops-unwinding.md)
1515

1616
- [RMC developer documentation]()
17+
18+
- [RMC dashboard](./dashboard.md)

rmc-docs/src/dashboard.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# RMC Dashboard
2+
3+
The [RMC Dashboard](./dashboard/index.html) is a testing tool based on [Compiletest](https://rustc-dev-guide.rust-lang.org/tests/intro.html) and [Litani](https://github.com/awslabs/aws-build-accumulator).
4+
5+
The purpose of the dashboard to show the level of support in RMC for all Rust features.
6+
To this end, we use Rust code snippet examples from the following general Rust documentation books:
7+
* The Rust Reference
8+
* The Rustonomicon
9+
* The Rust Unstable Book
10+
* Rust by Example
11+
12+
However, not all examples from these books are suited for verification.
13+
Because of that, we run three different types of jobs when generating the dashboard:
14+
* `check` jobs (`BUILD`): This check only uses the Rust front-end to detect if the example is valid Rust code.
15+
* `codegen` jobs (`TEST`): This check uses the Rust front-end and the RMC back-end to determine if we can generate GotoC code.
16+
* `verification` jobs (`REPORT`): This check uses all of above and CBMC to obtain a verification result.
17+
18+
Before running the above mentioned jobs, we pre-process the examples to:
19+
1. Set the expected output according to flags present in the code snippet.
20+
2. Add any required compiler/RMC flags (e.g., CBMC unwinding flags).
21+
3. Include custom assertions for verification (only in the case of `verification` jobs).
22+
23+
Finally, we run all jobs, collect their outputs and compare them against the expected outputs.
24+
25+
The [RMC Dashboard](./dashboard/index.html) displays a summary of the obtained results.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+
set -eu
6+
7+
# The RMC Dashboard is generated using [Litani](https://github.com/awslabs/aws-build-accumulator)
8+
9+
# Litani's dependencies:
10+
DEPS=(
11+
gnuplot # Not required but recommended
12+
graphviz
13+
)
14+
15+
PYTHON_DEPS=(
16+
jinja2
17+
)
18+
19+
python3 -m pip install "${PYTHON_DEPS[@]}"

0 commit comments

Comments
 (0)