Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Regression Tests for the Radare2 Reverse Engineer's Debugger
Shell Perl JavaScript Objective-C Assembly Java Other
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Radare2 Regression Test Suite

A set of regression tests for Radare2 (

Originally based on work by and now in collaboration with pancake.

Directory Hierarchy

  • t/: Test scripts.
  • s/: Sample binaries.
  • Test driver script sourced by tests (not to be run manually).
  • Run all tests.


  • Radare2 installed (and in $PATH or set the R2 environment).
  • Valgrind (optional).


  • Run './' in the top level directory to run all tests (alternatively you can use 'make').
  • To run individual tests, type 'cd t; ./testname'.
  • To remove old test results run 'make clean'.


The following options can be passed to or the individual tests (environment variables).

  • To run tests with valgrind, use 'VALGRIND=1'.
  • To get verbose output, use 'VERBOSE=1' (always enabled for individual tests).

Exit code exits with the following exit codes:

  • 0: all tests passed
  • 1: at least one test failed
  • 2: no tests failed, but there was at least one broken test
  • 3: no tests failed or are broken, but there is at least one fixed test

Reporting Radare2 Bugs

Please to not post Radare2 bugs on the r2-regressions github tracker. Instead use the official r2 tracker:

Writing test cases

Test cases are simple shell scripts (POSIX compliant) and either run by or manually in t/.

The following variables are available:

  • NAME (recommend): radare2 command being tested (e.g. px).
  • FILE (required): File argument for radare2.
  • ARGS (optional): Additional arguments for radare2. If not present no additional arguments are used.
  • CMDS (required): Commands to run, one per line. Just like in interactive mode.
  • EXPECT (required): Expected output.
  • FILTER (optional): Filter program (like grep or sed) to filter radare2's output before comparing it with EXPECT. Useful to fix random output to generate stable tests.
  • BROKEN (optional): This tests documents a bug which is not yet fixed.
  • EXITCODE (optional): Check the exit code of radare2 matches. Can be used to check handling of invalid arguments.

All uppercase variable names are reserved for the test system.

The following functions are available:

  • run_test(): Run the test with the variables. Can be called multiple times in one test file.

The test files should be named according to the following convention:

  • cmd_*: For each command (see libr/core/cmd.c).
  • feat_*: For features not tied to a single command, like grep or redirection.
  • file_*: For each supported file format.


The test files are licensed under GPL 3 (or later).

Something went wrong with that request. Please try again.