mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 08:01:26 +00:00
`leaf-e2e` starts real leaf instances and drives them from the outside over SOCKS5, so a case covers the path a deployment takes -- config parsing, plugin loading, routing, the dispatcher, the C ABI data plane -- and nothing reaches into leaf to build a handler by hand. Cases are values rather than `#[test]` functions, so the suite is a matrix of implementation, protocol, transport and behaviour instead of a wall of copies, and each runs in its own process, free to crash, hang, or set load-time environment. The lanes: - `differential` runs a behaviour natively and again with a plugin substituted for one stage, and requires the two to agree. The server is stock leaf, so these are interoperability tests. `protocols`, `halfclose` and `teardown` extend that across every stack, relay and selector, the end of a request on each transport, and shutdown. - `abi`, `loader` and `coexist` check what the host accepts, refuses, and can load at once, through a real `dlopen`. - `hostile` and `datagram` drive conformance plugins -- one in Rust, one in Go -- that misbehave on request, exercising the host's bounds checks, clamps, buffer growth and `decode_packet` handling. - `stress` and the meters measure both sides back to back and assert the ratio, since absolute numbers from a shared runner say little; throughput, latency, setup cost and cpu cost land in `meters.json` beside the case logs. What the process is holding is asserted directly instead, against the case's own allocator, because what matters there is that it stopped growing. - `blackbox` runs the shipped binary: on a config file, and on a plugin library through `--verify-plugin`, whose report has to agree with what the loader itself would do. Plugins are built by the harness, and a case whose toolchain is missing is reported as ignored with the reason; `--strict`, which CI passes, makes that a failure, so the suite cannot go green by running nothing. The suite runs on Windows too, where a pause is never shorter than 16ms and cases that dribble bytes bound their pauses instead.
16 lines
656 B
Rust
16 lines
656 B
Rust
//! Records the target triple this harness was built for.
|
|
//!
|
|
//! The harness builds plugins itself at run time, and those builds have to land
|
|
//! where it will look for them. Cargo nests the profile under the triple when
|
|
//! it was given an explicit `--target` (a sanitizer or cross lane), and does
|
|
//! not otherwise, so the harness needs to know both the triple and which layout
|
|
//! it is looking at. Only cargo knows the triple, and only here.
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
println!(
|
|
"cargo:rustc-env=LEAF_E2E_TARGET={}",
|
|
std::env::var("TARGET").expect("cargo sets TARGET for build scripts")
|
|
);
|
|
}
|