libabigail
Loading...
Searching...
No Matches
test-read-common.cc File Reference

This file implements the common functionality for the tests in CTF and DWARF readers, it does the abstraction in the `act` test stage. More...

#include <fstream>
#include <cstring>
#include "test-read-common.h"
Include dependency graph for test-read-common.cc:

Go to the source code of this file.

Namespaces

namespace  abigail
 Toplevel namespace for libabigail.
 

Typedefs

typedef shared_ptr< write_context > write_context_sptr
 A convenience typedef for a shared pointer to write_context.
 

Functions

write_context_sptr create_write_context (const environment &env, ostream &default_output_stream)
 Create a write_context object that can be used to emit abixml files.
 
void display_usage (const string &prog_name, ostream &out)
 Write the usage message to out stream object.
 
ostream & emit_prefix (const string &prog_name, ostream &out)
 Emit a prefix made of the name of the program which is emitting a message to an output stream.
 
bool parse_command_line (int argc, char *argv[], options &opts)
 Parse and process test options.
 
bool run_tests (const size_t num_tests, const InOutSpec *specs, const options &opts, create_new_test new_test)
 The main entry point to execute the testsuite.
 
bool write_corpus (write_context &ctxt, const corpus_sptr &corpus, unsigned indent, bool member_of_group)
 Serialize an ABI corpus to a single native xml document. The root note of the resulting XML document is 'abi-corpus'.
 

Detailed Description

This file implements the common functionality for the tests in CTF and DWARF readers, it does the abstraction in the `act` test stage.

Definition in file test-read-common.cc.

Typedef Documentation

◆ write_context_sptr

typedef shared_ptr<write_context> write_context_sptr

A convenience typedef for a shared pointer to write_context.

Definition at line 36 of file abg-writer.h.

Function Documentation

◆ create_write_context()

write_context_sptr create_write_context ( const environment & env,
ostream & default_output_stream )

Create a write_context object that can be used to emit abixml files.

Parameters
envthe environment for the write_context object to use.
default_output_streamthe default output stream to use.
Returns
the new write_context object.

Definition at line 2212 of file abg-writer.cc.

◆ display_usage()

void display_usage ( const string & prog_name,
ostream & out )

Write the usage message to out stream object.

Parameters
prog_namethe program name.
outthe stream object to which want to write.

Definition at line 152 of file test-read-common.cc.

◆ emit_prefix()

ostream & emit_prefix ( const string & prog_name,
ostream & out )

Emit a prefix made of the name of the program which is emitting a message to an output stream.

The prefix is a string which looks like:

"<program-name> : "

Parameters
prog_namethe name of the program to use in the prefix.
outthe output stream where to emit the prefix.
Returns
the output stream where the prefix was emitted.

Definition at line 886 of file abg-tools-utils.cc.

◆ parse_command_line()

bool parse_command_line ( int argc,
char * argv[],
options & opts )

Parse and process test options.

Parameters
argcthe arguments number.
argvthe pointer to the arguments.
optsthe valid options to be processed/parsed.
Returns
true if options was processed/parsed successfully. It returns false when help is requested or an invalid option is supplied.

Definition at line 173 of file test-read-common.cc.

◆ run_tests()

bool run_tests ( const size_t num_tests,
const InOutSpec * specs,
const options & opts,
create_new_test new_test )

The main entry point to execute the testsuite.

Parameters
num_teststhe number of tests to be executed.
specsthe InOutSpec tests container.
optsthe test execution options.
new_testthe create_new_test callback function to create a new test task object.
Returns
true if `all` tests were performed successfully. Otherwise false is returned.

Definition at line 208 of file test-read-common.cc.

◆ write_corpus()

bool write_corpus ( write_context & ctxt,
const corpus_sptr & corpus,
unsigned indent,
bool member_of_group = false )

Serialize an ABI corpus to a single native xml document. The root note of the resulting XML document is 'abi-corpus'.

Note: If either corpus is null or corpus does not contain serializable content (i.e. corpus.is_empty()), nothing is emitted to the ctxt's output stream.

Parameters
ctxtthe write context to use.
corpusthe corpus to serialize.
indentthe number of white space indentation to use.
Returns
true upon successful completion, false otherwise.

Definition at line 4675 of file abg-writer.cc.