Fix test failure with -DNDEBUG.
Commit Message
The elf/tst-dlopen-aout.c test uses asserts to verify properties
of the test execution. Instead of using assert it should use
TEST_VERIFY to avoid the situation where the assert is removed
by building with -DNDEBUG. This shows up in Fedora 28 when building
for i686-pc-linux-gnu and using gcc 8.1.1. The fix is to use
TEST_VERIFY which is not impacted by -DNDEBUG.
Tested on i686, and fixes a check failure with -DNDEBUG.
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Comments
On 08/30/2018 05:08 PM, Carlos O'Donell wrote:
> rc = pthread_create (&thr, NULL, fn, NULL);
> - assert (rc == 0);
> + TEST_VERIFY (rc == 0);
>
> rc = pthread_join (thr, NULL);
> - assert (rc == 0);
> + TEST_VERIFY (rc == 0);
Both should actually be TEST_VERIFY_EXIT, I assume, and that would be
close to xpthread_create and xpthread_join.
Thanks,
Florian
From c1dc1f0b4c7f477c9ff66165fd873420aa7a6e74 Mon Sep 17 00:00:00 2001
From: Carlos O'Donell <carlos@redhat.com>
Date: Thu, 30 Aug 2018 11:01:33 -0400
Subject: [PATCH] Fix test failure with -DNDEBUG.
The elf/tst-dlopen-aout.c test uses asserts to verify properties
of the test execution. Instead of using assert it should use
TEST_VERIFY to avoid the situation where the assert is removed
by building with -DNDEBUG. This shows up in Fedora 28 when building
for i686-pc-linux-gnu and using gcc 8.1.1. The fix is to use
TEST_VERIFY which is not impacted by -DNDEBUG.
Tested on i686, and fixes a check failure with -DNDEBUG.
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
---
ChangeLog | 4 ++++
elf/tst-dlopen-aout.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
@@ -1,3 +1,7 @@
+2018-02-30 Carlos O'Donell <carlos@redhat.com>
+
+ * elf/tst-dlopen-aout.c: Include support/check.h. Use TEST_VERIFY.
+
2018-08-28 Joseph Myers <joseph@codesourcery.com>
* sysdeps/aarch64/fpu/fenv_private.h: New file. Based on ....
@@ -27,6 +27,7 @@
#include <dlfcn.h>
#include <stdio.h>
#include <pthread.h>
+#include <support/check.h>
__thread int x;
@@ -54,10 +55,10 @@ do_test (int argc, char *argv[])
return 1;
}
rc = pthread_create (&thr, NULL, fn, NULL);
- assert (rc == 0);
+ TEST_VERIFY (rc == 0);
rc = pthread_join (thr, NULL);
- assert (rc == 0);
+ TEST_VERIFY (rc == 0);
}
return 0;
--
2.17.1