R2R(1)
π R2R(1) π
okay so bestie, this is the manual page for r2r from section 1, and I'm about to make you obsessed with it π
π NAME π
r2r β the radare2 regression testsuite. no cap, that's literally the whole name and it ate β¨
πΈ SYNOPSIS πΈ
r2r [-1qvVnLiHh] [-C dir] [-F dir] [-f file] [-o file] [-s test]
[-S percent] [-t seconds] [-j threads] [-u] [-g]
[test file/dir | @test-type]
π¦ DESCRIPTION π¦
so r2r is a command-line regression testing framework for Radare2 and its third-party plugins. it's giving infrastructure queen π
what it does is automate the discovery and running of a whole bunch of different test suites β unit tests, JSON validations, fuzz tests, architecture-specific checks β so that code changes don't sneak in regressions behind your back. the way that it protects youβ¦ iconic fr fr.
it supports parallel test execution, interactive failure handling, custom timeouts, and filtering tests by type or name. it slots seamlessly into continuous integration workflows or you can just run it locally, and the only thing it asks is that Radare2 be installed and chilling in your system PATH. lowkey the lowest-maintenance bestie ever π«Ά
β¨ OPTIONS β¨
-1β run tests in a single thread (same as-j 1). one thing at a time, main character energy β¨-C dirβ chdir before runningr2r(the default follows the executable symlink +test/new)-F dirβ run fuzz tests (open and default analysis) on all files in the given dir π₯-Lβ log mode (better printing for CI, logfiles, etc.). yes bestie, made for your logs-Vβ verbose. tell me EVERYTHING π¬-f fileβ file to use for json tests (default isbins/elf/crackme0x00b)-gβ run the tests specified via// R2Rcomments in modified source files-hβ print help message π-Hβ display environment variables-iβ interactive mode π-j threadsβ how many threads to use for running tests concurrently (default is 8)-nβ do nothing (don't run any test, just load/parse them). the "just vibes, no execution" option π-o fileβ output test run information in JSON format to file-qβ quiet (only show errors; suppress non-error output) π€«-s testβ setR2R_SKIP_(TEST)=1to skip running that test type-S percentβ setR2R_SHALLOW=Nto skip a random percentage (0-100) of tests-t secondsβ timeout per test (default is 3600 seconds). an hour, that's the limit bestie β°-uβ do notgit pull/clonetest/bins(seeR2R_OFFLINE)-vβ show version π
π ENVIRONMENT π
the vibes are controlled by env vars, periodt:
R2R_SKIP_ARCHOSβ do not run the arch-os-specific testsR2R_SKIP_JSONβ do not run the JSON testsR2R_SKIP_FUZZβ do not run the fuzz testsR2R_SKIP_UNITβ do not run the unit testsR2R_SKIP_CMDβ do not run the cmd testsR2R_SKIP_ASMβ do not run the rasm2 testsR2R_JOBSβ maximum parallel jobs (default: 8)R2R_TIMEOUTβ timeout in seconds (default: 3600 seconds)R2R_OFFLINEβ same as passing the-uflagR2R_SHALLOWβ skip 0-100% random tests
π USAGE π
use the -n flag to not run any test. just load them. iykyk π§
$ r2r -n
[r2r] Loading tests...
run the tests contained in a directory interactively β and if any of those tests fail to run, it prompts you to autofix, edit the commands, etc. so helpful π₯Ή
$ r2r -i test/db/cmd/cmd_pdf
run specific test types using @ notation:
$ r2r @asm # Run assembly tests
$ r2r @json # Run JSON tests
$ r2r @unit # Run unit tests
$ r2r @fuzz # Run fuzz tests
$ r2r @arch # Run architecture-specific tests
$ r2r @cmd # Run command tests
π CREATING TESTS π
r2r loads tests from files under test/db and infers the test type from the path. the path is the vibe check:
test/db/asm/*β parsed as ASM tests.test/db/json/*β parsed as JSON tests.test/db/leak/*β parsed as leak tests (command syntax, executed with Valgrind checks).- Other files β parsed as command tests.
command-style test files are "KEY=VALUE" records, and they're terminated by "RUN". every record is validated at load time. no skipping the validation, bestie π
NAME=example
FILE=bins/elf/crackme
ARGS=-a x86 -b 64
CMDS=<<EOF
pd 1
EOF
EXPECT=<<EOF
EOF
RUN
"NORUN" marks a pending record as incomplete, so it gets ignored by the parser. records are loaded only when terminated by "RUN" β otherwise they're treated as disabled. so if your test is just sitting there with a "NORUN", it is not the moment π
π TEST RULES π
accepted command/leak test keys are handled by R2R_CMD_TEST_FOREACH_RECORD in binr/r2r/r2r.h, and here are the accepted keys:
NAMEβ optional identifier used for reporting.FILEβ optional file input for ther2command. you can list multiple files on separate lines. if it's omitted, stdin-is used.ARGSβ extra arguments passed directly tor2before-Qcand the command block.REQUIREβ whitespace-, comma- or semicolon-separated requirement tokens. all listed requirements must be available; otherwise the test is skipped. accepted values are:gasβ GNU assembler (as) is available inPATH.unixβ the host is Unix-like.windowsβ the host is Windows.linuxβ the host is Linux.armβ the host CPU is ARM.x86β the host CPU is x86.littleβ the host is little-endian.gplβ radare2 was built with GPL plugins enabled.zydisβ radare2 was built with Zydis support.arm.v35β radare2 was built with ARM v35 support.hexagonβ the selectedrasm2binary lists the hexagon architecture.networkβ network-dependent tests are enabled byR2R_NETWORK=1.x86.udisβ the selectedrasm2binary lists thex86.udisarchitecture.
REPEATβ numeric repeat count. the test command is executed that many times; only the last output is checked. so it's giving "run it back" πTIMEOUTβ numeric timeout override for this test, in seconds.SOURCEβ parsed and accepted for compatibility; no additional runtime behavior is wired in. it's there, it's accepted, it does nothing extra. we love a decorative queen πCMDSβ required command block, passed as-Qc <CMDS>. multiline command blocks must use<<EOFwith the closing token at the beginning of the line. single-line quoted values are not accepted. no exceptions bestie π€EXPECTβ exact expected stdout match.EXPECT_ERRβ exact expected stderr match.REGEXP_OUTβ extended-regex match against stdout.REGEXP_ERRβ extended-regex match against stderr.ENVβ semicolon-separated "KEY=VALUE" environment overrides. tokens missing=are ignored.BROKENβ boolean (0/1) marking the test as expected-failing. failed broken tests are counted as broken instead of failed.SKIPONASANβ boolean (0/1) to skip this test when built with ASAN.
boolean fields accept only "1" or "0" as values. that's it, that's the whole menu π
a command/leak test is only accepted when:
CMDSis present.- Either exact-output or regex-output assertions are present:
EXPECTorEXPECT_ERRorREGEXP_OUTorREGEXP_ERR
unknown keys cause parser failure. sorry bestie, there's no "close enough" here π
JSON tests load one command per non-empty, non-comment line from files under test/db/json/*. empty lines and # lines are ignored. if a line contains the word "BROKEN," the test is marked broken.
ASM tests are parsed line-by-line as
<modes> "<disassembly text>" <hexbytes>[ <offset>]
"a" enables assemble mode, "d" disassemble mode, "E" enables big-endian and "B" marks the case broken. the filename selects architecture and optional CPU/bits via arch[_cpu]_bits. literally the filename doing double duty, iconic β¨
π SEE ALSO π
radare2(1)β go read that one next, bestie π«Ά
π AUTHORS π
written by pancake <pancake@nopcode.org>. thank you pancake, we are forever grateful π
and that's the whole page, babe β this little cutie was dated Jul 10, 2025, and it lives in section R2R(1) π slay, you made it to the end π
π¦ where this page comes from
- ubuntu stonking: radare2 6.1.8+ds-1 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms