forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 66
399 lines (365 loc) · 16.3 KB
/
kani.yml
File metadata and controls
399 lines (365 loc) · 16.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
name: Kani
on:
workflow_dispatch:
merge_group:
pull_request:
branches: [ main ]
push:
paths:
- 'library/**'
- '.github/workflows/kani.yml'
- 'scripts/run-kani.sh'
defaults:
run:
shell: bash
jobs:
check-kani-on-std:
name: Verify std library (partition ${{ matrix.partition }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
partition: [1, 2, 3, 4]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: false
env:
# Define the index of this particular worker [1-WORKER_TOTAL]
WORKER_INDEX: ${{ matrix.partition }}
# Total number of workers running this step
WORKER_TOTAL: 4
steps:
- name: Remove unnecessary software to free up disk space
if: matrix.os == 'ubuntu-latest'
run: |
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
df -h
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: head
submodules: true
# Step 2: Install jq
- name: Install jq
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y jq
# Step 3: Run Kani on the std library (default configuration)
- name: Run Kani Verification
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
kani_autoharness:
name: Verify std library using autoharness
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: false
steps:
- name: Remove unnecessary software to free up disk space
if: matrix.os == 'ubuntu-latest'
run: |
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
df -h
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
# Step 2: Run Kani autoharness on the std library for selected functions.
# Uses "--include-pattern" to make sure we do not try to run across all
# possible functions as that may take a lot longer than expected. Instead,
# explicitly list all functions (or prefixes thereof) the proofs of which
# are known to pass.
# Notes:
# - core_arch::x86::__m128d::as_f64x2 is just one example of hundreds of
# core_arch::x86:: functions that are known to verify successfully.
- name: Run Kani Verification
run: |
scripts/run-kani.sh --run autoharness --kani-args \
--include-pattern "<(.+)[[:space:]]as[[:space:]](.+)>::disjoint_bitor" \
--include-pattern "<(.+)[[:space:]]as[[:space:]](.+)>::unchecked_disjoint_bitor" \
--include-pattern "<(.+)[[:space:]]as[[:space:]]iter::range::Step>::backward_unchecked" \
--include-pattern "<(.+)[[:space:]]as[[:space:]]iter::range::Step>::forward_unchecked" \
--include-pattern alloc::__default_lib_allocator:: \
--include-pattern alloc::layout::Layout::from_size_align \
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
--include-pattern char::convert::from_u32_unchecked \
--include-pattern core_arch::x86::__m128d::as_f64x2 \
--include-pattern "convert::num::<impl.convert::From<num::nonzero::NonZero<" \
--include-pattern "num::<impl.i8>::unchecked_add" \
--include-pattern "num::<impl.i16>::unchecked_add" \
--include-pattern "num::<impl.i32>::unchecked_add" \
--include-pattern "num::<impl.i64>::unchecked_add" \
--include-pattern "num::<impl.i128>::unchecked_add" \
--include-pattern "num::<impl.isize>::unchecked_add" \
--include-pattern "num::<impl.u8>::unchecked_add" \
--include-pattern "num::<impl.u16>::unchecked_add" \
--include-pattern "num::<impl.u32>::unchecked_add" \
--include-pattern "num::<impl.u64>::unchecked_add" \
--include-pattern "num::<impl.u128>::unchecked_add" \
--include-pattern "num::<impl.usize>::unchecked_add" \
--include-pattern "num::<impl.i8>::unchecked_neg" \
--include-pattern "num::<impl.i16>::unchecked_neg" \
--include-pattern "num::<impl.i32>::unchecked_neg" \
--include-pattern "num::<impl.i64>::unchecked_neg" \
--include-pattern "num::<impl.i128>::unchecked_neg" \
--include-pattern "num::<impl.isize>::unchecked_neg" \
--include-pattern "num::<impl.i8>::unchecked_sh" \
--include-pattern "num::<impl.i16>::unchecked_sh" \
--include-pattern "num::<impl.i32>::unchecked_sh" \
--include-pattern "num::<impl.i64>::unchecked_sh" \
--include-pattern "num::<impl.i128>::unchecked_sh" \
--include-pattern "num::<impl.isize>::unchecked_sh" \
--include-pattern "num::<impl.u8>::unchecked_sh" \
--include-pattern "num::<impl.u16>::unchecked_sh" \
--include-pattern "num::<impl.u32>::unchecked_sh" \
--include-pattern "num::<impl.u64>::unchecked_sh" \
--include-pattern "num::<impl.u128>::unchecked_sh" \
--include-pattern "num::<impl.usize>::unchecked_sh" \
--include-pattern "num::<impl.i8>::unchecked_sub" \
--include-pattern "num::<impl.i16>::unchecked_sub" \
--include-pattern "num::<impl.i32>::unchecked_sub" \
--include-pattern "num::<impl.i64>::unchecked_sub" \
--include-pattern "num::<impl.i128>::unchecked_sub" \
--include-pattern "num::<impl.isize>::unchecked_sub" \
--include-pattern "num::<impl.u8>::unchecked_sub" \
--include-pattern "num::<impl.u16>::unchecked_sub" \
--include-pattern "num::<impl.u32>::unchecked_sub" \
--include-pattern "num::<impl.u64>::unchecked_sub" \
--include-pattern "num::<impl.u128>::unchecked_sub" \
--include-pattern "num::<impl.usize>::unchecked_sub" \
--include-pattern "num::<impl.i8>::wrapping_sh" \
--include-pattern "num::<impl.i16>::wrapping_sh" \
--include-pattern "num::<impl.i32>::wrapping_sh" \
--include-pattern "num::<impl.i64>::wrapping_sh" \
--include-pattern "num::<impl.i128>::wrapping_sh" \
--include-pattern "num::<impl.isize>::wrapping_sh" \
--include-pattern "num::<impl.u8>::wrapping_sh" \
--include-pattern "num::<impl.u16>::wrapping_sh" \
--include-pattern "num::<impl.u32>::wrapping_sh" \
--include-pattern "num::<impl.u64>::wrapping_sh" \
--include-pattern "num::<impl.u128>::wrapping_sh" \
--include-pattern "num::<impl.usize>::wrapping_sh" \
--include-pattern "num::nonzero::NonZero::<i8>::count_ones" \
--include-pattern "num::nonzero::NonZero::<i16>::count_ones" \
--include-pattern "num::nonzero::NonZero::<i32>::count_ones" \
--include-pattern "num::nonzero::NonZero::<i64>::count_ones" \
--include-pattern "num::nonzero::NonZero::<i128>::count_ones" \
--include-pattern "num::nonzero::NonZero::<isize>::count_ones" \
--include-pattern "num::nonzero::NonZero::<u8>::count_ones" \
--include-pattern "num::nonzero::NonZero::<u16>::count_ones" \
--include-pattern "num::nonzero::NonZero::<u32>::count_ones" \
--include-pattern "num::nonzero::NonZero::<u64>::count_ones" \
--include-pattern "num::nonzero::NonZero::<u128>::count_ones" \
--include-pattern "num::nonzero::NonZero::<usize>::count_ones" \
--include-pattern "num::nonzero::NonZero::<i8>::rotate_" \
--include-pattern "num::nonzero::NonZero::<i16>::rotate_" \
--include-pattern "num::nonzero::NonZero::<i32>::rotate_" \
--include-pattern "num::nonzero::NonZero::<i64>::rotate_" \
--include-pattern "num::nonzero::NonZero::<i128>::rotate_" \
--include-pattern "num::nonzero::NonZero::<isize>::rotate_" \
--include-pattern "num::nonzero::NonZero::<u8>::rotate_" \
--include-pattern "num::nonzero::NonZero::<u16>::rotate_" \
--include-pattern "num::nonzero::NonZero::<u32>::rotate_" \
--include-pattern "num::nonzero::NonZero::<u64>::rotate_" \
--include-pattern "num::nonzero::NonZero::<u128>::rotate_" \
--include-pattern "num::nonzero::NonZero::<usize>::rotate_" \
--include-pattern ptr::align_offset::mod_inv \
--include-pattern ptr::alignment::Alignment::as_nonzero \
--include-pattern ptr::alignment::Alignment::as_usize \
--include-pattern ptr::alignment::Alignment::log2 \
--include-pattern ptr::alignment::Alignment::mask \
--include-pattern ptr::alignment::Alignment::new \
--include-pattern ptr::alignment::Alignment::new_unchecked \
--include-pattern time::Duration::from_micros \
--include-pattern time::Duration::from_millis \
--include-pattern time::Duration::from_nanos \
--exclude-pattern time::Duration::from_nanos_u128 \
--include-pattern time::Duration::from_secs \
--exclude-pattern time::Duration::from_secs_f \
--include-pattern unicode::unicode_data::conversions::to_ \
--exclude-pattern ::precondition_check \
--harness-timeout 10m \
--default-unwind 1000 \
--jobs=3 --output-format=terse | tee autoharness-verification.log
gzip autoharness-verification.log
- name: Upload Autoharness Verification Log
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-autoharness-verification.log.gz
path: autoharness-verification.log.gz
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3
run_kani_metrics:
name: Kani Metrics
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: true
steps:
- name: Remove unnecessary software to free up disk space
if: matrix.os == 'ubuntu-latest'
run: |
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
df -h
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
# Step 2: Run list on the std library
- name: Run Kani Metrics
run: |
scripts/run-kani.sh --run metrics --with-autoharness
pushd /tmp/std_lib_analysis
tar czf results.tar.gz results
popd
- name: Upload kani-list.json
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-kani-list.json
path: kani-list.json
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3
- name: Upload scanner results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-results.tar.gz
path: /tmp/std_lib_analysis/results.tar.gz
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3
run-log-analysis:
name: Build JSON from logs
needs: [run_kani_metrics, kani_autoharness]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: false
- name: Download log
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-autoharness-verification.log.gz
- name: Download kani-list.json
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-kani-list.json
- name: Download scanner results
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-results.tar.gz
- name: Run log parser
run: |
gunzip autoharness-verification.log.gz
tar xzf results.tar.gz
python3 scripts/kani-std-analysis/log_parser.py \
--kani-list-file kani-list.json \
--analysis-results-dir results/ \
autoharness-verification.log \
-o results.json
- name: Upload JSON
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-results.json
path: results.json
if-no-files-found: error
run-kani-list:
name: Kani List
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary software to free up disk space
run: |
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
df -h
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: head
submodules: true
# Step 2: Run list on the std library
- name: Run Kani List
run: |
head/scripts/run-kani.sh --run list --with-autoharness --path ${{github.workspace}}/head
# remove duplicate white space to reduce file size (GitHub permits at
# most one 1MB)
ls -l ${{github.workspace}}/head/kani-list.md
perl -p -i -e 's/ +/ /g' ${{github.workspace}}/head/kani-list.md
ls -l ${{github.workspace}}/head/kani-list.md
# Step 3: Add output to job summary
- name: Add Kani List output to job summary
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const kaniOutput = fs.readFileSync('${{github.workspace}}/head/kani-list.md', 'utf8');
await core.summary
.addHeading('Kani List Output', 2)
.addRaw(kaniOutput, false)
.write();
run-autoharness-analyzer:
name: Kani Autoharness Analyzer
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
# Step 2: Run autoharness analyzer on the std library
- name: Run Autoharness Analyzer
run: scripts/run-kani.sh --run autoharness-analyzer
# Step 3: Add output to job summary
- name: Add Autoharness Analyzer output to job summary
run: |
pushd scripts/autoharness_analyzer
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
cat std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
cat std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
popd