Ghidra Decompiler Analysis Engine
Public Member Functions | Static Public Member Functions | List of all members
FunctionTestCollection Class Reference

A collection of tests around a single program/function. More...

#include <testfunction.hh>

Public Member Functions

 FunctionTestCollection (void)
 Constructor.
 
void loadTest (const string &filename)
 Load a test program, tests, and script. More...
 
void restoreXml (DocumentStorage &store, const Element *el)
 Load tests from a <decompilertest> tag.
 
void restoreXmlOldForm (DocumentStorage &store, const Element *el)
 Load tests from <binaryimage> tag. More...
 
void runTests (ostream &midStream, list< string > &lateStream)
 Run the script and perform the tests. More...
 

Static Public Member Functions

static void runTestCollections (const string &dirname, set< string > &testNames)
 Run test files in a whole directory. More...
 

Detailed Description

A collection of tests around a single program/function.

The collection of tests is loaded from a single XML file via loadTest(), and the tests are run by calling runTests(). An entire program is loaded and possibly annotated by a series of console command lines. Decompiler output is also triggered by a command, and then the output is scanned for by the test objects (FunctionTestProperty). Results of passed/failed tests are collected. If the command line script does not complete properly, this is considered a special kind of failure.

Member Function Documentation

◆ loadTest()

void FunctionTestCollection::loadTest ( const string &  filename)

Load a test program, tests, and script.

Load the architecture based on the discovered <binaryimage> tag. Collect the script commands and the specific tests.

Parameters
filenameis the XML file holding the test data

◆ restoreXmlOldForm()

void FunctionTestCollection::restoreXmlOldForm ( DocumentStorage store,
const Element el 
)

Load tests from <binaryimage> tag.

Pull the script and tests from a comment in <binaryimage>

◆ runTestCollections()

void FunctionTestCollection::runTestCollections ( const string &  dirname,
set< string > &  testNames 
)
static

Run test files in a whole directory.

Run through all XML files in the given directory, processing each in turn.

Parameters
dirnameis a directory containing the XML test files
testNames(if not empty) specifies particular tests to run

◆ runTests()

void FunctionTestCollection::runTests ( ostream &  midStream,
list< string > &  lateStream 
)

Run the script and perform the tests.

Run the script commands on the current program. Collect any bulk output, and run tests over the output. Report test failures back to the caller

Parameters
midStreamis the output stream to write to during the test
lateStreamcollects messages for a final summary

The documentation for this class was generated from the following files: