summary refs log tree commit diff
path: root/pkgs/tools/security/tor
diff options
context:
space:
mode:
authorKonrad Borowski <konrad@borowski.pw>2020-02-19 09:03:39 +0100
committerKonrad Borowski <konrad@borowski.pw>2020-02-19 09:11:46 +0100
commit58af3177c08fb6055ad82ff9fa9378582bfe379e (patch)
tree22eb2c9bfded29623c6ed3f17d5f139c95a20ea5 /pkgs/tools/security/tor
parent329102c47bd1c68f0acdf4feec64232202948c7a (diff)
downloadnixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar.gz
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar.bz2
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar.lz
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar.xz
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.tar.zst
nixpkgs-58af3177c08fb6055ad82ff9fa9378582bfe379e.zip
tor: fix build
Monotonic timer test expects sleep(200ms) to take at most 1s. On
loaded systems like hydra, it's possible for such a test to take
longer than 1 second.

Tests expecting sleep(200ms) to take at least 175ms weren't removed,
because load shouldn't cause sleep to be shorter.
Diffstat (limited to 'pkgs/tools/security/tor')
-rw-r--r--pkgs/tools/security/tor/default.nix3
-rw-r--r--pkgs/tools/security/tor/disable-monotonic-timer-tests.patch26
2 files changed, 28 insertions, 1 deletions
diff --git a/pkgs/tools/security/tor/default.nix b/pkgs/tools/security/tor/default.nix
index 698693be95e..78d5b4441d5 100644
--- a/pkgs/tools/security/tor/default.nix
+++ b/pkgs/tools/security/tor/default.nix
@@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ libevent openssl zlib lzma zstd scrypt ] ++
     stdenv.lib.optionals stdenv.isLinux [ libseccomp systemd libcap ];
 
+  patches = [ ./disable-monotonic-timer-tests.patch ];
+
   NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.cc.isGNU "-lgcc_s";
 
   postPatch = ''
@@ -39,7 +41,6 @@ stdenv.mkDerivation rec {
   '';
 
   enableParallelBuilding = true;
-  enableParallelChecking = false; # 4 tests fail randomly
 
   doCheck = true;
 
diff --git a/pkgs/tools/security/tor/disable-monotonic-timer-tests.patch b/pkgs/tools/security/tor/disable-monotonic-timer-tests.patch
new file mode 100644
index 00000000000..a95a373bbb6
--- /dev/null
+++ b/pkgs/tools/security/tor/disable-monotonic-timer-tests.patch
@@ -0,0 +1,26 @@
+diff --git a/src/test/test_util.c b/src/test/test_util.c
+index 0d86a5ab5..e93c6ba89 100644
+--- a/src/test/test_util.c
++++ b/src/test/test_util.c
+@@ -5829,13 +5829,9 @@ test_util_monotonic_time(void *arg)
+   /* We need to be a little careful here since we don't know the system load.
+    */
+   tt_i64_op(monotime_diff_msec(&mt1, &mt2), OP_GE, 175);
+-  tt_i64_op(monotime_diff_msec(&mt1, &mt2), OP_LT, 1000);
+   tt_i64_op(monotime_coarse_diff_msec(&mtc1, &mtc2), OP_GE, 125);
+-  tt_i64_op(monotime_coarse_diff_msec(&mtc1, &mtc2), OP_LT, 1000);
+   tt_u64_op(nsec2-nsec1, OP_GE, 175000000);
+-  tt_u64_op(nsec2-nsec1, OP_LT, 1000000000);
+   tt_u64_op(nsecc2-nsecc1, OP_GE, 125000000);
+-  tt_u64_op(nsecc2-nsecc1, OP_LT, 1000000000);
+ 
+   tt_u64_op(msec1, OP_GE, nsec1 / 1000000);
+   tt_u64_op(usec1, OP_GE, nsec1 / 1000);
+@@ -5849,7 +5845,6 @@ test_util_monotonic_time(void *arg)
+   uint64_t coarse_stamp_diff =
+     monotime_coarse_stamp_units_to_approx_msec(stamp2-stamp1);
+   tt_u64_op(coarse_stamp_diff, OP_GE, 120);
+-  tt_u64_op(coarse_stamp_diff, OP_LE, 1200);
+ 
+   {
+     uint64_t units = monotime_msec_to_approx_coarse_stamp_units(5000);