Skip to content

Commit b8464d4

Browse files
authoredJun 9, 2024··
Add Rust tests and Kani workflow (rust-lang#9)
Create two new workflows: - Rust Tests: Run the Rust repository tests for the standard library. - Kani: Run `kani verify-std` to verify the standard library. Note that we don't have any harness yet to verify.

File tree

4 files changed

+135
-1
lines changed

4 files changed

+135
-1
lines changed
 

‎.github/workflows/book.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ on:
1111
pull_request:
1212
paths:
1313
- 'doc/**'
14+
- '.github/workflows/book.yml'
1415
push:
1516
paths:
1617
- 'doc/**'
18+
- '.github/workflows/book.yml'
1719

1820
jobs:
1921
build:
@@ -27,8 +29,9 @@ jobs:
2729
cargo install mdbook --version "^0.4" --locked
2830
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
2931
32+
# Removed --locked for now since it is broken due to old proc_macro feature.
3033
- name: Install linkchecker
31-
run: cargo install mdbook-linkcheck --version "^0.7" --locked
34+
run: cargo install mdbook-linkcheck --version "^0.7"
3235

3336
- name: Build Documentation
3437
run: mdbook build doc

‎.github/workflows/kani.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
# This workflow is responsible for verifying the standard library with Kani.
5+
6+
name: Kani
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
paths:
11+
- 'library/**'
12+
- '.github/workflows/kani.yml'
13+
push:
14+
paths:
15+
- 'library/**'
16+
- '.github/workflows/kani.yml'
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
build:
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
# Kani does not support windows.
28+
os: [ubuntu-latest, macos-latest]
29+
steps:
30+
- name: Checkout Library
31+
uses: actions/checkout@v4
32+
with:
33+
path: verify-rust-std
34+
submodules: true
35+
36+
# We currently build Kani from a branch that tracks a rustc version compatible with this library version.
37+
- name: Checkout `Kani`
38+
uses: actions/checkout@v4
39+
with:
40+
repository: model-checking/kani
41+
path: kani
42+
ref: features/verify-rust-std
43+
44+
- name: Build `Kani`
45+
working-directory: kani
46+
run: |
47+
cargo build-dev --release
48+
echo "$(pwd)/scripts" >> $GITHUB_PATH
49+
50+
- name: Run tests
51+
working-directory: verify-rust-std
52+
env:
53+
RUST_BACKTRACE: 1
54+
run: |
55+
kani verify-std -Z unstable-options ./library --target-dir "target"
56+

‎.github/workflows/rustc.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
# This workflow is responsible for building the standard library using the bootstrap script
5+
# and executing the Rust regression.
6+
7+
name: Rust Tests
8+
on:
9+
workflow_dispatch:
10+
pull_request:
11+
paths:
12+
- 'library/**'
13+
- 'rust-toolchain.toml'
14+
- '.github/workflows/rustc.yml'
15+
push:
16+
paths:
17+
- 'library/**'
18+
- 'rust-toolchain.toml'
19+
- '.github/workflows/rustc.yml'
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
jobs:
26+
build:
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
matrix:
30+
# Note windows-latest is currently failing.
31+
os: [ubuntu-latest, macos-latest]
32+
steps:
33+
- name: Checkout Library
34+
uses: actions/checkout@v4
35+
with:
36+
path: head
37+
38+
- name: Checkout `upstream/master`
39+
uses: actions/checkout@v4
40+
with:
41+
repository: rust-lang/rust
42+
path: upstream
43+
fetch-depth: 0
44+
submodules: true
45+
46+
# Run rustc twice in case the toolchain needs to be installed.
47+
# Retrieve the commit id from the `rustc --version`. Output looks like:
48+
# `rustc 1.80.0-nightly (84b40fc90 2024-05-27)`
49+
- name: Checkout matching commit
50+
run: |
51+
cd head
52+
rustc --version
53+
COMMIT_ID=$(rustc --version | sed -e "s/.*(\(.*\) .*/\1/")
54+
cd ../upstream
55+
git checkout ${COMMIT_ID}
56+
57+
- name: Copy Library
58+
run: |
59+
rm -rf upstream/library
60+
cp -r head/library upstream
61+
62+
- name: Run tests
63+
working-directory: upstream
64+
run: |
65+
./configure --set=llvm.download-ci-llvm=true
66+
./x test --stage 0 library/std

‎rust-toolchain.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
# This version should be updated whenever we update the version of the Rust
5+
# standard library we currently track.
6+
7+
[toolchain]
8+
channel = "nightly-2024-05-23"
9+
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

0 commit comments

Comments
 (0)
Please sign in to comment.