Skip to content

Commit

Permalink
chore: Fix unsoundness tests (#1643)
Browse files Browse the repository at this point in the history
A test was using the filesystem to check insta snapshots. This is not
supported by miri.

drive-by: Fix lint warning
drive-by: Don't send a slack notification when running the miri checks
manually on an arbitrary commit.

CI run:
https://github.com/CQCL/hugr/actions/runs/11726988593
  • Loading branch information
aborgna-q authored Nov 8, 2024
1 parent 3a297d5 commit 5562c91
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unsoundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
notify-slack:
uses: CQCL/hugrverse-actions/.github/workflows/slack-notifier.yml@main
needs: miri
if: always() && needs.miri.result == 'failure'
if: always() && needs.miri.result == 'failure' && github.event_name == 'push'
with:
channel-id: 'C04SHCL4FKP'
slack-message: |
Expand Down
1 change: 1 addition & 0 deletions hugr-core/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ mod test {
#[case::dfg("dfg", simple_dfg_hugr(), false)]
#[case::cfg("cfg", simple_cfg_hugr(), false)]
#[case::unsupported_input("input", simple_input_node(), true)]
#[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri
fn hugr_to_package(#[case] test_name: &str, #[case] hugr: Hugr, #[case] errors: bool) {
match (&Package::from_hugr(hugr), errors) {
(Ok(package), false) => {
Expand Down
1 change: 1 addition & 0 deletions hugr-model/tests/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fn roundtrip(source: &str) -> String {
}

#[test]
#[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri
pub fn test_declarative_extensions() {
insta::assert_snapshot!(roundtrip(include_str!("fixtures/model-decl-exts.edn")))
}
2 changes: 1 addition & 1 deletion hugr-passes/src/nest_cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<T: Copy + Clone + PartialEq + Eq + Hash> EdgeDest<T> {
fn all_edges<'a, T: Copy + Clone + PartialEq + Eq + Hash + 'a>(
cfg: &'a impl CfgNodeMap<T>,
n: T,
) -> impl Iterator<Item = EdgeDest<T>> + '_ {
) -> impl Iterator<Item = EdgeDest<T>> + 'a {
let extra = if n == cfg.exit_node() {
vec![cfg.entry_node()]
} else {
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ coverage language="[rust|python]": (_run_lang language \
)

# Run unsoundness checks using miri
miri:
PROPTEST_DISABLE_FAILURE_PERSISTENCE=true MIRIFLAGS='-Zmiri-env-forward=PROPTEST_DISABLE_FAILURE_PERSISTENCE' cargo +nightly miri test
miri *TEST_ARGS:
PROPTEST_DISABLE_FAILURE_PERSISTENCE=true MIRIFLAGS='-Zmiri-env-forward=PROPTEST_DISABLE_FAILURE_PERSISTENCE' cargo +nightly miri test {{TEST_ARGS}}

# Update the HUGR schema.
update-schema:
Expand Down

0 comments on commit 5562c91

Please sign in to comment.