Codebase list datefudge / 24cf5fb
Don't override clock_gettime(2) on GNU/Hurd. * datefudge.c: don't override clock_gettime(2) on GNU/Hurd - it seems it internally calls gettimeofday(2), which is overridden. This fixes FTBFS due to test failure on that platform. * Makefile: add test for `perl localtime()'. Robert Luberda 13 years ago
3 changed file(s) with 31 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
0 # $Id: Makefile 15 2011-02-05 14:21:35Z robert $
0 # $Id: Makefile 19 2011-02-14 22:21:52Z robert $
11
22 VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
33
3333 clean:
3434 rm -f datefudge.o datefudge.so datefudge datefudge.1
3535
36 # The first run may possibly fail when it's around midnight.
36 # The first run may possibly fail when it's around midnight, that's why it's run twice.
3737 test: compile
38 @echo -n "Running a simple test... " ;\
38 @echo -n "Running a simple date test... " ;\
39 export TZ=UTC ;\
40 ret1=1; ret2=1 ;\
3941 for i in 1 2; do \
4042 export DATEFUDGE=`LC_ALL=C date --date='yesterday 0:00' +%s` ;\
41 dt=`LD_PRELOAD=$(CURDIR)/datefudge.so date --date=12:15 +%F.%T` ;\
43 dt=`LC_ALL=C LD_PRELOAD=$(CURDIR)/datefudge.so date --date=12:15 +%F.%T` ;\
4244 exp="1970-01-02.12:15:00" ;\
43 [ "$$dt" != "$$exp" ] || { echo "OK"; exit 0; } ;\
45 [ "$$dt" != "$$exp" ] || { echo "OK"; ret1=0; break; } ;\
4446 echo "failed: expected: $$exp, actual: $$dt" ;\
45 [ $$i == 2 ] || { echo -n "retrying... "; sleep 2; } ;\
47 [ $$i = 2 ] || { echo -n " retrying... "; sleep 2; } ;\
4648 done ;\
47 exit 1;
49 echo -n "Running a simple perl localtime() test... " ;\
50 pscr='@t=localtime(time);$$t[5]+=1900;$$t[4]++;printf "%04d-%02d-%02d\n",$$t[5],$$t[4],$$t[3];';\
51 for i in 1 2; do \
52 export DATEFUDGE=`LC_ALL=C date --date='yesterday 0:00' +%s` ;\
53 dt=`LD_PRELOAD=$(CURDIR)/datefudge.so perl -e "$$pscr"` ;\
54 exp="1970-01-02" ;\
55 [ "$$dt" != "$$exp" ] || { echo "OK"; ret2=0; break; } ;\
56 echo "failed: expected: $$exp, actual: $$dt" ;\
57 [ $$i = 2 ] || { echo -n " retrying... "; sleep 2; } ;\
58 done ;\
59 exit `expr $$ret1 + $$ret2`;
22 *
33 * Copyright (C) 2001-2003, Matthias Urlichs <smurf@noris.de>
44 *
5 * $Id: datefudge.c 10 2008-05-10 06:19:48Z robert $
5 * $Id: datefudge.c 19 2011-02-14 22:21:52Z robert $
66 */
77 #define _GNU_SOURCE
88
6666 return __gettimeofday(x,y);
6767 }
6868
69 #ifndef __GNU__
6970
7071 int clock_gettime(clockid_t x, struct timespec *y) {
7172 static int (*libc_clock_gettime)(clockid_t, struct timespec*);
8081 return 0;
8182 }
8283
83
84
85
86
84 #endif
0 datefudge (1.16) unstable; urgency=low
1
2 * datefudge.c: don't override clock_gettime(2) on GNU/Hurd - it seems
3 it internally calls gettimeofday(2), which is overridden. This fixes
4 FTBFS due to test failure on that platform.
5 * Makefile: add test for `perl localtime()'.
6
7 -- Robert Luberda <robert@debian.org> Mon, 14 Feb 2011 23:03:20 +0100
8
09 datefudge (1.15) unstable; urgency=low
110
211 * Use the `3.0 (native)' source format.