16 using std::dynamic_pointer_cast;
19 using abigail::tests::get_build_dir;
45 string& a_out_abi_base,
46 string& a_in_elf_base,
47 string& a_in_abi_base)
50 out_abi_base(a_out_abi_base),
51 in_elf_base(a_in_elf_base),
52 in_abi_base(a_in_abi_base)
67 ofstream of(out_abi_path.c_str(), std::ios_base::trunc);
70 error_message = string(
"failed to read ") + out_abi_path +
"\n";
97 string abidw = string(get_build_dir()) +
"/tools/abidw";
98 string drop_private_types;
99 string spec_options = spec.options ? spec.options :
"";
102 if (!in_public_headers_path.empty())
103 drop_private_types +=
"--headers-dir " + in_public_headers_path +
104 " --drop-private-types";
105 string cmd = abidw +
" " + spec_options + drop_private_types +
106 " --abidiff " + extargs + in_elf_path;
107 if (system(cmd.c_str()))
109 error_message = string(
"ABIs differ:\n")
114 +
"command was: '" + cmd +
"'\n";
134 string cmd =
"diff -u " + in_abi_path +
" " + out_abi_path;
135 if (system(cmd.c_str()))
137 error_message = string(
"ABI files differ:\n")
142 +
"command was: '" + cmd +
"'\n";
159 <<
"usage: " << prog_name <<
" [options]\n"
160 <<
" where options can be: \n"
161 <<
" --help|-h display this message\n"
162 <<
" --no-parallel execute testsuite is a sigle thread\n"
179 for (
int i = 1; i < argc; ++i)
181 if (!strcmp(argv[i],
"--no-parallel"))
182 opts.parallel =
false;
183 else if (!strcmp(argv[i],
"--help")
184 || !strcmp(argv[i],
"--h"))
188 if (strlen(argv[i]) >= 2 && argv[i][0] ==
'-' && argv[i][1] ==
'-')
189 opts.wrong_option = argv[i];
213 const options& opts, create_new_test new_test)
215 size_t num_workers = (opts.parallel
228 string out_abi_base = string(get_build_dir()) +
"/tests/";
229 string in_elf_base = string(abigail::tests::get_src_dir()) +
"/tests/";
230 string in_abi_base = in_elf_base;
232 for (
const InOutSpec *s = specs; s->in_elf_path; ++s)
234 test_task_sptr t(new_test(s, out_abi_base,
246 const vector<abigail::workers::task_sptr>& completed_tasks =
249 ABG_ASSERT(completed_tasks.size() == num_tests);
251 for (vector<abigail::workers::task_sptr>::const_iterator ti =
252 completed_tasks.begin();
253 ti != completed_tasks.end();
256 test_task_sptr t = dynamic_pointer_cast<test_task>(*ti);
260 if (!t->error_message.empty())
261 cerr << t->error_message <<
'\n';
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects,...
This represents a queue of tasks to be performed.
tasks_type & get_completed_tasks() const
Getter of the vector of tasks that got performed.
void wait_for_workers_to_complete()
Suspends the current thread until all worker threads finish performing the tasks they are executing.
bool schedule_task(const task_sptr &)
Submit a task to the queue of tasks to be performed.
size_t get_number_of_threads()
void set_write_undefined_symbols(write_context &ctxt, bool flag)
Set the 'undefined-symbols' flag.
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.
shared_ptr< write_context > write_context_sptr
A convenience typedef for a shared pointer to write_context.
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 ...
void set_type_id_style(write_context &ctxt, type_id_style_kind style)
Set the 'type-id-style' property.
Toplevel namespace for libabigail.
This is an aggregate that specifies where a test shall get its input from, and where it shall write i...
An abstraction for valid test options.
bool serialize_corpus(const string &out_abi_path, corpus_sptr corp)
Serialize the abixml out_abi_path file.
test_task(const InOutSpec &s, string &a_out_abi_base, string &a_in_elf_base, string &a_in_abi_base)
Constructor.
void set_in_abi_path()
A setter for `in_abi_path` field. The `in_abi_path` is the full path for the expected abixml file.
bool run_abidw(const string &extargs="")
Spawn `abidw –abidiff` tool appending extargs argument.
bool run_diff()
Spawn external `diff` command.
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 parse_command_line(int argc, char *argv[], options &opts)
Parse and process test options.
void display_usage(const string &prog_name, ostream &out)
Write the usage message to out stream object.
This file declares the common functionality for tests in CTF and DWARF readers, it declares abstracti...