diff mbox

[v3] powerpc: Convert tests to the new support test-driver

Message ID 20170207130221.11945-1-wainersm@linux.vnet.ibm.com
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers show

Commit Message

Wainer dos Santos Moschetta Feb. 7, 2017, 1:02 p.m. UTC
Changes since v2:
 - Removed unneeded status variable.

--- 8< ---
Change the powerpc tests to use <support/test-driver.c>.
Also replace some of pthread calls to its xpthread equivalent.

Tested on ppc64le.

2017-02-06  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.
	(do_test): Removed unneeded status variable.
	* 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, 8 insertions(+), 21 deletions(-)

Comments

Rajalakshmi S Feb. 7, 2017, 4:18 p.m. UTC | #1
On 02/07/2017 06:32 PM, Wainer dos Santos Moschetta wrote:
> Change the powerpc tests to use <support/test-driver.c>.
> Also replace some of pthread calls to its xpthread equivalent.
>
> Tested on ppc64le.
>
> 2017-02-06  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.
> 	(do_test): Removed unneeded status variable.
> 	* sysdeps/powerpc/test-gettimebase.c: Use <support/test-driver.c>
> 	instead of test-skeleton.c.
> 	* sysdeps/powerpc/tst-tlsopt-powerpc.c: Likewise.

LGTM
Carlos Eduardo Seo Feb. 7, 2017, 4:55 p.m. UTC | #2
On 2/7/17, 11:02 AM, "Wainer dos Santos Moschetta" <libc-alpha-owner@sourceware.org on behalf of wainersm@linux.vnet.ibm.com> wrote:

    Changes since v2:
     - Removed unneeded status variable.
    
    --- 8< ---
    Change the powerpc tests to use <support/test-driver.c>.
    Also replace some of pthread calls to its xpthread equivalent.
    
    Tested on ppc64le.
    
 
LGTM


--
Carlos Eduardo Seo
Software Engineer - Linux on Power Toolchain
cseo@linux.vnet.ibm.com
Tulio Magno Quites Machado Filho Feb. 21, 2017, 5:04 p.m. UTC | #3
Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com> writes:

> Changes since v2:
>  - Removed unneeded status variable.
>
> --- 8< ---
> Change the powerpc tests to use <support/test-driver.c>.
> Also replace some of pthread calls to its xpthread equivalent.
>
> Tested on ppc64le.
>
> 2017-02-06  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.
> 	(do_test): Removed unneeded status variable.
> 	* sysdeps/powerpc/test-gettimebase.c: Use <support/test-driver.c>
> 	instead of test-skeleton.c.
> 	* sysdeps/powerpc/tst-tlsopt-powerpc.c: Likewise.

Pushed as ee6df1e.
diff mbox

Patch

diff --git a/sysdeps/powerpc/test-get_hwcap.c b/sysdeps/powerpc/test-get_hwcap.c
index f32ad63..d776310 100644
--- a/sysdeps/powerpc/test-get_hwcap.c
+++ b/sysdeps/powerpc/test-get_hwcap.c
@@ -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>
@@ -148,7 +151,6 @@  do_test (void)
   pthread_attr_t attr;
   pthread_attr_init (&attr);
   pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_JOINABLE);
-  void *status;
 
   long i = 0;
 
@@ -160,22 +162,10 @@  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;
-    }
+  TEST_VERIFY_EXIT (xpthread_join (threads[i]) == NULL);
 
   printf("PASS: HWCAP, HWCAP2 and AT_PLATFORM are correctly set in the TCB for"
 	 " all threads.\n");
@@ -184,5 +174,4 @@  do_test (void)
 
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/sysdeps/powerpc/test-gettimebase.c b/sysdeps/powerpc/test-gettimebase.c
index 555f146..0e8e2f0 100644
--- a/sysdeps/powerpc/test-gettimebase.c
+++ b/sysdeps/powerpc/test-gettimebase.c
@@ -43,5 +43,4 @@  do_test (void)
   return 1;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/sysdeps/powerpc/tst-tlsopt-powerpc.c b/sysdeps/powerpc/tst-tlsopt-powerpc.c
index c9a14cb..8ae928a 100644
--- a/sysdeps/powerpc/tst-tlsopt-powerpc.c
+++ b/sysdeps/powerpc/tst-tlsopt-powerpc.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>