[RFC][PATCH] Adjust most tests to use test-skeleton.c

Arjun Shankar arjun.is@lostca.se
Tue Oct 21 12:14:00 GMT 2014


This patch is an attempt to get most of the glibc tests to use
test-skeleton.c. It is mostly the result of the following bash script:

#!/bin/bash
SRC_DIR=~/src/glibc/
for f in $(find $SRC_DIR -regex '.*t[e]?st-.*\.c'); do
  grep -q skeleton $f \
  || (grep -Pzq 'int\s*main\s*\(\s*void\s*\)' $f \
      && sed -i '/^int$/{$!{N;s/^int\nmain (void)$/static int\ndo_test (void)/;ty;P;D;:y}}' $f \
      && (grep -q 'do_test' $f && (echo -e '\n#define TEST_FUNCTION do_test ()\n#include "../test-skeleton.c"' >> $f)))
done
# end

I then ran `make check', followed by:

1. reverting changes that led to compile/check failures that I did not
   immediately understand;

2. setting longer TIMEOUT values for tests that clearly needed more than
   the default 2 seconds;

3. and, renaming functions/macros whose names clashed with those already
   used in the skeleton.

Tested on x86_64 with no regressions or warnings on `make check'.

Is it horrible to try and hammer the glibc source tree with a bit of `sed'?
Any other comments?

Cheers,
Arjun

---
 assert/test-assert.c         |  7 +++++--
 catgets/test-gencat.c        |  7 +++++--
 catgets/tst-catgets.c        |  7 +++++--
 elf/tst-array5.c             |  7 +++++--
 elf/tst-audit2.c             |  7 +++++--
 elf/tst-global1.c            |  7 +++++--
 elf/tst-leaks1.c             |  7 +++++--
 elf/tst-pathopt.c            |  7 +++++--
 elf/tst-piemod1.c            |  7 +++++--
 elf/tst-tls10.c              |  7 +++++--
 elf/tst-tls11.c              |  7 +++++--
 elf/tst-tls12.c              |  7 +++++--
 gnulib/tst-gcc.c             |  7 +++++--
 iconv/tst-iconv1.c           |  7 +++++--
 iconv/tst-iconv2.c           |  7 +++++--
 iconvdata/tst-e2big.c        |  7 +++++--
 iconvdata/tst-loading.c      |  7 +++++--
 inet/test-inet6_opt.c        |  7 +++++--
 inet/tst-gethnm.c            |  7 +++++--
 inet/tst-network.c           |  7 +++++--
 inet/tst-ntoa.c              |  7 +++++--
 intl/tst-codeset.c           |  7 +++++--
 intl/tst-gettext2.c          |  7 +++++--
 intl/tst-gettext3.c          |  7 +++++--
 intl/tst-gettext4.c          |  7 +++++--
 intl/tst-gettext5.c          |  7 +++++--
 intl/tst-gettext6.c          |  7 +++++--
 intl/tst-ngettext.c          |  7 +++++--
 intl/tst-translit.c          |  7 +++++--
 io/test-stat.c               |  7 +++++--
 libio/test-fmemopen.c        |  7 +++++--
 libio/tst-ext.c              |  7 +++++--
 libio/tst-freopen.c          |  7 +++++--
 libio/tst-sscanf.c           |  7 +++++--
 libio/tst-ungetwc1.c         |  7 +++++--
 libio/tst-ungetwc2.c         |  7 +++++--
 libio/tst-widetext.c         |  7 +++++--
 localedata/tst-ctype.c       |  7 +++++--
 localedata/tst-digits.c      |  7 +++++--
 localedata/tst-langinfo.c    |  7 +++++--
 localedata/tst-leaks.c       |  7 +++++--
 localedata/tst-mbswcs1.c     |  7 +++++--
 localedata/tst-mbswcs2.c     |  7 +++++--
 localedata/tst-mbswcs3.c     |  7 +++++--
 localedata/tst-mbswcs4.c     |  7 +++++--
 localedata/tst-mbswcs5.c     |  7 +++++--
 localedata/tst-setlocale.c   |  7 +++++--
 localedata/tst-trans.c       |  7 +++++--
 localedata/tst-wctype.c      |  7 +++++--
 localedata/tst-xlocale1.c    |  7 +++++--
 login/tst-grantpt.c          |  7 +++++--
 malloc/tst-calloc.c          |  7 +++++--
 malloc/tst-malloc.c          |  7 +++++--
 malloc/tst-mallocstate.c     |  7 +++++--
 malloc/tst-mcheck.c          |  7 +++++--
 malloc/tst-mtrace.c          |  7 +++++--
 malloc/tst-obstack.c         |  7 +++++--
 math/atest-exp.c             |  7 +++++--
 math/atest-exp2.c            |  7 +++++--
 math/atest-sincos.c          |  7 +++++--
 math/test-fenv.c             |  7 +++++--
 math/test-fpucw.c            |  7 +++++--
 math/test-matherr.c          |  7 +++++--
 math/test-misc.c             |  7 +++++--
 math/test-powl.c             |  7 +++++--
 math/tst-definitions.c       |  7 +++++--
 misc/tst-dirname.c           |  7 +++++--
 misc/tst-efgcvt.c            |  7 +++++--
 misc/tst-fdset.c             |  7 +++++--
 misc/tst-hsearch.c           |  7 +++++--
 misc/tst-mntent2.c           |  7 +++++--
 nptl/tst-_res1.c             | 16 +++++++++++-----
 nptl/tst-fork1.c             |  7 +++++--
 nptl/tst-fork2.c             |  7 +++++--
 nptl/tst-fork3.c             |  7 +++++--
 nptl/tst-raise1.c            |  7 +++++--
 nptl/tst-sem11.c             | 11 +++++++----
 nptl/tst-sem12.c             |  2 +-
 nptl/tst-sem7.c              |  7 +++++--
 nptl/tst-sem8.c              |  7 +++++--
 nptl/tst-sem9.c              |  7 +++++--
 nss/test-netdb.c             |  7 +++++--
 posix/test-vfork.c           |  7 +++++--
 posix/tst-fnmatch.c          |  7 +++++--
 posix/tst-fork.c             |  7 +++++--
 posix/tst-getlogin.c         |  7 +++++--
 posix/tst-gnuglob.c          |  7 +++++--
 posix/tst-mmap.c             |  7 +++++--
 pwd/tst-getpw.c              |  7 +++++--
 resolv/tst-inet_ntop.c       |  7 +++++--
 rt/tst-timer.c               |  7 +++++--
 setjmp/tst-setjmp.c          |  7 +++++--
 signal/tst-raise.c           |  7 +++++--
 signal/tst-signal.c          |  7 +++++--
 stdio-common/test-fseek.c    |  7 +++++--
 stdio-common/test-popen.c    |  7 +++++--
 stdio-common/test-vfprintf.c |  7 +++++--
 stdio-common/tst-cookie.c    |  7 +++++--
 stdio-common/tst-fileno.c    |  7 +++++--
 stdio-common/tst-fseek.c     |  8 ++++++--
 stdio-common/tst-gets.c      |  7 +++++--
 stdio-common/tst-obprintf.c  |  7 +++++--
 stdio-common/tst-perror.c    |  7 +++++--
 stdio-common/tst-sprintf.c   |  7 +++++--
 stdio-common/tst-sprintf2.c  |  7 +++++--
 stdio-common/tst-sprintf3.c  |  7 +++++--
 stdio-common/tst-sscanf.c    |  7 +++++--
 stdio-common/tst-swprintf.c  |  7 +++++--
 stdio-common/tst-tmpnam.c    |  7 +++++--
 stdio-common/tst-unbputc.c   |  7 +++++--
 stdio-common/tst-wc-printf.c |  7 +++++--
 stdlib/tst-environ.c         |  7 +++++--
 stdlib/tst-fmtmsg.c          |  7 +++++--
 stdlib/tst-limits.c          |  7 +++++--
 stdlib/tst-makecontext3.c    |  7 +++++--
 stdlib/tst-rand48-2.c        |  7 +++++--
 stdlib/tst-rand48.c          |  7 +++++--
 stdlib/tst-random.c          |  7 +++++--
 stdlib/tst-random2.c         |  7 +++++--
 stdlib/tst-setcontext.c      |  7 +++++--
 stdlib/tst-strtol.c          |  7 +++++--
 stdlib/tst-strtoll.c         |  7 +++++--
 stdlib/tst-tls-atexit.c      |  7 +++++--
 stdlib/tst-xpg-basename.c    |  7 +++++--
 string/test-ffs.c            |  7 +++++--
 string/tst-bswap.c           |  7 +++++--
 string/tst-inlcall.c         |  7 +++++--
 string/tst-strtok.c          |  7 +++++--
 string/tst-strxfrm.c         |  7 +++++--
 sysdeps/pthread/tst-timer.c  |  8 ++++++--
 sysdeps/x86_64/tst-audit10.c | 11 +++++++----
 sysdeps/x86_64/tst-audit3.c  |  7 +++++--
 sysdeps/x86_64/tst-audit4.c  | 11 +++++++----
 sysdeps/x86_64/tst-audit5.c  |  7 +++++--
 sysdeps/x86_64/tst-audit6.c  |  7 +++++--
 time/tst-ftime_l.c           |  7 +++++--
 time/tst-getdate.c           |  7 +++++--
 time/tst-mktime.c            |  7 +++++--
 time/tst-mktime3.c           |  7 +++++--
 time/tst-posixtz.c           |  7 +++++--
 time/tst-strptime2.c         |  7 +++++--
 time/tst-strptime3.c         |  7 +++++--
 wcsmbs/tst-btowc.c           |  7 +++++--
 wcsmbs/tst-mbrtowc.c         |  7 +++++--
 wcsmbs/tst-mbsrtowcs.c       |  7 +++++--
 wcsmbs/tst-wchar-h.c         |  7 +++++--
 wcsmbs/tst-wcpncpy.c         |  7 +++++--
 wcsmbs/tst-wcrtomb.c         |  7 +++++--
 wcsmbs/tst-wcsnlen.c         |  7 +++++--
 wcsmbs/tst-wcstof.c          |  7 +++++--
 150 files changed, 760 insertions(+), 308 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Adjust-most-tests-to-use-test-skeleton.c.patch
Type: text/x-patch
Size: 65423 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20141021/fe2240df/attachment.bin>


More information about the Libc-alpha mailing list