File 0914-stdlib-Fix-supervisor-scale-tc-on-windows.patch of Package erlang
From e03380d96071f6023dbb41cebea379ea3d724991 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 1 Jun 2020 11:41:09 +0200
Subject: [PATCH 07/18] stdlib: Fix supervisor scale tc on windows
---
lib/stdlib/test/supervisor_SUITE.erl | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index e4e123a61a..871d605737 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -2381,11 +2381,21 @@ scale_start_stop_many_children() ->
ct:log("~w children, start time: ~w ms, stop time: ~w ms",
[N2, StartT2 div 1000, StopT2 div 1000]),
+ TimerAdjustment =
+ case os:type() of
+ {win32,_} ->
+ %% Windows timer unit is really bad...
+ 16000;
+ _ ->
+ %% To avoid div by zero
+ 1
+ end,
+
%% Scaling should be more or less linear, but allowing a bit more
%% to avoid false alarms (add 1 to avoid div zero)
ScaleLimit = (N2 div N1) * 10,
- StartScale = StartT2 div (StartT1+1),
- StopScale = StopT2 div (StopT1+1),
+ StartScale = StartT2 div (StartT1+TimerAdjustment),
+ StopScale = StopT2 div (StopT1+TimerAdjustment),
ct:log("Scale limit: ~w~nStart scale: ~w~nStop scale: ~w",
[ScaleLimit, StartScale, StopScale]),
--
2.26.2