Skip to content

Conversation

FrancoGiachetta
Copy link
Contributor

@FrancoGiachetta FrancoGiachetta commented Sep 26, 2025

Move test utils to testing module

Closes #1409

Move testing utilities to utils/testing.rs.

Introduces Breaking Changes?

No.

These PRs should be merged after this one right away, in that order.

Checklist

  • Linked to Github Issue.
  • Unit tests added.
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.

Copy link

github-actions bot commented Sep 26, 2025

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 2.714 ± 0.022 2.680 2.742 1.04 ± 0.01
base dict_insert.cairo (AOT) 2.598 ± 0.018 2.571 2.631 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.541 ± 0.027 2.519 2.611 1.04 ± 0.01
head dict_insert.cairo (AOT) 2.454 ± 0.015 2.433 2.475 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 2.372 ± 0.021 2.341 2.399 1.05 ± 0.01
base dict_snapshot.cairo (AOT) 2.250 ± 0.020 2.224 2.274 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 2.263 ± 0.017 2.232 2.292 1.04 ± 0.03
head dict_snapshot.cairo (AOT) 2.175 ± 0.067 2.122 2.312 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.665 ± 0.019 2.638 2.697 1.01 ± 0.01
base factorial_2M.cairo (AOT) 2.650 ± 0.024 2.620 2.707 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.712 ± 0.043 2.659 2.789 1.02 ± 0.02
head factorial_2M.cairo (AOT) 2.651 ± 0.050 2.608 2.780 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 2.215 ± 0.020 2.182 2.238 1.00 ± 0.02
base fib_2M.cairo (AOT) 2.206 ± 0.040 2.149 2.276 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.214 ± 0.026 2.187 2.258 1.04 ± 0.02
head fib_2M.cairo (AOT) 2.129 ± 0.022 2.099 2.176 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 2.384 ± 0.024 2.333 2.422 1.06 ± 0.02
base linear_search.cairo (AOT) 2.253 ± 0.034 2.211 2.321 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 2.364 ± 0.034 2.322 2.427 1.07 ± 0.02
head linear_search.cairo (AOT) 2.208 ± 0.022 2.178 2.241 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 2.504 ± 0.038 2.451 2.567 1.09 ± 0.02
base logistic_map.cairo (AOT) 2.291 ± 0.021 2.263 2.343 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.448 ± 0.015 2.432 2.480 1.07 ± 0.02
head logistic_map.cairo (AOT) 2.292 ± 0.030 2.244 2.343 1.00

Copy link

github-actions bot commented Sep 26, 2025

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.799 ± 0.047 10.709 10.875 4.39 ± 0.05
cairo-native (embedded AOT) 2.461 ± 0.024 2.421 2.486 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.528 ± 0.020 2.502 2.570 1.03 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 522.8 ± 6.5 514.1 535.0 1.00
cairo-native (embedded AOT) 2154.6 ± 51.1 2112.5 2279.5 4.12 ± 0.11
cairo-native (embedded JIT using LLVM's ORC Engine) 2269.2 ± 21.0 2232.6 2306.2 4.34 ± 0.07

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.748 ± 0.016 4.728 4.780 1.85 ± 0.02
cairo-native (embedded AOT) 2.568 ± 0.021 2.541 2.615 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.602 ± 0.023 2.575 2.648 1.01 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.683 ± 0.013 4.662 4.700 2.23 ± 0.02
cairo-native (embedded AOT) 2.100 ± 0.021 2.068 2.134 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.145 ± 0.010 2.127 2.163 1.02 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 565.8 ± 5.5 557.0 573.2 1.00
cairo-native (embedded AOT) 2185.4 ± 12.1 2158.5 2196.8 3.86 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 2349.3 ± 28.8 2321.3 2419.3 4.15 ± 0.07

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 379.2 ± 1.5 376.9 381.7 1.00
cairo-native (embedded AOT) 2256.3 ± 15.5 2230.0 2275.5 5.95 ± 0.05
cairo-native (embedded JIT using LLVM's ORC Engine) 2434.4 ± 19.7 2404.6 2468.4 6.42 ± 0.06

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (6f1954d) to head (9594ad2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1422      +/-   ##
==========================================
- Coverage   81.30%   81.30%   -0.01%     
==========================================
  Files         105      105              
  Lines       25741    25738       -3     
==========================================
- Hits        20929    20926       -3     
  Misses       4812     4812              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 239 to 247
// ==============================
// == TESTS: get_integer_layout
// ==============================
/// Ensures that the host's `u8` is compatible with its compiled counterpart.
#[test]
fn test_alignment_compatibility_u8() {
assert_eq!(get_integer_layout(8).align(), 1);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests should be kept in the utils.rs file, inside of a test module. This file is reserved for testing utilities only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, I don't see why they should be kept there. Aren't unit tests usually kept in the same file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, these unit tests are for functions defined in utils.rs, not here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are right. I'll change it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in: e6aac24

Copy link

github-actions bot commented Oct 1, 2025

✅ Code is now correctly formatted.

Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Now that these functions are public, maybe they could be reused in our integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move testing utilities to a testing module

4 participants