Eric Blake wrote: > Multiple calls to sleep(2) add up fast! I've especially noticed it while > working on my utimensat series, where repeatedly running 'make check' stalls > on > this test. Unless you are insane enough to run on FAT, or unlucky enough to > be > on mingw (since I didn't want to drag in a dependency on xnanosleep just for > this test), this patch gives an order-of-magnitude speedup to test-stat-time. > > > From: Eric Blake <e...@byu.net> > Date: Fri, 9 Oct 2009 11:55:46 -0600 > Subject: [PATCH] test-stat-time: speed up execution > > Eight seconds was painfully long. > > * tests/test-stat-time.c (test_ctime) [!W32]: Avoid compiler > warning on mingw. > (nap): New helper function. > (prepare_test): Use it to reduce sleep time. > (test_mtime, test_ctime, test_birthtime): Allow for subsecond > execution. > * modules/stat-time-tests (configure.ac): Check for usleep. ... > +#if !HAVE_USLEEP > + /* Assume the worst case file system of FAT, which has a granularity > + of 2 seconds. */ > + sleep (2); > +#else /* HAVE_USLEEP */
Nice. However, I saw no improvement when running that test via coreutils. I guess your environment already had a test for the usleep function. >From fd35e151ef9bb99c504462691dd33f41254a2b32 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 10 Oct 2009 11:05:22 +0200 Subject: [PATCH] stat-time-tests: check for the usleep function * modules/stat-time-tests (configure.ac): Now that we test HAVE_USLEEP. --- ChangeLog | 5 +++++ modules/stat-time-tests | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0a779a..9b05c4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-10 Jim Meyering <meyer...@redhat.com> + + stat-time-tests: check for the usleep function + * modules/stat-time-tests (configure.ac): Now that we test HAVE_USLEEP. + 2009-10-10 Bruno Haible <br...@clisp.org> * modules/xnanosleep: Put the Link section after the Include section. diff --git a/modules/stat-time-tests b/modules/stat-time-tests index d4f6041..3913ad2 100644 --- a/modules/stat-time-tests +++ b/modules/stat-time-tests @@ -6,6 +6,7 @@ time sleep configure.ac: +AC_CHECK_FUNCS([usleep]) Makefile.am: TESTS += test-stat-time -- 1.6.5.rc3.227.g2ff1c