[v2] powerpc: Convert tests to the new support test-driver
Commit Message
Changes since v1:
- Uses TEST_VERIFY_EXIT macro to check status of xpthread_join.
Notice it is expected status == NULL for a success join.
Depends on http://sourceware.org/ml/libc-alpha/2016-12/msg01021.html
that introduced the TEST_VERIFY_EXIT macro.
-- >8 --
Change the powerpc tests to use <support/test-driver.c>.
Also replace some of pthread calls to its xpthread equivalent.
Tested on ppc64le.
2016-12-15 Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
* sysdeps/powerpc/test-get_hwcap.c: Use <support/test-driver.c>
instead of test-skeleton.c.
(do_test): Replaced pthread_create and pthread_join with
xpthread_create and xpthread_join.
(do_test): Use TEST_VERIFY_EXIT macro.
* sysdeps/powerpc/test-gettimebase.c: Use <support/test-driver.c>
instead of test-skeleton.c.
* sysdeps/powerpc/tst-tlsopt-powerpc.c: Likewise.
---
sysdeps/powerpc/test-get_hwcap.c | 23 +++++++----------------
sysdeps/powerpc/test-gettimebase.c | 3 +--
sysdeps/powerpc/tst-tlsopt-powerpc.c | 3 +--
3 files changed, 9 insertions(+), 20 deletions(-)
Comments
On 01/02/2017 06:24 PM, Wainer dos Santos Moschetta wrote:
> Changes since v1:
> - Uses TEST_VERIFY_EXIT macro to check status of xpthread_join.
> Notice it is expected status == NULL for a success join.
>
> Depends onhttp://sourceware.org/ml/libc-alpha/2016-12/msg01021.html
> that introduced the TEST_VERIFY_EXIT macro.
>
> -- >8 --
> Change the powerpc tests to use <support/test-driver.c>.
> Also replace some of pthread calls to its xpthread equivalent.
> + status = xpthread_join (threads[i]);
> + TEST_VERIFY_EXIT (status == NULL);
Can we avoid extra variable status?
@@ -23,6 +23,9 @@
#include <stdint.h>
#include <pthread.h>
+#include <support/check.h>
+#include <support/xthread.h>
+
#include <sys/auxv.h>
#include <dl-procinfo.h>
@@ -160,22 +163,11 @@ do_test (void)
/* Check for other thread. */
i++;
- if (pthread_create (&threads[i], &attr, t1, (void *)i))
- {
- printf ("FAIL: error creating thread %ld.\n", i);
- return 1;
- }
+ threads[i] = xpthread_create (&attr, t1, (void *)i);
pthread_attr_destroy (&attr);
- if (pthread_join (threads[i], &status))
- {
- printf ("FAIL: error joining thread %ld.\n", i);
- return 1;
- }
- if (status)
- {
- return 1;
- }
+ status = xpthread_join (threads[i]);
+ TEST_VERIFY_EXIT (status == NULL);
printf("PASS: HWCAP, HWCAP2 and AT_PLATFORM are correctly set in the TCB for"
" all threads.\n");
@@ -184,5 +176,4 @@ do_test (void)
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
@@ -43,5 +43,4 @@ do_test (void)
return 1;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
@@ -8,7 +8,6 @@
COMMON_INT_DEF(foo);
-#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
@@ -49,4 +48,4 @@ do_test (void)
return result;
}
-#include "../../test-skeleton.c"
+#include <support/test-driver.c>