File: clock-granularity.diff

package info (click to toggle)
s3ql 3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,020 kB
  • sloc: python: 15,998; makefile: 125; sh: 37; ansic: 22
file content (31 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From: Nikolaus Rath <Nikolaus@rath.org>
Date: Tue, 23 Feb 2016 15:44:51 -0800
Subject: Estimate system clock granularity more conservatively

Origin: debian
Forwarded: no
Patch-Name: clock-granularity.diff

Some unit tests check that file access time stamps are updated
correctly. For such a test to succeed, it's necessarily that the time
between two subsequent test-accesses can actually be resolved. The
heuristic to determine this granularity doesn't seem to work well on
e.g. the i386 buildd, so we make it much more conservative. This means
the test suite runs longer, but otherwise has no ill effects.
---
 tests/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/common.py b/tests/common.py
index 8c3be59..bea2e5c 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -27,7 +27,7 @@ def get_clock_granularity():
             stamp2 = time.time()
         resolution = min(resolution, stamp2 - stamp1)
         time.sleep(0.01)
-    return resolution
+    return max(1, 10 * resolution)
 CLOCK_GRANULARITY = get_clock_granularity()
 
 # When testing, we want to make sure that we don't sleep for too short a time