Skip to content

Improve CLI binary lookup for tests - #1853

Merged
oferchen merged 1 commit into
masterfrom
fix-test-failures-in-cli_binaries
Nov 1, 2025
Merged

oferchen merged 1 commit into
masterfrom
fix-test-failures-in-cli_binaries

Conversation

@oferchen

@oferchen oferchen commented Nov 1, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • expand the CLI binary discovery helper so it searches common Cargo target layouts
  • ensure the tests find oc-rsync binaries even when nextest uses a separate target directory

Testing

  • cargo test --test cli_binaries -- --nocapture

@oferchen
oferchen merged commit fa317cc into master Nov 1, 2025
@oferchen
oferchen deleted the fix-test-failures-in-cli_binaries branch November 1, 2025 03:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/cli_binaries.rs
Comment on lines +109 to +144
let binary_name = format!("{name}{}", std::env::consts::EXE_SUFFIX);
let current_exe = env::current_exe().expect("current_exe should be available");
let mut candidates = BTreeSet::new();

let mut directory = current_exe.parent();
while let Some(dir) = directory {
candidates.insert(dir.join(&binary_name));

if dir
.file_name()
.and_then(|value| value.to_str())
.is_some_and(|value| value == "target")
{
candidates.insert(dir.join("debug").join(&binary_name));
candidates.insert(dir.join("release").join(&binary_name));

if let Ok(entries) = fs::read_dir(dir) {
for entry in entries.flatten() {
if let Ok(file_type) = entry.file_type() {
if file_type.is_dir() {
let entry_path = entry.path();
candidates.insert(entry_path.join(&binary_name));
candidates.insert(entry_path.join("debug").join(&binary_name));
candidates.insert(entry_path.join("release").join(&binary_name));
}
}
}
}
}

directory = dir.parent();
}

for candidate in candidates {
if candidate.is_file() {
return candidate;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid lexicographic ordering when choosing candidate binaries

The new discovery loop fills a BTreeSet with possible binary paths and then returns the first candidate.is_file() match. Because a BTreeSet iterates in lexicographic order, a cross‑compiled artifact such as target/aarch64-unknown-linux-gnu/debug/oc-rsync will be inspected before the host’s target/debug/oc-rsync. After running cargo build --target <non-host> and then executing these tests on the host, the helper will attempt to run the foreign binary and the tests fail with Exec format error despite a valid host binary being present. The previous implementation preferred the binary adjacent to the current test executable and did not have this failure mode. Consider preserving the search order by using a Vec or scanning directories in priority order instead of a sorted set.

Useful? React with 👍 / 👎.

oferchen added a commit that referenced this pull request Apr 28, 2026
)

Task #1853 verification. The concurrent_delta::ReorderBuffer was already
converted to a Box<[Option<T>]> ring buffer in #1734 (with adaptive
capacity scaling added in #3392), so the BTreeMap-vs-ring decision is
already settled in production code. This change adds the scaling
benchmark called for in #1853 to confirm O(1) per-item behaviour at the
10M-file scale that motivated the task, and corrects the stale
"BTreeMap-backed" doc comment in the concurrent_delta module overview.

The benchmark compares the production ring buffer against a self-
contained BTreeMap baseline at 10K, 100K, 1M, and 10M items. The 10M
case is gated behind BENCH_REORDER_10M=1 so default invocations stay
fast; CI can opt in when targeting the scaling regression dataset.

No production behaviour changes. Existing reorder_buffer tests already
cover gap-larger-than-capacity (force_insert grows the ring) and
ring wrap-around.
oferchen added a commit that referenced this pull request May 1, 2026
)

Task #1853 verification. The concurrent_delta::ReorderBuffer was already
converted to a Box<[Option<T>]> ring buffer in #1734 (with adaptive
capacity scaling added in #3392), so the BTreeMap-vs-ring decision is
already settled in production code. This change adds the scaling
benchmark called for in #1853 to confirm O(1) per-item behaviour at the
10M-file scale that motivated the task, and corrects the stale
"BTreeMap-backed" doc comment in the concurrent_delta module overview.

The benchmark compares the production ring buffer against a self-
contained BTreeMap baseline at 10K, 100K, 1M, and 10M items. The 10M
case is gated behind BENCH_REORDER_10M=1 so default invocations stay
fast; CI can opt in when targeting the scaling regression dataset.

No production behaviour changes. Existing reorder_buffer tests already
cover gap-larger-than-capacity (force_insert grows the ring) and
ring wrap-around.
oferchen added a commit that referenced this pull request May 5, 2026
)

Task #1853 verification. The concurrent_delta::ReorderBuffer was already
converted to a Box<[Option<T>]> ring buffer in #1734 (with adaptive
capacity scaling added in #3392), so the BTreeMap-vs-ring decision is
already settled in production code. This change adds the scaling
benchmark called for in #1853 to confirm O(1) per-item behaviour at the
10M-file scale that motivated the task, and corrects the stale
"BTreeMap-backed" doc comment in the concurrent_delta module overview.

The benchmark compares the production ring buffer against a self-
contained BTreeMap baseline at 10K, 100K, 1M, and 10M items. The 10M
case is gated behind BENCH_REORDER_10M=1 so default invocations stay
fast; CI can opt in when targeting the scaling regression dataset.

No production behaviour changes. Existing reorder_buffer tests already
cover gap-larger-than-capacity (force_insert grows the ring) and
ring wrap-around.
oferchen added a commit that referenced this pull request May 7, 2026
…#3827)

Benchmark plan for cachegrind/perf profiling of BoundedReorderBuffer
(crates/transfer/src/reorder_buffer.rs) at 1M files. Documents BTreeMap
node layout, names the ring-buffer alternative from #1853, defines the
three workloads (in-order, mostly-in-order with 5% gap, pathological),
and pins L1d/LLC miss rate plus IPC as the decision metrics.

Tracking task: oc-rsync #1854.
oferchen added a commit that referenced this pull request May 18, 2026
…#3827)

Benchmark plan for cachegrind/perf profiling of BoundedReorderBuffer
(crates/transfer/src/reorder_buffer.rs) at 1M files. Documents BTreeMap
node layout, names the ring-buffer alternative from #1853, defines the
three workloads (in-order, mostly-in-order with 5% gap, pathological),
and pins L1d/LLC miss rate plus IPC as the decision metrics.

Tracking task: oc-rsync #1854.
oferchen added a commit that referenced this pull request Aug 24, 2026
…#3827)

Benchmark plan for cachegrind/perf profiling of BoundedReorderBuffer
(crates/transfer/src/reorder_buffer.rs) at 1M files. Documents BTreeMap
node layout, names the ring-buffer alternative from #1853, defines the
three workloads (in-order, mostly-in-order with 5% gap, pathological),
and pins L1d/LLC miss rate plus IPC as the decision metrics.

Tracking task: oc-rsync #1854.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant