Test Framework

From Marss86

For unit testing MARSS uses Google C++ Test Framework to validate various modules of MARSS. Please checkout Primer page to get a quick introduction to this framework and learn how to write small test cases.

Writing Tests in MARSS

Currently MARSS only includes tests for 'simulation' framework. Tests are compiled only in 'debug' mode on. In MARSS before you include any header files from MARSS/QEMU please define 'DISABLE_ASSERT' to disable MARSS's assert version. For example this is the top header from 'ptlsim/tests/mesi.cpp' file.

#include <gtest/gtest.h> 
 
#include <iostream> 
 
#define DISABLE_ASSERT
 
#include <memoryHierarchy.h>
#include <coherentCache.h>
#include <mesiLogic.h>
#include <machine.h>

Currently MARSS provides test cases for:

  1. Atom Core
  2. Base Core
  3. MESI Coherence Logic
  4. some classes of logic.h
  5. Stats Collection Framework

To write your own test case you can either add tests to one of this file or you can create a new file. Give your file .cpp extension and SCons will automatically detect your file for compilation.

Running Tests

To run the tests, as mentioned above you must compile MARSS in debug mode (with 'debug=1' option). Once you have compiled the test cases, add '-run-tests' to your simconfig file. Then run the MARSS as usual with other parameters and it will run the tests. Remember that when you specify '-run-tests' MARSS will only run tests and exit, it will not run any simulation/emulation mode.

Personal tools