From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH] Add better error messaging to several tests
Date: Mon, 20 Jun 2022 17:08:30 +0200 [thread overview]
Message-ID: <877d5bid8x.fsf@redhat.com> (raw)
Hello,
When test-read-dwarf and test-diff-filter fail, it's important to know
what exact command line failed. This patch makes these tests display
the failing command.
* tests/test-diff-filter.cc (test_task::perform): Display the
failing command.
* tests/test-read-common.cc (test_task::run_abidw): Likewise.
* tests/test-read-common.h (test_task::run_diff): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
tests/test-diff-filter.cc | 3 +++
tests/test-read-common.cc | 8 +++++---
tests/test-read-common.h | 4 ++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tests/test-diff-filter.cc b/tests/test-diff-filter.cc
index e90adafe..72a1bc93 100644
--- a/tests/test-diff-filter.cc
+++ b/tests/test-diff-filter.cc
@@ -902,6 +902,9 @@ struct test_task : public abigail::workers::task
}
else
is_ok = false;
+
+ if (!abidiff_ok)
+ error_message += "cmd failed: " + cmd;
}
}; //end struct test_task.
diff --git a/tests/test-read-common.cc b/tests/test-read-common.cc
index b441945c..b794a311 100644
--- a/tests/test-read-common.cc
+++ b/tests/test-read-common.cc
@@ -108,7 +108,8 @@ test_task::run_abidw(const string& extargs)
+ in_abi_path
+ "\nand:\n"
+ out_abi_path
- + "\n";
+ + "\n"
+ + "command was: '" + cmd + "'\n";
return false;
}
@@ -131,11 +132,12 @@ test_task::run_diff()
string cmd = "diff -u " + in_abi_path + " " + out_abi_path;
if (system(cmd.c_str()))
{
- error_message = string("ABIs differ:\n")
+ error_message = string("ABI files differ:\n")
+ in_abi_path
+ "\nand:\n"
+ out_abi_path
- + "\n";
+ + "\n"
+ + "command was: '" + cmd + "'\n";
return false;
}
diff --git a/tests/test-read-common.h b/tests/test-read-common.h
index 00d4d1d1..4277896a 100644
--- a/tests/test-read-common.h
+++ b/tests/test-read-common.h
@@ -101,6 +101,10 @@ struct test_task : public abigail::workers::task
bool
set_out_abi_path()
{
+ if (!spec.out_abi_path)
+ // No output abi path was specified in the spec, so get out.
+ return false;
+
out_abi_path = out_abi_base + spec.out_abi_path;
if (!abigail::tools_utils::ensure_parent_dir_created(out_abi_path))
{
--
2.36.1
--
Dodji
reply other threads:[~2022-06-20 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877d5bid8x.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).