Skip to content

Commit 0d50118

Browse files
committed
Run tests under miri on CI
1 parent fafee7f commit 0d50118

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ jobs:
161161
run: python -m pip install flake8
162162
- name: run lint
163163
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib --select=E9,F63,F7,F82 --show-source --statistics
164+
miri:
165+
name: Run tests under miri
166+
runs-on: ubuntu-latest
167+
steps:
168+
- uses: actions/checkout@master
169+
- uses: actions-rs/toolchain@v1
170+
with:
171+
profile: minimal
172+
toolchain: nightly
173+
components: miri
174+
override: true
175+
- name: Run tests under miri
176+
# miri-ignore-leaks because the type-object circular reference means that there will always be
177+
# a memory leak, at least until we have proper cyclic gc
178+
run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test
164179

165180
wasm:
166181
name: Check the WASM package and demo

vm/src/builtins/dict.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ macro_rules! dict_iterator {
597597
let s = if let Some(_guard) = ReprGuard::enter(vm, zelf.as_object()) {
598598
let mut str_parts = vec![];
599599
for (key, value) in zelf.dict.clone() {
600-
let s = vm.to_repr(&$result_fn(vm, key, value))?;
600+
let s = vm.to_repr(&($result_fn)(vm, key, value))?;
601601
str_parts.push(s.borrow_value().to_owned());
602602
}
603603
format!("{}([{}])", $class_name, str_parts.join(", "))
@@ -694,7 +694,7 @@ macro_rules! dict_iterator {
694694
match zelf.dict.entries.next_entry(&mut position) {
695695
Some((key, value)) => {
696696
zelf.position.store(position);
697-
Ok($result_fn(vm, key, value))
697+
Ok(($result_fn)(vm, key, value))
698698
}
699699
None => Err(vm.new_stop_iteration()),
700700
}
@@ -743,7 +743,7 @@ macro_rules! dict_iterator {
743743
match zelf.dict.len().checked_sub(count) {
744744
Some(mut pos) => {
745745
let (key, value) = zelf.dict.entries.next_entry(&mut pos).unwrap();
746-
Ok($result_fn(vm, key, value))
746+
Ok(($result_fn)(vm, key, value))
747747
}
748748
None => {
749749
zelf.position.store(std::isize::MAX as usize);

vm/src/pyobjectrc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ pub(crate) fn init_type_hierarchy() -> (PyTypeRef, PyTypeRef) {
517517
mod tests {
518518
use super::*;
519519
#[test]
520-
fn test_type_initialization() {
520+
fn miri_test_type_initialization() {
521521
let _ = init_type_hierarchy();
522522
}
523523
}

0 commit comments

Comments
 (0)