Skip to content

Commit 8c5fa51

Browse files
Merge pull request #645 from marvin-hansen/main
Fixed miri tests
2 parents 4535544 + aee75a8 commit 8c5fa51

12 files changed

Lines changed: 68 additions & 26 deletions

File tree

deep_causality_num/tests/algebra/field_real_f64_tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ fn test_log10() {
8888
}
8989

9090
#[test]
91-
// Disabled under Miri: software-emulated floats produce different last-bit
92-
// results for transcendental ops, so exact equality cannot hold. The test
93-
// itself is correct and runs under normal CI.
94-
#[cfg_attr(miri, ignore)]
9591
fn test_powf() {
9692
let x = 2.0_f64;
9793
let n = 3.0_f64;

deep_causality_num/tests/algebra/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@
22
* SPDX-License-Identifier: MIT
33
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
44
*/
5+
6+
// Disabled under Miri: software-emulated floats produce different last-bit
7+
// results for transcendental ops, so exact equality cannot hold. The test
8+
// itself is correct and runs under normal CI.
59
#[cfg(test)]
10+
#[cfg(not(miri))]
611
mod algebra_tests;
712
#[cfg(test)]
813
mod domain_euclidean_tests;
14+
// Disabled under Miri: software-emulated floats produce different last-bit
15+
// results for transcendental ops, so exact equality cannot hold. The test
16+
// itself is correct and runs under normal CI.
917
#[cfg(test)]
18+
#[cfg(not(miri))]
1019
mod field_real_f32_tests;
20+
// Disabled under Miri: software-emulated floats produce different last-bit
21+
// results for transcendental ops, so exact equality cannot hold. The test
22+
// itself is correct and runs under normal CI.
1123
#[cfg(test)]
12-
mod field_real_f64_tests;
24+
#[cfg(not(miri))]
25+
pub(crate) mod field_real_f64_tests;
26+
// Disabled under Miri: software-emulated floats produce different last-bit
27+
// results for transcendental ops, so exact equality cannot hold. The test
28+
// itself is correct and runs under normal CI.
1329
#[cfg(test)]
30+
#[cfg(not(miri))]
1431
mod real_tests;

deep_causality_num/tests/float/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
* SPDX-License-Identifier: MIT
33
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
44
*/
5+
6+
// Disabled under Miri: software-emulated floats produce different last-bit
7+
// results for transcendental ops, so exact equality cannot hold. The test
8+
// itself is correct and runs under normal CI.
59
#[cfg(test)]
10+
#[cfg(not(miri))]
611
mod float_32_tests;
7-
// Skipped wholesale under Miri: this module exercises f64 floating-point
8-
// behavior, much of it via exact `assert_eq!` on transcendental results
9-
// (sin/cos/cbrt/atan2/...). Miri's soft-float emulation differs from hardware
10-
// in the last bit, so these comparisons spuriously fail one by one. The tests
11-
// are correct and pass under normal CI.
12-
#[cfg(all(test, not(miri)))]
12+
// Disabled under Miri: software-emulated floats produce different last-bit
13+
// results for transcendental ops, so exact equality cannot hold. The test
14+
// itself is correct and runs under normal CI.
15+
#[cfg(test)]
16+
#[cfg(not(miri))]
1317
mod float_64_tests;

deep_causality_num/tests/float_double/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ mod double_attributes_tests;
1414
mod double_comparison_tests;
1515
#[cfg(test)]
1616
mod double_display_tests;
17+
// Disabled under Miri: software-emulated floats produce different last-bit
18+
// results for transcendental ops, so exact equality cannot hold. The test
19+
// itself is correct and runs under normal CI.
1720
#[cfg(test)]
21+
#[cfg(not(miri))]
1822
mod double_erf_tests;
1923
#[cfg(test)]
2024
mod double_float_tests;
@@ -26,5 +30,9 @@ mod double_num_traits_tests;
2630
mod double_ops_tests;
2731
#[cfg(test)]
2832
mod double_traits_tests;
33+
// Disabled under Miri: software-emulated floats produce different last-bit
34+
// results for transcendental ops, so exact equality cannot hold. The test
35+
// itself is correct and runs under normal CI.
2936
#[cfg(test)]
37+
#[cfg(not(miri))]
3038
mod double_transcendental_tests;

deep_causality_physics/tests/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ rust_test_suite(
371371
],
372372
)
373373

374-
375-
376374
rust_test_suite(
377375
name = "theories",
378376
srcs = glob([

deep_causality_rand/tests/types/dist/normal/standard_normal_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use deep_causality_rand::types::distr::normal::standard_normal::StandardNormal;
88
macro_rules! standard_normal_tests {
99
($float_type:ty, $tolerance:expr) => {
1010
#[test]
11+
#[cfg_attr(miri, ignore)]
1112
fn test_mean_and_std_dev() {
1213
let mut rng = rng();
1314
let distr = StandardNormal;
@@ -91,6 +92,7 @@ mod f106_tests {
9192
use deep_causality_rand::rng;
9293

9394
#[test]
95+
#[cfg_attr(miri, ignore)]
9496
fn test_mean_and_std_dev() {
9597
let mut rng = rng();
9698
let distr = StandardNormal;

deep_causality_rand/tests/types/dist/uniform/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55

66
#[cfg(test)]
7+
#[cfg(not(miri))]
78
mod standard_uniform_tests;
89
#[cfg(test)]
10+
#[cfg(not(miri))]
911
mod uniform_tests;

deep_causality_rand/tests/utils/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
44
*/
55
#[cfg(test)]
6+
// Disabled under Miri: Miri's soft-float emulation drifts by ~1 ULP (got 0.9999999996 vs 1)
7+
#[cfg(not(miri))]
68
mod inverse_cdf_tests;
79
#[cfg(test)]
10+
// Disabled under Miri: Miri's soft-float emulation drifts by ~1 ULP (got 0.9999999996 vs 1)
11+
#[cfg(not(miri))]
812
mod sobol_tests;

deep_causality_uncertain/tests/types/sampler/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
44
*/
55
#[cfg(test)]
6+
// Disabled under Miri: Miri's soft-float emulation drifts by ~1 ULP (got 0.9999999996 vs 1)
7+
#[cfg(not(miri))]
68
mod qmc_sampler_tests;
79
#[cfg(test)]
810
mod sampler_seed_tests;
911
#[cfg(test)]
12+
// Disabled under Miri: Miri's soft-float emulation drifts by ~1 ULP (got 0.9999999996 vs 1)
13+
#[cfg(not(miri))]
1014
mod sequential_sampler_tests;

deep_causality_uncertain/tests/types/sampler/sequential_sampler_tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@ fn test_logical_op_errors() {
363363
}
364364

365365
#[test]
366-
// Disabled under Miri: the sampler evaluates `x.powi(2)` on f64, which under
367-
// Miri's soft-float emulation drifts by ~1 ULP (got 99.99999999999996 vs
368-
// 100.0). Test is correct under normal CI.
369-
#[cfg_attr(miri, ignore)]
370366
fn test_function_op_f64() {
371367
let sampler = SequentialSampler;
372368
let operand = create_node(UncertainNodeContent::Value(SampledValue::Float(10.0f64)));

0 commit comments

Comments
 (0)