Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make miri tests fast again (take 2) #884

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions encodings/fsst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ rust-version = { workspace = true }
[lints]
workspace = true

[dev-dependencies]
rstest = { workspace = true }

[dependencies]
arrow-array = { workspace = true }
fsst-rs = { workspace = true }
Expand Down
28 changes: 10 additions & 18 deletions encodings/fsst/tests/fsst_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(test)]

use rstest::{fixture, rstest};
use vortex::array::builder::VarBinBuilder;
use vortex::array::{BoolArray, PrimitiveArray};
use vortex::compute::unary::scalar_at;
Expand All @@ -16,8 +15,8 @@ macro_rules! assert_nth_scalar {
};
}

#[fixture]
fn fsst_array() -> Array {
// this function is VERY slow on miri, so we only want to run it once
fn build_fsst_array() -> Array {
let mut input_array = VarBinBuilder::<i32>::with_capacity(3);
input_array.push_value(b"The Greeks never said that the limit could not he overstepped");
input_array.push_value(
Expand All @@ -35,8 +34,10 @@ fn fsst_array() -> Array {
.into_array()
}

#[rstest]
fn test_scalar_at(fsst_array: Array) {
#[test]
fn test_fsst_array_ops() {
// first test the scalar_at values
let fsst_array = build_fsst_array();
assert_nth_scalar!(
fsst_array,
0,
Expand All @@ -52,10 +53,8 @@ fn test_scalar_at(fsst_array: Array) {
2,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_slice(fsst_array: Array) {
// test slice
let fsst_sliced = slice(&fsst_array, 1, 3).unwrap();
assert_eq!(fsst_sliced.encoding().id(), FSST::ENCODING.id());
assert_eq!(fsst_sliced.len(), 2);
Expand All @@ -69,10 +68,8 @@ fn test_slice(fsst_array: Array) {
1,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_take(fsst_array: Array) {
// test take
let indices = PrimitiveArray::from_vec(vec![0, 2], Validity::NonNullable).into_array();
let fsst_taken = take(&fsst_array, &indices).unwrap();
assert_eq!(fsst_taken.len(), 2);
Expand All @@ -86,10 +83,8 @@ fn test_take(fsst_array: Array) {
1,
"Nothing in present history can contradict them"
);
}

#[rstest]
fn test_filter(fsst_array: Array) {
// test filter
let predicate =
BoolArray::from_vec(vec![false, true, false], Validity::NonNullable).into_array();

Expand All @@ -101,11 +96,8 @@ fn test_filter(fsst_array: Array) {
0,
"They said it existed and that whoever dared to exceed it was mercilessly struck down"
);
}

// Test canonicalizing
#[rstest]
fn test_into_canonical(fsst_array: Array) {
// test into_canonical
let canonical_array = fsst_array
.clone()
.into_canonical()
Expand Down
Loading