B7: r2engine's integration tests are one binary, each file a module

Each of the 24 test files compiled and linked the engine's generics into its
own binary. They are now modules of tests/engine/main.rs, sharing `common`
through the crate; no test, name or assertion changes.

Mac, debug, r2engine cleaned first, `cargo test -p r2engine --all-features
--no-run`: 95.5 -> 14.4 s user, 12.8 -> 5.2 s wall; test binaries 1.7 GB
-> 85 MB. The suite runs the same 405 tests (119 unit, 286 integration).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01456qmqCGpCWJkrg6JUZNNM
This commit is contained in:
Priyanshu KumarandClaude Opus 5.5 committed 2026-10-15 10:00:24 +05:30
1 parent a12bb2a3b9
commit 6b764576f4
30 files changed
+53 -25

No files matched your search

+1 -1
View File
@@ -193,7 +193,7 @@ helper names or incidental traversal order.
| What a whole function renders | the certification gate, plus a unit test for the rule |
| Discovery, naming or decoding | the differential gate, with the disagreement judged |
`crates/r2engine/tests/native.rs` is the model integration test: an in-memory
`crates/r2engine/tests/engine/native.rs` is the model integration test: an in-memory
program from byte literals, the `Program` trait over it, an assertion on what
the engine renders. More in [doc/testing.md](doc/testing.md).
File renamed without changes.
@@ -1,6 +1,6 @@
//! A function's body is bounded by where other functions begin, and only there.
mod common;
use crate::common;
use common::{CALLER, Literal, TWO, opened};
use r2engine::program::{EdgeKind, OpenProgram, Symbol, SymbolKind};
@@ -4,7 +4,7 @@
//! every native request carried tokens nothing could reach. Nothing had ever
//! run under a cancellation, which is why this exists.
mod common;
use crate::common;
use common::{ONE, opened};
use r2engine::{EngineCancellationToken, EngineExecutionControl};
@@ -4,7 +4,7 @@
//! silence, so a call rendered from the call site alone looked exactly like a
//! call rendered against a proven interface.
mod common;
use crate::common;
use common::{CALLER, ONE, opened};
use r2engine::native::Unreadable;
@@ -4,7 +4,7 @@
//! the stubs the engine had decoded; which addresses are believed to be
//! functions is the engine's question, so the whole answer is asked of it here.
mod common;
use crate::common;
use common::{
ARM_ENTRY, BASE, CALLER, FORKED, GLIBC, JOINED, Literal, ONE, PASSES, PLT_SEC_STUB, STEPPED,
@@ -1,6 +1,6 @@
//! Where an import stub begins, as the call to it names it.
mod common;
use crate::common;
use common::{
ARM_PLT, ARM_PLT_SLOTS, BASE, Literal, MOVED_STUB, PLT_CALLER, PLT_STUB, import_write,
@@ -1,6 +1,6 @@
//! A function's convention is its language's (ROADMAP LP1): Go's register ABI, or a refusal.
mod common;
use crate::common;
use common::{BASE, GLIBC, Literal};
use r2engine::program::OpenProgram;
@@ -1,7 +1,7 @@
//! Whether a listed number is a result or a step, as `pd` and `pdf` each answer it,
//! and what a function listing says was proved.
mod common;
use crate::common;
use common::{
ARM_ENTRY, BASE, CALLER, FORKED, GUARDED_JOIN, HANDED, HANDS, JOINED, Literal, MOVED, ONE,
@@ -1,6 +1,6 @@
//! What the open program says about the machine a storage lives in.
mod common;
use crate::common;
use common::{ONE, opened};
use r2ssa::{CanonicalStorageId, CanonicalStorageSpace};
+28
View File
@@ -0,0 +1,28 @@
//! The engine's integration tests, one binary: each module is the file it was.
mod common;
mod architecture;
mod arm;
mod body;
mod control;
mod degraded;
mod discovery;
mod imports;
mod language;
mod legacy_route_interlock;
mod listing;
mod machine;
mod names;
mod native;
mod oracle;
mod pass_through;
mod ranges;
mod references;
mod rendered;
mod result_reads;
mod reuse;
mod signature;
mod staged;
mod start;
mod walk;
@@ -1,6 +1,6 @@
//! Which of several symbols at one address names it.
mod common;
use crate::common;
use common::{Literal, ONE};
use r2engine::program::{Binding, OpenProgram, Symbol, SymbolKind};
@@ -1,6 +1,6 @@
//! Decompiling from bytes and an address, with no radare2 in the process.
mod common;
use crate::common;
use std::collections::{BTreeMap, BTreeSet};
@@ -1,6 +1,6 @@
//! Every claim `pd` and `pdf` make holds on every run of the function's own lift, and a claim no run rules on fails.
mod common;
use crate::common;
use std::collections::{BTreeMap, BTreeSet};
use std::fmt;
@@ -1,7 +1,7 @@
//! A body that hands its own argument register to a call, unwritten, does not prove it takes no
//! argument: prepared alone it cannot see what the call reads.
mod common;
use crate::common;
use common::{BASE, Literal};
use r2engine::program::OpenProgram;
@@ -1,6 +1,6 @@
//! What `pdf` says a value lies in holds on every path that defines it.
mod common;
use crate::common;
use common::{BASE, GUARDED_JOIN, Literal, SHIFT_MERGE};
use r2engine::program::OpenProgram;
@@ -5,7 +5,7 @@
//! the answer: which functions were read, which could not be, and where a walk
//! stopped without knowing where control went.
mod common;
use crate::common;
use std::sync::Arc;
@@ -1,6 +1,6 @@
//! What a rendering reads from the open program: names, and text in its data.
mod common;
use crate::common;
use common::{BASE, CALLER, GLIBC, Literal, ONE, STUB, TEXT, TWO, opened};
use r2engine::program::OpenProgram;
@@ -1,7 +1,7 @@
//! A body that writes both result registers returns the one its callers read
//! (doc/adr-resolved-bodies.md, "Caller reads").
mod common;
use crate::common;
use common::{BASE, Literal};
use r2engine::program::OpenProgram;
@@ -1,6 +1,6 @@
//! One analysis serves every view asked of one function.
mod common;
use crate::common;
use common::{
ARM_ENTRY, CALLER, Literal, ONE, PASSES, STUB, TEXT, THUMB_CALLED, THUMB_LEAF, TWO, opened,
@@ -1,6 +1,6 @@
//! `afi` and the rendered header state each parameter as the one declaration r2types gives it.
mod common;
use crate::common;
use r2engine::discovery::Basis;
@@ -1,7 +1,7 @@
//! The staged decompiler (ROADMAP D) through the open program: D1 writes the control, certified,
//! around D2's statements, with D3 spelling each term; a call is still a gap.
mod common;
use crate::common;
use common::{BASE, CALLER, FORKED, GLIBC, Literal, ONE, PLT_STUB, STUB, TWO, opened};
use r2engine::program::OpenProgram;
@@ -1,6 +1,6 @@
//! Where a session starts, and what a flag spelling seeks to.
mod common;
use crate::common;
use common::{BASE, CALLER, Literal, STUB, TEXT, TWO};
use r2engine::program::{EntryKind, OpenProgram, Section, SectionRole};
File renamed without changes.
+1 -1
View File
@@ -137,7 +137,7 @@ little-endian target.
## Validation
- Behavior test in `r2engine/tests/native.rs` style: a byte-literal x86-64
- Behavior test in `r2engine/tests/engine/native.rs` style: a byte-literal x86-64
function reading `+0` u8, `+2` u16, `+4` u32 and `+8` u64 through `rdi`
renders `struct fcn_<entry>_arg0* arg0` and the definition text.
- Negative tests: an indexed access refuses; an uncertified access refuses;
+1 -1
View File
@@ -182,5 +182,5 @@ Tarjan, O(V + E) over result demands only, each component deposited once.
- P6c1: a callee runs the root's resolution, on its `Walked`, against its imports.
- P6c2: `result_owners`, `Demand` and `Resolved`; an unproven callee states how many arguments it reads.
- P6d, declined: `read_callees` is the one loop a root reads its callees through. The database
answers it with `Resolved`; a plain `Program` (tests/native.rs, the model integration test)
answers it with `Resolved`; a plain `Program` (tests/engine/native.rs, the model integration test)
with each callee resolved alone, through the same `resolved_alone`.
+2 -2
View File
@@ -9,11 +9,11 @@ Layers
- **Unit tests**, inline beside a lowering, predicate, certificate or fold.
- **Crate integration tests** in `crates/<crate>/tests/`, through the public
surface only (`crates/r2engine/tests/native.rs` is the model).
surface only (`crates/r2engine/tests/engine/native.rs` is the model).
- **Golden files** in `tests/db/`, radare2's r2r format, run by
`crates/r2s/tests/golden.rs`: a command's whole output on a fixed binary,
so a pull request's diff shows what moved ([tests/db/README.md](../tests/db/README.md)).
- **The claim oracle**, `crates/r2engine/tests/oracle.rs`, described below.
- **The claim oracle**, `crates/r2engine/tests/engine/oracle.rs`, described below.
- **End-to-end harnesses** that run a built `r2s` over real binaries.
The claim oracle