Skip to content

Commit 9619b42

Browse files
committed
fix: Speed up coverage tests and install LLVM tools
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent c55584a commit 9619b42

4 files changed

Lines changed: 28 additions & 52 deletions

File tree

.github/workflows/rust-instrumented.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,20 @@ jobs:
4747
sccache: s3
4848
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4949
- uses: ./.github/actions/setup-prebuild
50+
- name: Install LLVM tools
51+
run: |
52+
rustup component add llvm-tools || rustup component add llvm-tools-preview
5053
- name: Rust Tests
5154
if: ${{ matrix.suite == 'tests' }}
5255
run: |
5356
cargo nextest run --locked --workspace --all-features --no-fail-fast
5457
- name: Generate coverage report
5558
run: |
59+
set -euo pipefail
60+
LLVM_TOOLS_BIN="$(rustc --print sysroot)/lib/rustlib/$(rustc -vV | sed -n 's|host: ||p')/bin"
61+
test -x "${LLVM_TOOLS_BIN}/llvm-profdata"
5662
grcov . --binary-path target/debug/ -s . -t lcov --llvm --ignore-not-existing \
63+
--llvm-path "${LLVM_TOOLS_BIN}" \
5764
--threads $(nproc) \
5865
--ignore '../*' --ignore '/*' --ignore 'fuzz/*' --ignore 'vortex-bench/*' \
5966
--ignore 'home/*' --ignore 'xtask/*' --ignore 'target/*' --ignore 'vortex-error/*' \
@@ -62,6 +69,7 @@ jobs:
6269
--ignore 'vortex-ffi/examples/*' --ignore '*/arbitrary/*' --ignore '*/arbitrary.rs' --ignore 'vortex-cxx/*' \
6370
--ignore benchmarks/* --ignore 'vortex-test/*' \
6471
-o ${{ env.GRCOV_OUTPUT_FILE }}
72+
test -s ${{ env.GRCOV_OUTPUT_FILE }}
6573
- name: Codecov
6674
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
6775
with:

benchmarks-website/server/tests/landing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ async fn landing_page_honours_filter_query_params() -> Result<()> {
416416
/// full history via the explicit `/api/chart/{slug}?n=all` refetch.
417417
#[tokio::test]
418418
async fn landing_first_group_shard_caps_commits() -> Result<()> {
419-
// 250 commits is comfortably above the 100-commit artifact cap so the
419+
// 101 commits is the smallest fixture above the 100-commit artifact cap, so the
420420
// cap actually kicks in. `seed_long_history` only seeds the Random-Access
421421
// group; with the canonical group ordering Random Access sorts first.
422422
let server = Server::start().await?;
423-
seed_long_history(&server, 250).await?;
423+
seed_long_history(&server, 101).await?;
424424

425425
let client = reqwest::Client::new();
426426
let body = client.get(server.url("/")).send().await?.text().await?;
@@ -454,7 +454,7 @@ async fn landing_first_group_shard_caps_commits() -> Result<()> {
454454
assert_eq!(
455455
commits.len(),
456456
100,
457-
"with 250 seeded commits the shard payload should be exactly the \
457+
"with 101 seeded commits the shard payload should be exactly the \
458458
100-commit cap; got {}",
459459
commits.len(),
460460
);

benchmarks-website/server/tests/permalinks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use self::common::seed_long_history;
2525
#[tokio::test]
2626
async fn permalink_pages_default_to_latest_100_and_opt_into_full_history() -> Result<()> {
2727
let server = Server::start().await?;
28-
seed_long_history(&server, 200).await?;
28+
seed_long_history(&server, 101).await?;
2929

3030
let chart_slug = pick_chart_slug(&server, |s| s == "Random Access").await?;
3131
let group_slug = pick_group_slug(&server, |s| s == "Random Access").await?;
@@ -61,7 +61,7 @@ async fn permalink_pages_default_to_latest_100_and_opt_into_full_history() -> Re
6161
.as_array()
6262
.context("all commits is array")?
6363
.len(),
64-
200,
64+
101,
6565
"/chart?n=all should inline the full raw history",
6666
);
6767

encodings/fsst/src/tests.rs

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use rand::SeedableRng;
5-
use rand::rngs::StdRng;
6-
use rand::seq::IndexedRandom;
74
use vortex_array::ArrayRef;
85
use vortex_array::IntoArray;
96
use vortex_array::LEGACY_SESSION;
107
use vortex_array::VortexSessionExecute;
118
use vortex_array::arrays::VarBinViewArray;
9+
use vortex_array::arrays::varbin::VarBinArrayExt;
1210
use vortex_array::arrays::varbin::builder::VarBinBuilder;
1311
use vortex_array::assert_arrays_eq;
1412
use vortex_array::assert_nth_scalar;
1513
use vortex_array::dtype::DType;
1614
use vortex_array::dtype::Nullability;
15+
use vortex_array::dtype::PType;
1716
use vortex_buffer::buffer;
1817
use vortex_mask::Mask;
1918

2019
use crate::FSST;
20+
use crate::FSSTArrayExt;
2121
use crate::fsst_compress;
2222
use crate::fsst_train_compressor;
2323

@@ -111,60 +111,28 @@ fn test_fsst_array_ops() {
111111
assert_arrays_eq!(fsst_array, canonical_array);
112112
}
113113

114-
// TODO(someone): ideally CI would run this in release mode as well since debug builds make the
115-
// allocation and compression loop substantially slower.
116-
/// Regression for #7833: [`fsst_compress`] must accept inputs whose cumulative compressed
117-
/// bytes exceed [`i32::MAX`]. Before the fix, [`fsst_compress_iter`] hardcoded
118-
/// [`VarBinBuilder<i32>`] for the FSST output and panicked in
119-
/// [`VarBinBuilder::append_value`] once cumulative compressed bytes crossed the boundary.
114+
/// Regression coverage for #7833.
120115
///
121-
/// The input is built with [`VarBinBuilder<i64>`] so the input itself does not panic, which
122-
/// confirms the overflow is on the FSST output side. After the fix the test must succeed
123-
/// with the row count preserved.
124-
///
125-
/// Allocates ~2.5 GiB for the input and ~2.5 GiB for the FSST output (~5 GiB total), so it
126-
/// is gated to CI runs and skipped when `VORTEX_SKIP_SLOW_TESTS` is set. To run it locally:
127-
///
128-
/// ```text
129-
/// CI=1 cargo test --release -p vortex-fsst fsst_compress_offsets
130-
/// ```
116+
/// The bug was that [`fsst_compress_iter`] built compressed codes with [`VarBinBuilder<i32>`],
117+
/// which panicked once cumulative compressed bytes crossed [`i32::MAX`]. The end-to-end
118+
/// behavior is "large FSST outputs do not overflow", but exercising that literally requires
119+
/// multi-GiB input. This test checks the implementation detail that currently guarantees that
120+
/// behavior: compressed code offsets are widened to [`i64`].
131121
///
132122
/// [`fsst_compress_iter`]: crate::compress::fsst_compress_iter
133-
#[test_with::env(CI)]
134-
#[test_with::no_env(VORTEX_SKIP_SLOW_TESTS)]
135-
fn fsst_compress_offsets_overflow_i32() {
136-
// High-entropy ASCII strings sliced from a random pool. FSST is a symbol-table
137-
// compressor; pseudo-random data with no recurring byte sequences resists compression,
138-
// so the compressed output stays close to input size and crosses the i32 boundary.
139-
const STRING_LEN: usize = 64 * 1024;
140-
const TOTAL_BYTES: usize = (1usize << 31) + (512 << 20); // ~2.5 GiB
141-
const N: usize = TOTAL_BYTES / STRING_LEN;
142-
const POOL_LEN: usize = 64 * 1024 * 1024;
143-
144-
// Printable ASCII alphabet so the result is valid UTF-8.
145-
const ALPHABET: &[u8; 95] =
146-
b" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
147-
148-
let mut rng = StdRng::seed_from_u64(0xC0DE_C011_B711);
149-
let pool: Vec<u8> = (0..POOL_LEN)
150-
.map(|_| *ALPHABET.choose(&mut rng).unwrap())
151-
.collect();
152-
153-
println!("building large VarBinArray");
154-
let mut builder = VarBinBuilder::<i64>::with_capacity(N);
155-
for i in 0..N {
156-
let off = i.wrapping_mul(31337) % (POOL_LEN - STRING_LEN);
157-
builder.append_value(&pool[off..off + STRING_LEN]);
158-
}
123+
#[test]
124+
fn fsst_compress_uses_i64_code_offsets() {
125+
let mut builder = VarBinBuilder::<i32>::with_capacity(2);
126+
builder.append_value(b"hello world");
127+
builder.append_value(b"hello vortex");
159128
let array = builder.finish(DType::Utf8(Nullability::NonNullable));
160129

161-
println!("training FSST compressor");
162130
let compressor = fsst_train_compressor(&array);
163131
let len = array.len();
164132
let dtype = array.dtype().clone();
165133
let mut ctx = LEGACY_SESSION.create_execution_ctx();
166134

167-
println!("compressing to FSST");
168135
let compressed = fsst_compress(array, len, &dtype, &compressor, &mut ctx);
169136
assert_eq!(compressed.len(), len);
137+
assert_eq!(compressed.codes().offsets().dtype().as_ptype(), PType::I64);
170138
}

0 commit comments

Comments
 (0)