* [PATCH 2/2] Replace assert_perror with assert
@ 2015-05-04 17:17 Max Filippov
0 siblings, 0 replies; 3+ messages in thread
From: Max Filippov @ 2015-05-04 17:17 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 7204 bytes --]
assert_perror is a GNU extension, it's not provided by uClibc and it's
only used in tests. Replace it with assert.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
tests/ChangeLog | 8 ++++++++
tests/backtrace-child.c | 4 ++--
tests/backtrace-data.c | 22 +++++++++++-----------
tests/backtrace-dwarf.c | 4 ++--
tests/backtrace.c | 10 +++++-----
5 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 11e96a7..a899947 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
+
+ * backtrace-child.c (stdarg, main): Replace assert_perror with assert.
+ * backtrace-data.c (memory_read, maps_lookup, set_initial_registers)
+ (main): Likewise.
+ * backtrace-dwarf.c (main): Likewise.
+ * backtrace.c (prepare_thread, exec_dump): Likewise.
+
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD)
diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c
index 788801c..40e7b32 100644
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -154,7 +154,7 @@ stdarg (int f UNUSED, ...)
if (ptraceme)
{
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
}
#ifdef __x86_64__
@@ -226,7 +226,7 @@ main (int argc UNUSED, char **argv)
{
errno = 0;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
}
if (gencore)
diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
index 01c1c00..5a93a9c 100644
--- a/tests/backtrace-data.c
+++ b/tests/backtrace-data.c
@@ -74,7 +74,7 @@ memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result,
errno = 0;
long l = ptrace (PTRACE_PEEKDATA, child, (void *) (uintptr_t) addr, NULL);
- assert_perror (errno);
+ assert (errno == 0);
*result = l;
/* We could also return false for failed ptrace. */
@@ -89,10 +89,10 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
{
char *fname;
int i = asprintf (&fname, "/proc/%ld/maps", (long) pid);
- assert_perror (errno);
+ assert (errno == 0);
assert (i > 0);
FILE *f = fopen (fname, "r");
- assert_perror (errno);
+ assert (errno == 0);
assert (f);
free (fname);
for (;;)
@@ -100,7 +100,7 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
// 37e3c22000-37e3c23000 rw-p 00022000 00:11 49532 /lib64/ld-2.14.90.so */
unsigned long start, end, offset;
i = fscanf (f, "%lx-%lx %*s %lx %*x:%*x %*x", &start, &end, &offset);
- assert_perror (errno);
+ assert (errno == 0);
assert (i == 3);
char *filename = strdup ("");
assert (filename);
@@ -121,7 +121,7 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
if (start <= addr && addr < end)
{
i = fclose (f);
- assert_perror (errno);
+ assert (errno == 0);
assert (i == 0);
*basep = start - offset;
@@ -171,7 +171,7 @@ set_initial_registers (Dwfl_Thread *thread,
struct user_regs_struct user_regs;
long l = ptrace (PTRACE_GETREGS, child, NULL, &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
Dwarf_Word dwarf_regs[17];
@@ -271,11 +271,11 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
switch (child)
{
case -1:
- assert_perror (errno);
+ assert (errno == 0);
assert (0);
case 0:;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
raise (SIGUSR1);
return 0;
@@ -285,7 +285,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
int status;
pid_t pid = waitpid (child, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid == child);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGUSR1);
@@ -303,7 +303,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
struct user_regs_struct user_regs;
long l = ptrace (PTRACE_GETREGS, child, NULL, &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
report_module (dwfl, child, user_regs.rip);
@@ -317,7 +317,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
dwfl_end (dwfl);
kill (child, SIGKILL);
pid = waitpid (child, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid == child);
assert (WIFSIGNALED (status));
assert (WTERMSIG (status) == SIGKILL);
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index fbcb22e..a644c8a 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -143,7 +143,7 @@ main (int argc __attribute__ ((unused)), char **argv)
abort ();
case 0:;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
cleanup_13_main ();
abort ();
@@ -154,7 +154,7 @@ main (int argc __attribute__ ((unused)), char **argv)
errno = 0;
int status;
pid_t got = waitpid (pid, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGABRT);
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 8b19b94..abd56ab 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -263,16 +263,16 @@ prepare_thread (pid_t pid2 __attribute__ ((unused)),
struct user_regs_struct user_regs;
errno = 0;
l = ptrace (PTRACE_GETREGS, pid2, 0, (intptr_t) &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
user_regs.rip = (intptr_t) jmp;
l = ptrace (PTRACE_SETREGS, pid2, 0, (intptr_t) &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
l = ptrace (PTRACE_CONT, pid2, NULL, (void *) (intptr_t) SIGUSR2);
int status;
pid_t got = waitpid (pid2, &status, __WALL);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid2);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGUSR1);
@@ -340,7 +340,7 @@ exec_dump (const char *exec)
errno = 0;
int status;
pid_t got = waitpid (pid, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid);
assert (WIFSTOPPED (status));
// Main thread will signal SIGUSR2. Other thread will signal SIGUSR1.
@@ -350,7 +350,7 @@ exec_dump (const char *exec)
__WCLONE, probably despite pthread_create already had to be called the new
task is not yet alive enough for waitpid. */
pid_t pid2 = waitpid (-1, &status, __WALL);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid2 > 0);
assert (pid2 != pid);
assert (WIFSTOPPED (status));
--
1.8.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] Replace assert_perror with assert
@ 2015-05-05 3:24 Mike Frysinger
0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2015-05-05 3:24 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
On 04 May 2015 20:17, Max Filippov wrote:
> assert_perror is a GNU extension, it's not provided by uClibc and it's
> only used in tests. Replace it with assert.
if the elfutils guys are happy with this ...
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] Replace assert_perror with assert
@ 2015-05-05 11:11 Mark Wielaard
0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2015-05-05 11:11 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
On Mon, May 04, 2015 at 08:17:52PM +0300, Max Filippov wrote:
> assert_perror is a GNU extension, it's not provided by uClibc and it's
> only used in tests. Replace it with assert.
Thanks. Pushed to master.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-05 11:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 17:17 [PATCH 2/2] Replace assert_perror with assert Max Filippov
2015-05-05 3:24 Mike Frysinger
2015-05-05 11:11 Mark Wielaard
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).