aboutsummaryrefslogtreecommitdiff
path: root/tests/timeval.at
blob: 0d61bffcb9a5d81a72a210af431ce4445e657892 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
AT_BANNER([timeval unit tests])

AT_SETUP([check that time advances])
AT_KEYWORDS([timeval])
AT_CHECK([test-timeval plain], [0])
AT_CLEANUP

AT_SETUP([check that time advances after daemonize()])
AT_KEYWORDS([timeval])
AT_CHECK([test-timeval daemon], [0])
AT_CHECK(
  [# First try a quick sleep, so that the test completes very quickly
   # in the normal case.  POSIX doesn't require fractional times to
   # work, so this might not work.
   sleep 0.1; if test -e test-timeval.success; then echo success; exit 0; fi
   # Then wait up to 2 seconds.
   sleep 1; if test -e test-timeval.success; then echo success; exit 0; fi
   sleep 1; if test -e test-timeval.success; then echo success; exit 0; fi
   echo failure; exit 1],
  [0], [success
], [])
AT_CLEANUP