Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Debugging Granary: Test Suite

pgoodman edited this page Sep 6, 2014 · 1 revision

Running Granary's Test Suite

Granary's test suite can only be run from user space. The test suite uses the Google C++ testing and mocking frameworks to test various parts of Granary. The majority of the tests focus on trying to evaluate whether or not Granary's translation process is correct.

Step 1: Building and running the test suite

The following command will build and run Granary's test suite.

make clean test GRANARY_TARGET=test

Note: The GRANARY_TARGET=test is required.

If you encounter a compiler error saying that the file gmock/gmock.h could not be found then some of Granary's dependencies might not have been correctly fetched. Run the following commands:

git submodule init
git submodule update

Step 2: Running Granary on Granary

Granary can be used to instrument itself. The test target is explicitly set up for this purpose; however, you will need to compile it with GRANARY_RECURSIVE=1. After re-building the test cases, you can run Granary recursively by doing:

./bin/debug_linux_user/grr -- ./bin/test_linux_user/granary.out

In the above command, grr is Granary's user-space "injector", and is part of a debug build. Also, granary.out is the name of the executable that runs Granary through its tests.

VM Setup

  1. Setting up a VM
  2. Build and run Granary
  3. Debugging Granary

Debugging Granary

  1. Test suite
  2. GDB commands

Contributing to Granary

  1. Coding Conventions

Architecture

  1. Memory Allocation
  2. Key Concepts
Clone this wiki locally