about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorWainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>2017-04-05 10:34:39 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2017-04-05 10:34:58 -0300
commit36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af (patch)
treecb5dedbb055700db18f4b65dbd027b08d6b6abb4 /elf
parentff65c87443fe628d1e1e0106a5fcafc2104a5d7e (diff)
downloadglibc-36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af.tar.gz
glibc-36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af.tar.xz
glibc-36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af.zip
Update elf tests to use the support test driver.
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.

Checked on x86_64.

	* 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.
Diffstat (limited to 'elf')
-rw-r--r--elf/next.c3
-rw-r--r--elf/nodelete.c3
-rw-r--r--elf/order2.c3
-rw-r--r--elf/tst-_dl_addr_inside_object.c3
-rw-r--r--elf/tst-addr1.c3
-rw-r--r--elf/tst-align.c3
-rw-r--r--elf/tst-align2.c3
-rw-r--r--elf/tst-audit11.c3
-rw-r--r--elf/tst-audit12.c3
-rw-r--r--elf/tst-audit2.c3
-rw-r--r--elf/tst-audit9.c3
-rw-r--r--elf/tst-auxv.c3
-rw-r--r--elf/tst-deep1.c3
-rw-r--r--elf/tst-dl-iter-static.c3
-rw-r--r--elf/tst-dlmodcount.c3
-rw-r--r--elf/tst-dlmopen1.c3
-rw-r--r--elf/tst-dlmopen2.c3
-rw-r--r--elf/tst-dlmopen3.c3
-rw-r--r--elf/tst-dlopen-aout.c2
-rw-r--r--elf/tst-dlopenrpath.c3
-rw-r--r--elf/tst-dlsym-error.c3
-rw-r--r--elf/tst-execstack-needed.c4
-rw-r--r--elf/tst-execstack-prog.c4
-rw-r--r--elf/tst-execstack.c3
-rw-r--r--elf/tst-global1.c3
-rw-r--r--elf/tst-gnu2-tls1.c3
-rw-r--r--elf/tst-latepthread.c3
-rw-r--r--elf/tst-leaks1.c3
-rw-r--r--elf/tst-linkall-static.c11
-rw-r--r--elf/tst-nodelete-opened.c3
-rw-r--r--elf/tst-nodelete.cc3
-rw-r--r--elf/tst-nodelete2.c3
-rw-r--r--elf/tst-noload.c3
-rw-r--r--elf/tst-null-argv.c3
-rw-r--r--elf/tst-order-main.c3
-rw-r--r--elf/tst-pathopt.c3
-rw-r--r--elf/tst-pie2.c3
-rw-r--r--elf/tst-piemod1.c3
-rw-r--r--elf/tst-prelink.c3
-rw-r--r--elf/tst-protected1a.c4
-rw-r--r--elf/tst-protected1b.c4
-rw-r--r--elf/tst-ptrguard1.c33
-rw-r--r--elf/tst-relsort1.c3
-rw-r--r--elf/tst-stackguard1.c27
-rw-r--r--elf/tst-thrlock.c3
-rw-r--r--elf/tst-tls-dlinfo.c3
-rw-r--r--elf/tst-tls-manydynamic.c5
-rw-r--r--elf/tst-tls1.c3
-rw-r--r--elf/tst-tls10.c3
-rw-r--r--elf/tst-tls11.c3
-rw-r--r--elf/tst-tls12.c3
-rw-r--r--elf/tst-tls13.c3
-rw-r--r--elf/tst-tls14.c3
-rw-r--r--elf/tst-tls15.c3
-rw-r--r--elf/tst-tls16.c3
-rw-r--r--elf/tst-tls17.c3
-rw-r--r--elf/tst-tls18.c3
-rw-r--r--elf/tst-tls19.c3
-rw-r--r--elf/tst-tls2.c3
-rw-r--r--elf/tst-tls3.c3
-rw-r--r--elf/tst-tls4.c3
-rw-r--r--elf/tst-tls5.c3
-rw-r--r--elf/tst-tls6.c3
-rw-r--r--elf/tst-tls7.c3
-rw-r--r--elf/tst-tls8.c4
-rw-r--r--elf/tst-tls9.c3
-rw-r--r--elf/tst-tlsalign-extern.c3
-rw-r--r--elf/tst-tlsalign.c3
-rw-r--r--elf/tst-unique1.c3
-rw-r--r--elf/tst-unique2.c3
-rw-r--r--elf/vismain.c3
71 files changed, 122 insertions, 159 deletions
diff --git a/elf/next.c b/elf/next.c
index 6a3670c214..a0d532b8c3 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 78364a278a..c8d71152f2 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 3dbfdd153e..bcf266d5b1 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 3def22a6a4..1604b8df63 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 637906e206..68ff74aabd 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 4c14a3d464..01b0b4ffb3 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 eeae609708..78b66be20a 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 c65301d9bb..ff91a6bd6d 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 4e9e63c081..62ac5f28a4 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 1d69cd669e..0e66f5c328 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 7b90a5ad2d..b9de1bf5a2 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 d2661d9dd6..bc571c5fa7 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 5428d13de4..97dce7ea4d 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 47de69834b..9a2758c8ef 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 76bae852ac..34c5b25d7f 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 5a05891846..24145cfca6 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 0569997258..8489ffba08 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 26c86b2dca..8167507784 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 d780f8c109..34a1cdbf50 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 ac72a1e893..77346d36f9 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 22dcff40da..fac8f10ccf 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 03090f7dd6..8b794a3d47 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 5a66d63ca9..8663153372 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 02cc270d80..114f341d76 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 4df335c637..5dae74eec0 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 8acbfa6cc8..b33b60a301 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 a0a55e4a2e..ca2f82243d 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 dcff28dafa..d67e8269c4 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 964cd7a202..8f40657244 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 9db49da961..d71efa4603 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 176cb68836..5752e7df26 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 388e8afb32..010c4ae237 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 fd1e27307c..3fb2895e2c 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 caf76aa432..21b87327c1 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 339778a93a..2a90130db6 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 8d73ad4def..e2c96fbc72 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 bf11662fae..32943bbc1a 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 6e98b5f0c2..72d7e0a187 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 6a782ede91..7435c321d3 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 373035780f..4267b951c4 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 95f2c47e64..9fd695bffa 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 91fbc79fdb..8ea65bb0bb 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 a87b138280..775c968e1f 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 a3f967b253..78e33c7083 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 fe72eba141..1beffc3861 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 28661b19c2..7d2b42e2ab 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 49bb52c824..b072d0be68 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 bec0a2ff26..c31da56ce9 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 eb1ecb9216..d9611aac6d 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 8ceac14168..a5c3dd70b0 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 8093894b93..ccd5f8b43e 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 9af08cf752..b1d303310f 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 6bacb599dd..a6a79ef24f 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 d2e1f3d86c..db2a4f4b77 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 347b2f5184..f2830b8a4f 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 6dde974158..c2a972d3c4 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 ba4b8008d6..b705b61d60 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 acbc1d6964..dd8ea42c3f 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 d0b6d51402..963b8d6c88 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 ca96c6a073..7e0abb4c58 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 63170c3478..6841f81386 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 76905c56db..5f006fd645 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 9e6235f1d3..df81c1f6b4 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 23a16e4489..fa46709600 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 4bf3e3ffb5..c779572617 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 6306fb5658..ee21b47c70 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 11659a3f60..11384d085e 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 bd82112716..b129ebda0e 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 17af6f1b18..b5e53e49a0 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 442675458b..e0173b7bcc 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 d00102394c..43f1d8f095 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.  */