[v2] Update elf tests to use the support test driver.

Message ID 20170403182607.6014-1-wainersm@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wainer dos Santos Moschetta April 3, 2017, 6:26 p.m.
Changes since v1:
- Undo changes in return of do_test functions.
- Better explain the changelog.

--- >8 ---
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.

Checked on x86_64.

2017-04-03  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>

	* elf/next.c: Import support/test-driver.c instead of
	test-skeleton.c and delete TEST_FUNCTION macro definition.
	* elf/nodelete.c: Likewise.
	* elf/order2.c: Likewise.
	* elf/tst-_dl_addr_inside_object.c: Likewise.
	* elf/tst-addr1.c: Likewise.
	* elf/tst-align.c: Likewise.
	* elf/tst-align2.c: Likewise.
	* elf/tst-audit11.c: Likewise.
	* elf/tst-audit12.c: Likewise.
	* elf/tst-audit2.c: Likewise.
	* elf/tst-audit9.c: Likewise.
	* elf/tst-auxv.c: Likewise and define
	TEST_FUNCTION_ARGV macro.
	* elf/tst-deep1.c: Likewise.
	* elf/tst-dl-iter-static.c: Likewise.
	* elf/tst-dlmodcount.c: Likewise.
	* elf/tst-dlmopen1.c: Likewise.
	* elf/tst-dlmopen2.c: Likewise.
	* elf/tst-dlmopen3.c: Likewise.
	* elf/tst-dlopen-aout.c: Likewise.
	* elf/tst-dlopenrpath.c: Likewise.
	* elf/tst-dlsym-error.c: Likewise.
	* elf/tst-execstack-needed.c: Likewise.
	* elf/tst-execstack-prog.c: Likewise.
	* elf/tst-execstack.c: Likewise.
	* elf/tst-global1.c: Likewise.
	* elf/tst-gnu2-tls1.c: Likewise.
	* elf/tst-latepthread.c: Likewise.
	* elf/tst-leaks1.c: Likewise.
	* elf/tst-linkall-static.c: Likewise.
	(do_test): New function.
	* elf/tst-nodelete-opened.c: Likewise.
	* elf/tst-nodelete.cc: Likewise.
	* elf/tst-nodelete2.c: Likewise.
	* elf/tst-noload.c: Likewise.
	* elf/tst-null-argv.c: Likewise and define
	TEST_FUNCTION_ARGV marcro.
	* elf/tst-order-main.c: Likewise.
	* elf/tst-pathopt.c: Likewise.
	* elf/tst-pie2.c: Likewise.
	* elf/tst-piemod1.c: Likewise.
	* elf/tst-prelink.c: Likewise.
	* elf/tst-protected1a.c: Likewise.
	* elf/tst-protected1b.c: Likewise.
	* elf/tst-ptrguard1.c: Likewise, import getopt.h,
	and define _GNU_SOURCE macro.
	(cmdline_process_function): New function.
	* elf/tst-relsort1.c: Likewise.
	* elf/tst-stackguard1.c: Likewise, import getopt.h,
	and define _GNU_SOURCE macro.
	(cmdline_process_function): New function.
	* elf/tst-thrlock.c: Likewise.
	* elf/tst-tls-dlinfo.c: Likewise.
	* elf/tst-tls-manydynamic.c: Likewise and import
	support/xthread.h.
	* elf/tst-tls1.c: Likewise.
	* elf/tst-tls10.c: Likewise.
	* elf/tst-tls11.c: Likewise.
	* elf/tst-tls12.c: Likewise.
	* elf/tst-tls13.c: Likewise.
	* elf/tst-tls14.c: Likewise.
	* elf/tst-tls15.c: Likewise.
	* elf/tst-tls16.c: Likewise.
	* elf/tst-tls17.c: Likewise.
	* elf/tst-tls18.c: Likewise.
	* elf/tst-tls19.c: Likewise.
	* elf/tst-tls2.c: Likewise.
	* elf/tst-tls3.c: Likewise.
	* elf/tst-tls4.c: Likewise.
	* elf/tst-tls5.c: Likewise.
	* elf/tst-tls6.c: Likewise.
	* elf/tst-tls7.c: Likewise.
	* elf/tst-tls8.c: Likewise.
	* elf/tst-tls9.c: Likewise.
	* elf/tst-tlsalign-extern.c: Likewise.
	* elf/tst-tlsalign.c: Likewise.
	* elf/tst-unique1.c: Likewise.
	* elf/tst-unique2.c: Likewise.
	* elf/vismain.c: Likewise.
---
 elf/next.c                       |  3 +--
 elf/nodelete.c                   |  3 +--
 elf/order2.c                     |  3 +--
 elf/tst-_dl_addr_inside_object.c |  3 +--
 elf/tst-addr1.c                  |  3 +--
 elf/tst-align.c                  |  3 +--
 elf/tst-align2.c                 |  3 +--
 elf/tst-audit11.c                |  3 +--
 elf/tst-audit12.c                |  3 +--
 elf/tst-audit2.c                 |  3 +--
 elf/tst-audit9.c                 |  3 +--
 elf/tst-auxv.c                   |  3 ++-
 elf/tst-deep1.c                  |  3 +--
 elf/tst-dl-iter-static.c         |  3 +--
 elf/tst-dlmodcount.c             |  3 +--
 elf/tst-dlmopen1.c               |  3 +--
 elf/tst-dlmopen2.c               |  3 +--
 elf/tst-dlmopen3.c               |  3 +--
 elf/tst-dlopen-aout.c            |  2 +-
 elf/tst-dlopenrpath.c            |  3 +--
 elf/tst-dlsym-error.c            |  3 +--
 elf/tst-execstack-needed.c       |  4 +---
 elf/tst-execstack-prog.c         |  4 +---
 elf/tst-execstack.c              |  3 +--
 elf/tst-global1.c                |  3 +--
 elf/tst-gnu2-tls1.c              |  3 +--
 elf/tst-latepthread.c            |  3 +--
 elf/tst-leaks1.c                 |  3 +--
 elf/tst-linkall-static.c         | 11 ++++++++---
 elf/tst-nodelete-opened.c        |  3 +--
 elf/tst-nodelete.cc              |  3 +--
 elf/tst-nodelete2.c              |  3 +--
 elf/tst-noload.c                 |  3 +--
 elf/tst-null-argv.c              |  3 ++-
 elf/tst-order-main.c             |  3 +--
 elf/tst-pathopt.c                |  3 +--
 elf/tst-pie2.c                   |  3 +--
 elf/tst-piemod1.c                |  3 +--
 elf/tst-prelink.c                |  3 +--
 elf/tst-protected1a.c            |  4 +---
 elf/tst-protected1b.c            |  4 +---
 elf/tst-ptrguard1.c              | 33 ++++++++++++++++++++++++---------
 elf/tst-relsort1.c               |  3 +--
 elf/tst-stackguard1.c            | 27 ++++++++++++++++++---------
 elf/tst-thrlock.c                |  3 +--
 elf/tst-tls-dlinfo.c             |  3 +--
 elf/tst-tls-manydynamic.c        |  5 +++--
 elf/tst-tls1.c                   |  3 +--
 elf/tst-tls10.c                  |  3 +--
 elf/tst-tls11.c                  |  3 +--
 elf/tst-tls12.c                  |  3 +--
 elf/tst-tls13.c                  |  3 +--
 elf/tst-tls14.c                  |  3 +--
 elf/tst-tls15.c                  |  3 +--
 elf/tst-tls16.c                  |  3 +--
 elf/tst-tls17.c                  |  3 +--
 elf/tst-tls18.c                  |  3 +--
 elf/tst-tls19.c                  |  3 +--
 elf/tst-tls2.c                   |  3 +--
 elf/tst-tls3.c                   |  3 +--
 elf/tst-tls4.c                   |  3 +--
 elf/tst-tls5.c                   |  3 +--
 elf/tst-tls6.c                   |  3 +--
 elf/tst-tls7.c                   |  3 +--
 elf/tst-tls8.c                   |  4 +---
 elf/tst-tls9.c                   |  3 +--
 elf/tst-tlsalign-extern.c        |  3 +--
 elf/tst-tlsalign.c               |  3 +--
 elf/tst-unique1.c                |  3 +--
 elf/tst-unique2.c                |  3 +--
 elf/vismain.c                    |  3 +--
 71 files changed, 122 insertions(+), 159 deletions(-)

Comments

Adhemerval Zanella April 3, 2017, 8:02 p.m. | #1
LGTM.

On 03/04/2017 15:26, Wainer dos Santos Moschetta wrote:
> Changes since v1:
> - Undo changes in return of do_test functions.
> - Better explain the changelog.
> 
> --- >8 ---
> Replaced test-skeleton.c with support/test-driver.c and
> adjusted the tests accordinly.
> 
> Checked on x86_64.
> 
> 2017-04-03  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
> 
> 	* elf/next.c: Import support/test-driver.c instead of
> 	test-skeleton.c and delete TEST_FUNCTION macro definition.
> 	* elf/nodelete.c: Likewise.
> 	* elf/order2.c: Likewise.
> 	* elf/tst-_dl_addr_inside_object.c: Likewise.
> 	* elf/tst-addr1.c: Likewise.
> 	* elf/tst-align.c: Likewise.
> 	* elf/tst-align2.c: Likewise.
> 	* elf/tst-audit11.c: Likewise.
> 	* elf/tst-audit12.c: Likewise.
> 	* elf/tst-audit2.c: Likewise.
> 	* elf/tst-audit9.c: Likewise.
> 	* elf/tst-auxv.c: Likewise and define
> 	TEST_FUNCTION_ARGV macro.
> 	* elf/tst-deep1.c: Likewise.
> 	* elf/tst-dl-iter-static.c: Likewise.
> 	* elf/tst-dlmodcount.c: Likewise.
> 	* elf/tst-dlmopen1.c: Likewise.
> 	* elf/tst-dlmopen2.c: Likewise.
> 	* elf/tst-dlmopen3.c: Likewise.
> 	* elf/tst-dlopen-aout.c: Likewise.
> 	* elf/tst-dlopenrpath.c: Likewise.
> 	* elf/tst-dlsym-error.c: Likewise.
> 	* elf/tst-execstack-needed.c: Likewise.
> 	* elf/tst-execstack-prog.c: Likewise.
> 	* elf/tst-execstack.c: Likewise.
> 	* elf/tst-global1.c: Likewise.
> 	* elf/tst-gnu2-tls1.c: Likewise.
> 	* elf/tst-latepthread.c: Likewise.
> 	* elf/tst-leaks1.c: Likewise.
> 	* elf/tst-linkall-static.c: Likewise.
> 	(do_test): New function.
> 	* elf/tst-nodelete-opened.c: Likewise.
> 	* elf/tst-nodelete.cc: Likewise.
> 	* elf/tst-nodelete2.c: Likewise.
> 	* elf/tst-noload.c: Likewise.
> 	* elf/tst-null-argv.c: Likewise and define
> 	TEST_FUNCTION_ARGV marcro.
> 	* elf/tst-order-main.c: Likewise.
> 	* elf/tst-pathopt.c: Likewise.
> 	* elf/tst-pie2.c: Likewise.
> 	* elf/tst-piemod1.c: Likewise.
> 	* elf/tst-prelink.c: Likewise.
> 	* elf/tst-protected1a.c: Likewise.
> 	* elf/tst-protected1b.c: Likewise.
> 	* elf/tst-ptrguard1.c: Likewise, import getopt.h,
> 	and define _GNU_SOURCE macro.
> 	(cmdline_process_function): New function.
> 	* elf/tst-relsort1.c: Likewise.
> 	* elf/tst-stackguard1.c: Likewise, import getopt.h,
> 	and define _GNU_SOURCE macro.
> 	(cmdline_process_function): New function.
> 	* elf/tst-thrlock.c: Likewise.
> 	* elf/tst-tls-dlinfo.c: Likewise.
> 	* elf/tst-tls-manydynamic.c: Likewise and import
> 	support/xthread.h.
> 	* elf/tst-tls1.c: Likewise.
> 	* elf/tst-tls10.c: Likewise.
> 	* elf/tst-tls11.c: Likewise.
> 	* elf/tst-tls12.c: Likewise.
> 	* elf/tst-tls13.c: Likewise.
> 	* elf/tst-tls14.c: Likewise.
> 	* elf/tst-tls15.c: Likewise.
> 	* elf/tst-tls16.c: Likewise.
> 	* elf/tst-tls17.c: Likewise.
> 	* elf/tst-tls18.c: Likewise.
> 	* elf/tst-tls19.c: Likewise.
> 	* elf/tst-tls2.c: Likewise.
> 	* elf/tst-tls3.c: Likewise.
> 	* elf/tst-tls4.c: Likewise.
> 	* elf/tst-tls5.c: Likewise.
> 	* elf/tst-tls6.c: Likewise.
> 	* elf/tst-tls7.c: Likewise.
> 	* elf/tst-tls8.c: Likewise.
> 	* elf/tst-tls9.c: Likewise.
> 	* elf/tst-tlsalign-extern.c: Likewise.
> 	* elf/tst-tlsalign.c: Likewise.
> 	* elf/tst-unique1.c: Likewise.
> 	* elf/tst-unique2.c: Likewise.
> 	* elf/vismain.c: Likewise.
> ---
>  elf/next.c                       |  3 +--
>  elf/nodelete.c                   |  3 +--
>  elf/order2.c                     |  3 +--
>  elf/tst-_dl_addr_inside_object.c |  3 +--
>  elf/tst-addr1.c                  |  3 +--
>  elf/tst-align.c                  |  3 +--
>  elf/tst-align2.c                 |  3 +--
>  elf/tst-audit11.c                |  3 +--
>  elf/tst-audit12.c                |  3 +--
>  elf/tst-audit2.c                 |  3 +--
>  elf/tst-audit9.c                 |  3 +--
>  elf/tst-auxv.c                   |  3 ++-
>  elf/tst-deep1.c                  |  3 +--
>  elf/tst-dl-iter-static.c         |  3 +--
>  elf/tst-dlmodcount.c             |  3 +--
>  elf/tst-dlmopen1.c               |  3 +--
>  elf/tst-dlmopen2.c               |  3 +--
>  elf/tst-dlmopen3.c               |  3 +--
>  elf/tst-dlopen-aout.c            |  2 +-
>  elf/tst-dlopenrpath.c            |  3 +--
>  elf/tst-dlsym-error.c            |  3 +--
>  elf/tst-execstack-needed.c       |  4 +---
>  elf/tst-execstack-prog.c         |  4 +---
>  elf/tst-execstack.c              |  3 +--
>  elf/tst-global1.c                |  3 +--
>  elf/tst-gnu2-tls1.c              |  3 +--
>  elf/tst-latepthread.c            |  3 +--
>  elf/tst-leaks1.c                 |  3 +--
>  elf/tst-linkall-static.c         | 11 ++++++++---
>  elf/tst-nodelete-opened.c        |  3 +--
>  elf/tst-nodelete.cc              |  3 +--
>  elf/tst-nodelete2.c              |  3 +--
>  elf/tst-noload.c                 |  3 +--
>  elf/tst-null-argv.c              |  3 ++-
>  elf/tst-order-main.c             |  3 +--
>  elf/tst-pathopt.c                |  3 +--
>  elf/tst-pie2.c                   |  3 +--
>  elf/tst-piemod1.c                |  3 +--
>  elf/tst-prelink.c                |  3 +--
>  elf/tst-protected1a.c            |  4 +---
>  elf/tst-protected1b.c            |  4 +---
>  elf/tst-ptrguard1.c              | 33 ++++++++++++++++++++++++---------
>  elf/tst-relsort1.c               |  3 +--
>  elf/tst-stackguard1.c            | 27 ++++++++++++++++++---------
>  elf/tst-thrlock.c                |  3 +--
>  elf/tst-tls-dlinfo.c             |  3 +--
>  elf/tst-tls-manydynamic.c        |  5 +++--
>  elf/tst-tls1.c                   |  3 +--
>  elf/tst-tls10.c                  |  3 +--
>  elf/tst-tls11.c                  |  3 +--
>  elf/tst-tls12.c                  |  3 +--
>  elf/tst-tls13.c                  |  3 +--
>  elf/tst-tls14.c                  |  3 +--
>  elf/tst-tls15.c                  |  3 +--
>  elf/tst-tls16.c                  |  3 +--
>  elf/tst-tls17.c                  |  3 +--
>  elf/tst-tls18.c                  |  3 +--
>  elf/tst-tls19.c                  |  3 +--
>  elf/tst-tls2.c                   |  3 +--
>  elf/tst-tls3.c                   |  3 +--
>  elf/tst-tls4.c                   |  3 +--
>  elf/tst-tls5.c                   |  3 +--
>  elf/tst-tls6.c                   |  3 +--
>  elf/tst-tls7.c                   |  3 +--
>  elf/tst-tls8.c                   |  4 +---
>  elf/tst-tls9.c                   |  3 +--
>  elf/tst-tlsalign-extern.c        |  3 +--
>  elf/tst-tlsalign.c               |  3 +--
>  elf/tst-unique1.c                |  3 +--
>  elf/tst-unique2.c                |  3 +--
>  elf/vismain.c                    |  3 +--
>  71 files changed, 122 insertions(+), 159 deletions(-)
> 
> diff --git a/elf/next.c b/elf/next.c
> index 6a3670c..a0d532b 100644
> --- a/elf/next.c
> +++ b/elf/next.c
> @@ -40,5 +40,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/nodelete.c b/elf/nodelete.c
> index 78364a2..c8d7115 100644
> --- a/elf/nodelete.c
> +++ b/elf/nodelete.c
> @@ -18,7 +18,6 @@ handler (int sig)
>  }
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -208,4 +207,4 @@ do_test (void)
>    return result;
>  }
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/order2.c b/elf/order2.c
> index 3dbfdd1..bcf266d 100644
> --- a/elf/order2.c
> +++ b/elf/order2.c
> @@ -34,8 +34,7 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
>  
>  static void
>  __attribute__ ((destructor))
> diff --git a/elf/tst-_dl_addr_inside_object.c b/elf/tst-_dl_addr_inside_object.c
> index 3def22a..1604b8d 100644
> --- a/elf/tst-_dl_addr_inside_object.c
> +++ b/elf/tst-_dl_addr_inside_object.c
> @@ -219,5 +219,4 @@ do_test (void)
>    return err;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
> index 637906e..68ff74a 100644
> --- a/elf/tst-addr1.c
> +++ b/elf/tst-addr1.c
> @@ -22,5 +22,4 @@ do_test (void)
>  	     && strcmp (i.dli_sname, "_IO_printf") != 0);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-align.c b/elf/tst-align.c
> index 4c14a3d..01b0b4f 100644
> --- a/elf/tst-align.c
> +++ b/elf/tst-align.c
> @@ -49,5 +49,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-align2.c b/elf/tst-align2.c
> index eeae609..78b66be 100644
> --- a/elf/tst-align2.c
> +++ b/elf/tst-align2.c
> @@ -152,5 +152,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-audit11.c b/elf/tst-audit11.c
> index c65301d..ff91a6b 100644
> --- a/elf/tst-audit11.c
> +++ b/elf/tst-audit11.c
> @@ -32,5 +32,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-audit12.c b/elf/tst-audit12.c
> index 4e9e63c..62ac5f2 100644
> --- a/elf/tst-audit12.c
> +++ b/elf/tst-audit12.c
> @@ -45,5 +45,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-audit2.c b/elf/tst-audit2.c
> index 1d69cd6..0e66f5c 100644
> --- a/elf/tst-audit2.c
> +++ b/elf/tst-audit2.c
> @@ -57,5 +57,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-audit9.c b/elf/tst-audit9.c
> index 7b90a5a..b9de1bf 100644
> --- a/elf/tst-audit9.c
> +++ b/elf/tst-audit9.c
> @@ -8,5 +8,4 @@ do_test (void)
>    return fp() - 1;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-auxv.c b/elf/tst-auxv.c
> index d2661d9..bc571c5 100644
> --- a/elf/tst-auxv.c
> +++ b/elf/tst-auxv.c
> @@ -66,4 +66,5 @@ do_test (int argc, char *argv[])
>    return 0;
>  }
>  
> -#include "../test-skeleton.c"
> +#define TEST_FUNCTION_ARGV do_test
> +#include <support/test-driver.c>
> diff --git a/elf/tst-deep1.c b/elf/tst-deep1.c
> index 5428d13..97dce7e 100644
> --- a/elf/tst-deep1.c
> +++ b/elf/tst-deep1.c
> @@ -32,5 +32,4 @@ do_test (void)
>    return foo () + f ();
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dl-iter-static.c b/elf/tst-dl-iter-static.c
> index 47de698..9a2758c 100644
> --- a/elf/tst-dl-iter-static.c
> +++ b/elf/tst-dl-iter-static.c
> @@ -43,5 +43,4 @@ do_test (void)
>    return status || count != 1;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlmodcount.c b/elf/tst-dlmodcount.c
> index 76bae85..34c5b25 100644
> --- a/elf/tst-dlmodcount.c
> +++ b/elf/tst-dlmodcount.c
> @@ -105,5 +105,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlmopen1.c b/elf/tst-dlmopen1.c
> index 5a05891..24145cf 100644
> --- a/elf/tst-dlmopen1.c
> +++ b/elf/tst-dlmopen1.c
> @@ -77,5 +77,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlmopen2.c b/elf/tst-dlmopen2.c
> index 0569997..8489ffb 100644
> --- a/elf/tst-dlmopen2.c
> +++ b/elf/tst-dlmopen2.c
> @@ -66,5 +66,4 @@ round %d, namespace %d: duplicate allocate of namespace %ld",
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
> index 26c86b2..8167507 100644
> --- a/elf/tst-dlmopen3.c
> +++ b/elf/tst-dlmopen3.c
> @@ -18,5 +18,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
> index d780f8c..34a1cdb 100644
> --- a/elf/tst-dlopen-aout.c
> +++ b/elf/tst-dlopen-aout.c
> @@ -64,4 +64,4 @@ do_test (int argc, char *argv[])
>  }
>  
>  #define TEST_FUNCTION do_test (argc, argv)
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlopenrpath.c b/elf/tst-dlopenrpath.c
> index ac72a1e..77346d3 100644
> --- a/elf/tst-dlopenrpath.c
> +++ b/elf/tst-dlopenrpath.c
> @@ -67,5 +67,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-dlsym-error.c b/elf/tst-dlsym-error.c
> index 22dcff4..fac8f10 100644
> --- a/elf/tst-dlsym-error.c
> +++ b/elf/tst-dlsym-error.c
> @@ -110,5 +110,4 @@ do_test (void)
>  }
>  
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-execstack-needed.c b/elf/tst-execstack-needed.c
> index 03090f7..8b794a3 100644
> --- a/elf/tst-execstack-needed.c
> +++ b/elf/tst-execstack-needed.c
> @@ -31,6 +31,4 @@ deeper (void (*f) (void))
>    memfrob (stack, sizeof stack);
>  }
>  
> -
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-execstack-prog.c b/elf/tst-execstack-prog.c
> index 5a66d63..8663153 100644
> --- a/elf/tst-execstack-prog.c
> +++ b/elf/tst-execstack-prog.c
> @@ -30,6 +30,4 @@ deeper (void (*f) (void))
>    memfrob (stack, sizeof stack);
>  }
>  
> -
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-execstack.c b/elf/tst-execstack.c
> index 02cc270..114f341 100644
> --- a/elf/tst-execstack.c
> +++ b/elf/tst-execstack.c
> @@ -233,5 +233,4 @@ deeper (void (*f) (void))
>  }
>  
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-global1.c b/elf/tst-global1.c
> index 4df335c..5dae74e 100644
> --- a/elf/tst-global1.c
> +++ b/elf/tst-global1.c
> @@ -35,5 +35,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-gnu2-tls1.c b/elf/tst-gnu2-tls1.c
> index 8acbfa6..b33b60a 100644
> --- a/elf/tst-gnu2-tls1.c
> +++ b/elf/tst-gnu2-tls1.c
> @@ -48,5 +48,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-latepthread.c b/elf/tst-latepthread.c
> index a0a55e4..ca2f822 100644
> --- a/elf/tst-latepthread.c
> +++ b/elf/tst-latepthread.c
> @@ -101,5 +101,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-leaks1.c b/elf/tst-leaks1.c
> index dcff28d..d67e826 100644
> --- a/elf/tst-leaks1.c
> +++ b/elf/tst-leaks1.c
> @@ -24,5 +24,4 @@ do_test (void)
>    return ret;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-linkall-static.c b/elf/tst-linkall-static.c
> index 964cd7a..8f40657 100644
> --- a/elf/tst-linkall-static.c
> +++ b/elf/tst-linkall-static.c
> @@ -42,6 +42,11 @@ void *references[] =
>      &getaddrinfo_a,             /* libanl */
>    };
>  
> -/* This is a link-time test.  There is nothing to run here.  */
> -#define TEST_FUNCTION 0
> -#include "../test-skeleton.c"
> +static int
> +do_test (void)
> +{
> +  /* This is a link-time test.  There is nothing to run here.  */
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>
> diff --git a/elf/tst-nodelete-opened.c b/elf/tst-nodelete-opened.c
> index 9db49da..d71efa4 100644
> --- a/elf/tst-nodelete-opened.c
> +++ b/elf/tst-nodelete-opened.c
> @@ -65,5 +65,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-nodelete.cc b/elf/tst-nodelete.cc
> index 176cb68..5752e7d 100644
> --- a/elf/tst-nodelete.cc
> +++ b/elf/tst-nodelete.cc
> @@ -47,5 +47,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
> index 388e8af..010c4ae 100644
> --- a/elf/tst-nodelete2.c
> +++ b/elf/tst-nodelete2.c
> @@ -33,5 +33,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-noload.c b/elf/tst-noload.c
> index fd1e273..3fb2895 100644
> --- a/elf/tst-noload.c
> +++ b/elf/tst-noload.c
> @@ -69,5 +69,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-null-argv.c b/elf/tst-null-argv.c
> index caf76aa..21b8732 100644
> --- a/elf/tst-null-argv.c
> +++ b/elf/tst-null-argv.c
> @@ -32,4 +32,5 @@ do_test (int argc, char **argv)
>    return 0;
>  }
>  
> -#include <test-skeleton.c>
> +#define TEST_FUNCTION_ARGV do_test
> +#include <support/test-driver.c>
> diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
> index 339778a..2a90130 100644
> --- a/elf/tst-order-main.c
> +++ b/elf/tst-order-main.c
> @@ -9,5 +9,4 @@ do_test (void)
>    exit(EXIT_SUCCESS);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c
> index 8d73ad4..e2c96fb 100644
> --- a/elf/tst-pathopt.c
> +++ b/elf/tst-pathopt.c
> @@ -38,5 +38,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-pie2.c b/elf/tst-pie2.c
> index bf11662..32943bb 100644
> --- a/elf/tst-pie2.c
> +++ b/elf/tst-pie2.c
> @@ -37,5 +37,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-piemod1.c b/elf/tst-piemod1.c
> index 6e98b5f..72d7e0a 100644
> --- a/elf/tst-piemod1.c
> +++ b/elf/tst-piemod1.c
> @@ -19,5 +19,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
> index 6a782ed..7435c32 100644
> --- a/elf/tst-prelink.c
> +++ b/elf/tst-prelink.c
> @@ -26,5 +26,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-protected1a.c b/elf/tst-protected1a.c
> index 3730357..4267b95 100644
> --- a/elf/tst-protected1a.c
> +++ b/elf/tst-protected1a.c
> @@ -40,10 +40,8 @@ extern int do_test (void);
>  
>  int protected2 = -1;
>  
> -#define TEST_FUNCTION do_test ()
> -
>  /* This defines the `main' function and some more.  */
> -#include <test-skeleton.c>
> +#include <support/test-driver.c>
>  
>  int
>  do_test (void)
> diff --git a/elf/tst-protected1b.c b/elf/tst-protected1b.c
> index 95f2c47..9fd695b 100644
> --- a/elf/tst-protected1b.c
> +++ b/elf/tst-protected1b.c
> @@ -40,10 +40,8 @@ extern int do_test (void);
>  
>  int protected2 = -1;
>  
> -#define TEST_FUNCTION do_test ()
> -
>  /* This defines the `main' function and some more.  */
> -#include <test-skeleton.c>
> +#include <support/test-driver.c>
>  
>  int
>  do_test (void)
> diff --git a/elf/tst-ptrguard1.c b/elf/tst-ptrguard1.c
> index 91fbc79..8ea65bb 100644
> --- a/elf/tst-ptrguard1.c
> +++ b/elf/tst-ptrguard1.c
> @@ -25,6 +25,12 @@
>  #include <tls.h>
>  #include <unistd.h>
>  
> +#ifndef _GNU_SOURCE
> +#define _GNU_SOURCE
> +#endif
> +/* Requires _GNU_SOURCE  */
> +#include <getopt.h>
> +
>  #ifndef POINTER_CHK_GUARD
>  extern uintptr_t __pointer_chk_guard;
>  # define POINTER_CHK_GUARD __pointer_chk_guard
> @@ -191,12 +197,21 @@ do_test (void)
>  #define CMDLINE_OPTIONS	\
>    { "command", required_argument, NULL, OPT_COMMAND },  \
>    { "child", no_argument, NULL, OPT_CHILD },
> -#define CMDLINE_PROCESS	\
> -  case OPT_COMMAND:	\
> -    command = optarg;	\
> -    break;		\
> -  case OPT_CHILD:	\
> -    child = true;	\
> -    break;
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +
> +static void __attribute((used))
> +cmdline_process_function (int c)
> +{
> +  switch (c)
> +    {
> +      case OPT_COMMAND:
> +        command = optarg;
> +        break;
> +      case OPT_CHILD:
> +        child = true;
> +        break;
> +    }
> +}
> +
> +#define CMDLINE_PROCESS	cmdline_process_function
> +
> +#include <support/test-driver.c>
> diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
> index a87b138..775c968 100644
> --- a/elf/tst-relsort1.c
> +++ b/elf/tst-relsort1.c
> @@ -15,5 +15,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-stackguard1.c b/elf/tst-stackguard1.c
> index a3f967b..78e33c7 100644
> --- a/elf/tst-stackguard1.c
> +++ b/elf/tst-stackguard1.c
> @@ -17,6 +17,7 @@
>     <http://www.gnu.org/licenses/>.  */
>  
>  #include <errno.h>
> +#include <getopt.h>
>  #include <stdbool.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> @@ -185,12 +186,20 @@ do_test (void)
>  #define CMDLINE_OPTIONS	\
>    { "command", required_argument, NULL, OPT_COMMAND },  \
>    { "child", no_argument, NULL, OPT_CHILD },
> -#define CMDLINE_PROCESS	\
> -  case OPT_COMMAND:	\
> -    command = optarg;	\
> -    break;		\
> -  case OPT_CHILD:	\
> -    child = true;	\
> -    break;
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +
> +static void __attribute__((used))
> +cmdline_process_function (int c)
> +{
> +  switch (c)
> +    {
> +      case OPT_COMMAND:
> +        command = optarg;
> +        break;
> +      case OPT_CHILD:
> +        child = true;
> +        break;
> +    }
> +}
> +#define CMDLINE_PROCESS	cmdline_process_function
> +
> +#include <support/test-driver.c>
> diff --git a/elf/tst-thrlock.c b/elf/tst-thrlock.c
> index fe72eba..1beffc3 100644
> --- a/elf/tst-thrlock.c
> +++ b/elf/tst-thrlock.c
> @@ -55,5 +55,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls-dlinfo.c b/elf/tst-tls-dlinfo.c
> index 28661b1..7d2b42e 100644
> --- a/elf/tst-tls-dlinfo.c
> +++ b/elf/tst-tls-dlinfo.c
> @@ -3,7 +3,6 @@
>  #include <stdlib.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -83,4 +82,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls-manydynamic.c b/elf/tst-tls-manydynamic.c
> index 49bb52c..b072d0b 100644
> --- a/elf/tst-tls-manydynamic.c
> +++ b/elf/tst-tls-manydynamic.c
> @@ -24,6 +24,7 @@
>  
>  #include "tst-tls-manydynamic.h"
>  
> +#include <errno.h>
>  #include <dlfcn.h>
>  #include <pthread.h>
>  #include <stdio.h>
> @@ -31,8 +32,8 @@
>  #include <string.h>
>  
>  static int do_test (void);
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/xthread.h>
> +#include <support/test-driver.c>
>  
>  void *handles[COUNT];
>  set_value_func set_value_funcs[COUNT];
> diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c
> index bec0a2f..c31da56 100644
> --- a/elf/tst-tls1.c
> +++ b/elf/tst-tls1.c
> @@ -9,7 +9,6 @@ COMMON_INT_DEF(foo);
>  COMMON_INT_DEF(bar);
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -80,4 +79,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls10.c b/elf/tst-tls10.c
> index eb1ecb9..d9611aa 100644
> --- a/elf/tst-tls10.c
> +++ b/elf/tst-tls10.c
> @@ -36,5 +36,4 @@ do_test (void)
>    exit (0);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls11.c b/elf/tst-tls11.c
> index 8ceac14..a5c3dd7 100644
> --- a/elf/tst-tls11.c
> +++ b/elf/tst-tls11.c
> @@ -25,5 +25,4 @@ do_test (void)
>    exit (0);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls12.c b/elf/tst-tls12.c
> index 8093894..ccd5f8b 100644
> --- a/elf/tst-tls12.c
> +++ b/elf/tst-tls12.c
> @@ -16,5 +16,4 @@ do_test (void)
>    exit (0);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls13.c b/elf/tst-tls13.c
> index 9af08cf..b1d3033 100644
> --- a/elf/tst-tls13.c
> +++ b/elf/tst-tls13.c
> @@ -25,5 +25,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls14.c b/elf/tst-tls14.c
> index 6bacb59..a6a79ef 100644
> --- a/elf/tst-tls14.c
> +++ b/elf/tst-tls14.c
> @@ -51,5 +51,4 @@ do_test (void)
>    return result;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls15.c b/elf/tst-tls15.c
> index d2e1f3d..db2a4f4 100644
> --- a/elf/tst-tls15.c
> +++ b/elf/tst-tls15.c
> @@ -29,5 +29,4 @@ do_test (void)
>    return fp ();
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls16.c b/elf/tst-tls16.c
> index 347b2f5..f2830b8 100644
> --- a/elf/tst-tls16.c
> +++ b/elf/tst-tls16.c
> @@ -49,5 +49,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls17.c b/elf/tst-tls17.c
> index 6dde974..c2a972d 100644
> --- a/elf/tst-tls17.c
> +++ b/elf/tst-tls17.c
> @@ -25,5 +25,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls18.c b/elf/tst-tls18.c
> index ba4b800..b705b61 100644
> --- a/elf/tst-tls18.c
> +++ b/elf/tst-tls18.c
> @@ -34,5 +34,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls19.c b/elf/tst-tls19.c
> index acbc1d6..dd8ea42 100644
> --- a/elf/tst-tls19.c
> +++ b/elf/tst-tls19.c
> @@ -23,5 +23,4 @@ do_test (void)
>    return fn ();
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c
> index d0b6d51..963b8d6 100644
> --- a/elf/tst-tls2.c
> +++ b/elf/tst-tls2.c
> @@ -9,7 +9,6 @@ VAR_INT_DEF(foo);
>  VAR_INT_DEF(bar);
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -80,4 +79,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c
> index ca96c6a..7e0abb4 100644
> --- a/elf/tst-tls3.c
> +++ b/elf/tst-tls3.c
> @@ -13,7 +13,6 @@ VAR_INT_DEF(baz);
>  extern int in_dso (void);
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -65,4 +64,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls4.c b/elf/tst-tls4.c
> index 63170c3..6841f81 100644
> --- a/elf/tst-tls4.c
> +++ b/elf/tst-tls4.c
> @@ -3,7 +3,6 @@
>  #include <stdlib.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -47,4 +46,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls5.c b/elf/tst-tls5.c
> index 76905c5..5f006fd 100644
> --- a/elf/tst-tls5.c
> +++ b/elf/tst-tls5.c
> @@ -3,7 +3,6 @@
>  #include <stdlib.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -63,4 +62,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls6.c b/elf/tst-tls6.c
> index 9e6235f..df81c1f 100644
> --- a/elf/tst-tls6.c
> +++ b/elf/tst-tls6.c
> @@ -5,7 +5,6 @@
>  #include <link.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -82,4 +81,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls7.c b/elf/tst-tls7.c
> index 23a16e4..fa46709 100644
> --- a/elf/tst-tls7.c
> +++ b/elf/tst-tls7.c
> @@ -5,7 +5,6 @@
>  #include <link.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -53,4 +52,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls8.c b/elf/tst-tls8.c
> index 4bf3e3f..c779572 100644
> --- a/elf/tst-tls8.c
> +++ b/elf/tst-tls8.c
> @@ -5,7 +5,6 @@
>  #include <link.h>
>  
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -165,5 +164,4 @@ do_test (void)
>    return result;
>  }
>  
> -
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tls9.c b/elf/tst-tls9.c
> index 6306fb5..ee21b47 100644
> --- a/elf/tst-tls9.c
> +++ b/elf/tst-tls9.c
> @@ -4,7 +4,6 @@
>  
>  #include <link.h>
>  
> -#define TEST_FUNCTION do_test ()
>  static int
>  do_test (void)
>  {
> @@ -34,4 +33,4 @@ do_test (void)
>  }
>  
>  
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tlsalign-extern.c b/elf/tst-tlsalign-extern.c
> index 11659a3..11384d0 100644
> --- a/elf/tst-tlsalign-extern.c
> +++ b/elf/tst-tlsalign-extern.c
> @@ -70,5 +70,4 @@ do_test (void)
>    return fail ? EXIT_FAILURE : EXIT_SUCCESS;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-tlsalign.c b/elf/tst-tlsalign.c
> index bd82112..b129ebd 100644
> --- a/elf/tst-tlsalign.c
> +++ b/elf/tst-tlsalign.c
> @@ -81,5 +81,4 @@ do_test (void)
>    return fail ? EXIT_FAILURE : EXIT_SUCCESS;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-unique1.c b/elf/tst-unique1.c
> index 17af6f1..b5e53e4 100644
> --- a/elf/tst-unique1.c
> +++ b/elf/tst-unique1.c
> @@ -70,5 +70,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/tst-unique2.c b/elf/tst-unique2.c
> index 4426754..e0173b7 100644
> --- a/elf/tst-unique2.c
> +++ b/elf/tst-unique2.c
> @@ -24,5 +24,4 @@ do_test (void)
>    return f (&var);
>  }
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>
> diff --git a/elf/vismain.c b/elf/vismain.c
> index d001023..43f1d8f 100644
> --- a/elf/vismain.c
> +++ b/elf/vismain.c
> @@ -29,10 +29,9 @@
>  /* Prototype for our test function.  */
>  extern int do_test (void);
>  
> -#define TEST_FUNCTION do_test ()
>  
>  /* This defines the `main' function and some more.  */
> -#include <test-skeleton.c>
> +#include <support/test-driver.c>
>  
>  
>  /* Prototypes for local functions.  */
>
Tulio Magno Quites Machado Filho April 5, 2017, 2:53 p.m. | #2
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> LGTM.
>
> On 03/04/2017 15:26, Wainer dos Santos Moschetta wrote:
>> Changes since v1:
>> - Undo changes in return of do_test functions.
>> - Better explain the changelog.
>> 
>> --- >8 ---
>> Replaced test-skeleton.c with support/test-driver.c and
>> adjusted the tests accordinly.
>> 
>> Checked on x86_64.

Pushed as 36fe25f.
Tulio Magno Quites Machado Filho April 5, 2017, 10:09 p.m. | #3
"H.J. Lu" <hjl.tools@gmail.com> writes:

> I checked in this patch to fix elf/tst-dlopen-aout.c.
>
> Subject: [PATCH] Define TEST_FUNCTION_ARGV in elf/tst-dlopen-aout.c
>
> 	* elf/tst-dlopen-aout.c (TEST_FUNCTION): Removed.
> 	(TEST_FUNCTION_ARGV): New.

Thanks for catching this!

> ---
>  ChangeLog             | 5 +++++
>  elf/tst-dlopen-aout.c | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index e6fcdd0..c586ef2 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2017-04-05  H.J. Lu  <hongjiu.lu@intel.com>
> +
> +	* elf/tst-dlopen-aout.c (TEST_FUNCTION): Removed.
> +	(TEST_FUNCTION_ARGV): New.
> +
>  2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
>  
>  	* elf/next.c: Import support/test-driver.c instead of
> diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
> index 34a1cdb..cccc508 100644
> --- a/elf/tst-dlopen-aout.c
> +++ b/elf/tst-dlopen-aout.c
> @@ -63,5 +63,5 @@ do_test (int argc, char *argv[])
>    return 0;
>  }
>  
> -#define TEST_FUNCTION do_test (argc, argv)
> +#define TEST_FUNCTION_ARGV do_test
>  #include <support/test-driver.c>

Patch

diff --git a/elf/next.c b/elf/next.c
index 6a3670c..a0d532b 100644
--- a/elf/next.c
+++ b/elf/next.c
@@ -40,5 +40,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/nodelete.c b/elf/nodelete.c
index 78364a2..c8d7115 100644
--- a/elf/nodelete.c
+++ b/elf/nodelete.c
@@ -18,7 +18,6 @@  handler (int sig)
 }
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -208,4 +207,4 @@  do_test (void)
   return result;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/order2.c b/elf/order2.c
index 3dbfdd1..bcf266d 100644
--- a/elf/order2.c
+++ b/elf/order2.c
@@ -34,8 +34,7 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
 
 static void
 __attribute__ ((destructor))
diff --git a/elf/tst-_dl_addr_inside_object.c b/elf/tst-_dl_addr_inside_object.c
index 3def22a..1604b8d 100644
--- a/elf/tst-_dl_addr_inside_object.c
+++ b/elf/tst-_dl_addr_inside_object.c
@@ -219,5 +219,4 @@  do_test (void)
   return err;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
index 637906e..68ff74a 100644
--- a/elf/tst-addr1.c
+++ b/elf/tst-addr1.c
@@ -22,5 +22,4 @@  do_test (void)
 	     && strcmp (i.dli_sname, "_IO_printf") != 0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-align.c b/elf/tst-align.c
index 4c14a3d..01b0b4f 100644
--- a/elf/tst-align.c
+++ b/elf/tst-align.c
@@ -49,5 +49,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-align2.c b/elf/tst-align2.c
index eeae609..78b66be 100644
--- a/elf/tst-align2.c
+++ b/elf/tst-align2.c
@@ -152,5 +152,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit11.c b/elf/tst-audit11.c
index c65301d..ff91a6b 100644
--- a/elf/tst-audit11.c
+++ b/elf/tst-audit11.c
@@ -32,5 +32,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit12.c b/elf/tst-audit12.c
index 4e9e63c..62ac5f2 100644
--- a/elf/tst-audit12.c
+++ b/elf/tst-audit12.c
@@ -45,5 +45,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit2.c b/elf/tst-audit2.c
index 1d69cd6..0e66f5c 100644
--- a/elf/tst-audit2.c
+++ b/elf/tst-audit2.c
@@ -57,5 +57,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit9.c b/elf/tst-audit9.c
index 7b90a5a..b9de1bf 100644
--- a/elf/tst-audit9.c
+++ b/elf/tst-audit9.c
@@ -8,5 +8,4 @@  do_test (void)
   return fp() - 1;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-auxv.c b/elf/tst-auxv.c
index d2661d9..bc571c5 100644
--- a/elf/tst-auxv.c
+++ b/elf/tst-auxv.c
@@ -66,4 +66,5 @@  do_test (int argc, char *argv[])
   return 0;
 }
 
-#include "../test-skeleton.c"
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>
diff --git a/elf/tst-deep1.c b/elf/tst-deep1.c
index 5428d13..97dce7e 100644
--- a/elf/tst-deep1.c
+++ b/elf/tst-deep1.c
@@ -32,5 +32,4 @@  do_test (void)
   return foo () + f ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dl-iter-static.c b/elf/tst-dl-iter-static.c
index 47de698..9a2758c 100644
--- a/elf/tst-dl-iter-static.c
+++ b/elf/tst-dl-iter-static.c
@@ -43,5 +43,4 @@  do_test (void)
   return status || count != 1;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmodcount.c b/elf/tst-dlmodcount.c
index 76bae85..34c5b25 100644
--- a/elf/tst-dlmodcount.c
+++ b/elf/tst-dlmodcount.c
@@ -105,5 +105,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen1.c b/elf/tst-dlmopen1.c
index 5a05891..24145cf 100644
--- a/elf/tst-dlmopen1.c
+++ b/elf/tst-dlmopen1.c
@@ -77,5 +77,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen2.c b/elf/tst-dlmopen2.c
index 0569997..8489ffb 100644
--- a/elf/tst-dlmopen2.c
+++ b/elf/tst-dlmopen2.c
@@ -66,5 +66,4 @@  round %d, namespace %d: duplicate allocate of namespace %ld",
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
index 26c86b2..8167507 100644
--- a/elf/tst-dlmopen3.c
+++ b/elf/tst-dlmopen3.c
@@ -18,5 +18,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
index d780f8c..34a1cdb 100644
--- a/elf/tst-dlopen-aout.c
+++ b/elf/tst-dlopen-aout.c
@@ -64,4 +64,4 @@  do_test (int argc, char *argv[])
 }
 
 #define TEST_FUNCTION do_test (argc, argv)
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlopenrpath.c b/elf/tst-dlopenrpath.c
index ac72a1e..77346d3 100644
--- a/elf/tst-dlopenrpath.c
+++ b/elf/tst-dlopenrpath.c
@@ -67,5 +67,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlsym-error.c b/elf/tst-dlsym-error.c
index 22dcff4..fac8f10 100644
--- a/elf/tst-dlsym-error.c
+++ b/elf/tst-dlsym-error.c
@@ -110,5 +110,4 @@  do_test (void)
 }
 
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack-needed.c b/elf/tst-execstack-needed.c
index 03090f7..8b794a3 100644
--- a/elf/tst-execstack-needed.c
+++ b/elf/tst-execstack-needed.c
@@ -31,6 +31,4 @@  deeper (void (*f) (void))
   memfrob (stack, sizeof stack);
 }
 
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack-prog.c b/elf/tst-execstack-prog.c
index 5a66d63..8663153 100644
--- a/elf/tst-execstack-prog.c
+++ b/elf/tst-execstack-prog.c
@@ -30,6 +30,4 @@  deeper (void (*f) (void))
   memfrob (stack, sizeof stack);
 }
 
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack.c b/elf/tst-execstack.c
index 02cc270..114f341 100644
--- a/elf/tst-execstack.c
+++ b/elf/tst-execstack.c
@@ -233,5 +233,4 @@  deeper (void (*f) (void))
 }
 
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-global1.c b/elf/tst-global1.c
index 4df335c..5dae74e 100644
--- a/elf/tst-global1.c
+++ b/elf/tst-global1.c
@@ -35,5 +35,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-gnu2-tls1.c b/elf/tst-gnu2-tls1.c
index 8acbfa6..b33b60a 100644
--- a/elf/tst-gnu2-tls1.c
+++ b/elf/tst-gnu2-tls1.c
@@ -48,5 +48,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-latepthread.c b/elf/tst-latepthread.c
index a0a55e4..ca2f822 100644
--- a/elf/tst-latepthread.c
+++ b/elf/tst-latepthread.c
@@ -101,5 +101,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-leaks1.c b/elf/tst-leaks1.c
index dcff28d..d67e826 100644
--- a/elf/tst-leaks1.c
+++ b/elf/tst-leaks1.c
@@ -24,5 +24,4 @@  do_test (void)
   return ret;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-linkall-static.c b/elf/tst-linkall-static.c
index 964cd7a..8f40657 100644
--- a/elf/tst-linkall-static.c
+++ b/elf/tst-linkall-static.c
@@ -42,6 +42,11 @@  void *references[] =
     &getaddrinfo_a,             /* libanl */
   };
 
-/* This is a link-time test.  There is nothing to run here.  */
-#define TEST_FUNCTION 0
-#include "../test-skeleton.c"
+static int
+do_test (void)
+{
+  /* This is a link-time test.  There is nothing to run here.  */
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete-opened.c b/elf/tst-nodelete-opened.c
index 9db49da..d71efa4 100644
--- a/elf/tst-nodelete-opened.c
+++ b/elf/tst-nodelete-opened.c
@@ -65,5 +65,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete.cc b/elf/tst-nodelete.cc
index 176cb68..5752e7d 100644
--- a/elf/tst-nodelete.cc
+++ b/elf/tst-nodelete.cc
@@ -47,5 +47,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
index 388e8af..010c4ae 100644
--- a/elf/tst-nodelete2.c
+++ b/elf/tst-nodelete2.c
@@ -33,5 +33,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-noload.c b/elf/tst-noload.c
index fd1e273..3fb2895 100644
--- a/elf/tst-noload.c
+++ b/elf/tst-noload.c
@@ -69,5 +69,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-null-argv.c b/elf/tst-null-argv.c
index caf76aa..21b8732 100644
--- a/elf/tst-null-argv.c
+++ b/elf/tst-null-argv.c
@@ -32,4 +32,5 @@  do_test (int argc, char **argv)
   return 0;
 }
 
-#include <test-skeleton.c>
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>
diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
index 339778a..2a90130 100644
--- a/elf/tst-order-main.c
+++ b/elf/tst-order-main.c
@@ -9,5 +9,4 @@  do_test (void)
   exit(EXIT_SUCCESS);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c
index 8d73ad4..e2c96fb 100644
--- a/elf/tst-pathopt.c
+++ b/elf/tst-pathopt.c
@@ -38,5 +38,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-pie2.c b/elf/tst-pie2.c
index bf11662..32943bb 100644
--- a/elf/tst-pie2.c
+++ b/elf/tst-pie2.c
@@ -37,5 +37,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-piemod1.c b/elf/tst-piemod1.c
index 6e98b5f..72d7e0a 100644
--- a/elf/tst-piemod1.c
+++ b/elf/tst-piemod1.c
@@ -19,5 +19,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
index 6a782ed..7435c32 100644
--- a/elf/tst-prelink.c
+++ b/elf/tst-prelink.c
@@ -26,5 +26,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-protected1a.c b/elf/tst-protected1a.c
index 3730357..4267b95 100644
--- a/elf/tst-protected1a.c
+++ b/elf/tst-protected1a.c
@@ -40,10 +40,8 @@  extern int do_test (void);
 
 int protected2 = -1;
 
-#define TEST_FUNCTION do_test ()
-
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 int
 do_test (void)
diff --git a/elf/tst-protected1b.c b/elf/tst-protected1b.c
index 95f2c47..9fd695b 100644
--- a/elf/tst-protected1b.c
+++ b/elf/tst-protected1b.c
@@ -40,10 +40,8 @@  extern int do_test (void);
 
 int protected2 = -1;
 
-#define TEST_FUNCTION do_test ()
-
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 int
 do_test (void)
diff --git a/elf/tst-ptrguard1.c b/elf/tst-ptrguard1.c
index 91fbc79..8ea65bb 100644
--- a/elf/tst-ptrguard1.c
+++ b/elf/tst-ptrguard1.c
@@ -25,6 +25,12 @@ 
 #include <tls.h>
 #include <unistd.h>
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+/* Requires _GNU_SOURCE  */
+#include <getopt.h>
+
 #ifndef POINTER_CHK_GUARD
 extern uintptr_t __pointer_chk_guard;
 # define POINTER_CHK_GUARD __pointer_chk_guard
@@ -191,12 +197,21 @@  do_test (void)
 #define CMDLINE_OPTIONS	\
   { "command", required_argument, NULL, OPT_COMMAND },  \
   { "child", no_argument, NULL, OPT_CHILD },
-#define CMDLINE_PROCESS	\
-  case OPT_COMMAND:	\
-    command = optarg;	\
-    break;		\
-  case OPT_CHILD:	\
-    child = true;	\
-    break;
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+
+static void __attribute((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      case OPT_COMMAND:
+        command = optarg;
+        break;
+      case OPT_CHILD:
+        child = true;
+        break;
+    }
+}
+
+#define CMDLINE_PROCESS	cmdline_process_function
+
+#include <support/test-driver.c>
diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
index a87b138..775c968 100644
--- a/elf/tst-relsort1.c
+++ b/elf/tst-relsort1.c
@@ -15,5 +15,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-stackguard1.c b/elf/tst-stackguard1.c
index a3f967b..78e33c7 100644
--- a/elf/tst-stackguard1.c
+++ b/elf/tst-stackguard1.c
@@ -17,6 +17,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <getopt.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -185,12 +186,20 @@  do_test (void)
 #define CMDLINE_OPTIONS	\
   { "command", required_argument, NULL, OPT_COMMAND },  \
   { "child", no_argument, NULL, OPT_CHILD },
-#define CMDLINE_PROCESS	\
-  case OPT_COMMAND:	\
-    command = optarg;	\
-    break;		\
-  case OPT_CHILD:	\
-    child = true;	\
-    break;
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+
+static void __attribute__((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      case OPT_COMMAND:
+        command = optarg;
+        break;
+      case OPT_CHILD:
+        child = true;
+        break;
+    }
+}
+#define CMDLINE_PROCESS	cmdline_process_function
+
+#include <support/test-driver.c>
diff --git a/elf/tst-thrlock.c b/elf/tst-thrlock.c
index fe72eba..1beffc3 100644
--- a/elf/tst-thrlock.c
+++ b/elf/tst-thrlock.c
@@ -55,5 +55,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls-dlinfo.c b/elf/tst-tls-dlinfo.c
index 28661b1..7d2b42e 100644
--- a/elf/tst-tls-dlinfo.c
+++ b/elf/tst-tls-dlinfo.c
@@ -3,7 +3,6 @@ 
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -83,4 +82,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls-manydynamic.c b/elf/tst-tls-manydynamic.c
index 49bb52c..b072d0b 100644
--- a/elf/tst-tls-manydynamic.c
+++ b/elf/tst-tls-manydynamic.c
@@ -24,6 +24,7 @@ 
 
 #include "tst-tls-manydynamic.h"
 
+#include <errno.h>
 #include <dlfcn.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -31,8 +32,8 @@ 
 #include <string.h>
 
 static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/xthread.h>
+#include <support/test-driver.c>
 
 void *handles[COUNT];
 set_value_func set_value_funcs[COUNT];
diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c
index bec0a2f..c31da56 100644
--- a/elf/tst-tls1.c
+++ b/elf/tst-tls1.c
@@ -9,7 +9,6 @@  COMMON_INT_DEF(foo);
 COMMON_INT_DEF(bar);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -80,4 +79,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls10.c b/elf/tst-tls10.c
index eb1ecb9..d9611aa 100644
--- a/elf/tst-tls10.c
+++ b/elf/tst-tls10.c
@@ -36,5 +36,4 @@  do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls11.c b/elf/tst-tls11.c
index 8ceac14..a5c3dd7 100644
--- a/elf/tst-tls11.c
+++ b/elf/tst-tls11.c
@@ -25,5 +25,4 @@  do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls12.c b/elf/tst-tls12.c
index 8093894..ccd5f8b 100644
--- a/elf/tst-tls12.c
+++ b/elf/tst-tls12.c
@@ -16,5 +16,4 @@  do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls13.c b/elf/tst-tls13.c
index 9af08cf..b1d3033 100644
--- a/elf/tst-tls13.c
+++ b/elf/tst-tls13.c
@@ -25,5 +25,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls14.c b/elf/tst-tls14.c
index 6bacb59..a6a79ef 100644
--- a/elf/tst-tls14.c
+++ b/elf/tst-tls14.c
@@ -51,5 +51,4 @@  do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls15.c b/elf/tst-tls15.c
index d2e1f3d..db2a4f4 100644
--- a/elf/tst-tls15.c
+++ b/elf/tst-tls15.c
@@ -29,5 +29,4 @@  do_test (void)
   return fp ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls16.c b/elf/tst-tls16.c
index 347b2f5..f2830b8 100644
--- a/elf/tst-tls16.c
+++ b/elf/tst-tls16.c
@@ -49,5 +49,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls17.c b/elf/tst-tls17.c
index 6dde974..c2a972d 100644
--- a/elf/tst-tls17.c
+++ b/elf/tst-tls17.c
@@ -25,5 +25,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls18.c b/elf/tst-tls18.c
index ba4b800..b705b61 100644
--- a/elf/tst-tls18.c
+++ b/elf/tst-tls18.c
@@ -34,5 +34,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls19.c b/elf/tst-tls19.c
index acbc1d6..dd8ea42 100644
--- a/elf/tst-tls19.c
+++ b/elf/tst-tls19.c
@@ -23,5 +23,4 @@  do_test (void)
   return fn ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c
index d0b6d51..963b8d6 100644
--- a/elf/tst-tls2.c
+++ b/elf/tst-tls2.c
@@ -9,7 +9,6 @@  VAR_INT_DEF(foo);
 VAR_INT_DEF(bar);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -80,4 +79,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c
index ca96c6a..7e0abb4 100644
--- a/elf/tst-tls3.c
+++ b/elf/tst-tls3.c
@@ -13,7 +13,6 @@  VAR_INT_DEF(baz);
 extern int in_dso (void);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -65,4 +64,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls4.c b/elf/tst-tls4.c
index 63170c3..6841f81 100644
--- a/elf/tst-tls4.c
+++ b/elf/tst-tls4.c
@@ -3,7 +3,6 @@ 
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -47,4 +46,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls5.c b/elf/tst-tls5.c
index 76905c5..5f006fd 100644
--- a/elf/tst-tls5.c
+++ b/elf/tst-tls5.c
@@ -3,7 +3,6 @@ 
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -63,4 +62,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls6.c b/elf/tst-tls6.c
index 9e6235f..df81c1f 100644
--- a/elf/tst-tls6.c
+++ b/elf/tst-tls6.c
@@ -5,7 +5,6 @@ 
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -82,4 +81,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls7.c b/elf/tst-tls7.c
index 23a16e4..fa46709 100644
--- a/elf/tst-tls7.c
+++ b/elf/tst-tls7.c
@@ -5,7 +5,6 @@ 
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -53,4 +52,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls8.c b/elf/tst-tls8.c
index 4bf3e3f..c779572 100644
--- a/elf/tst-tls8.c
+++ b/elf/tst-tls8.c
@@ -5,7 +5,6 @@ 
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -165,5 +164,4 @@  do_test (void)
   return result;
 }
 
-
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls9.c b/elf/tst-tls9.c
index 6306fb5..ee21b47 100644
--- a/elf/tst-tls9.c
+++ b/elf/tst-tls9.c
@@ -4,7 +4,6 @@ 
 
 #include <link.h>
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -34,4 +33,4 @@  do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tlsalign-extern.c b/elf/tst-tlsalign-extern.c
index 11659a3..11384d0 100644
--- a/elf/tst-tlsalign-extern.c
+++ b/elf/tst-tlsalign-extern.c
@@ -70,5 +70,4 @@  do_test (void)
   return fail ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tlsalign.c b/elf/tst-tlsalign.c
index bd82112..b129ebd 100644
--- a/elf/tst-tlsalign.c
+++ b/elf/tst-tlsalign.c
@@ -81,5 +81,4 @@  do_test (void)
   return fail ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-unique1.c b/elf/tst-unique1.c
index 17af6f1..b5e53e4 100644
--- a/elf/tst-unique1.c
+++ b/elf/tst-unique1.c
@@ -70,5 +70,4 @@  do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-unique2.c b/elf/tst-unique2.c
index 4426754..e0173b7 100644
--- a/elf/tst-unique2.c
+++ b/elf/tst-unique2.c
@@ -24,5 +24,4 @@  do_test (void)
   return f (&var);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/vismain.c b/elf/vismain.c
index d001023..43f1d8f 100644
--- a/elf/vismain.c
+++ b/elf/vismain.c
@@ -29,10 +29,9 @@ 
 /* Prototype for our test function.  */
 extern int do_test (void);
 
-#define TEST_FUNCTION do_test ()
 
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 
 /* Prototypes for local functions.  */