File 0895-tools-Polish-fprof-testcases.patch of Package erlang
From fac371bf9176e2159f87ff903d9a239a1fa1e907 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Fri, 24 Apr 2020 14:35:02 +0200
Subject: [PATCH 10/14] tools: Polish fprof testcases
---
lib/tools/test/fprof_SUITE.erl | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/tools/test/fprof_SUITE.erl b/lib/tools/test/fprof_SUITE.erl
index 898d20f560..f5d68c20f0 100644
--- a/lib/tools/test/fprof_SUITE.erl
+++ b/lib/tools/test/fprof_SUITE.erl
@@ -501,7 +501,11 @@ cpu_create_file_slow(Config) when is_list(Config) ->
%%
{ok, [T, P]} = parse(AnalysisFile),
io:format("~p~n~n~p~n", [P, ets:tab2list(T)]),
- ok = verify(T, P),
+ try
+ ok = verify(T, P)
+ catch throw:{negative,_Weird} ->
+ io:format("Aborted as counter is negative because of bad cpu_time")
+ end,
Proc = pid_to_list(self()),
case P of
[{analysis_options, _},
@@ -520,13 +524,7 @@ cpu_create_file_slow(Config) when is_list(Config) ->
io:format("cpu_ts:~w, fprof:~w~n", [Acc, Acc1]),
{comment, io_lib:format("~p% cpu utilization", [100*divide(Acc,Acc1)])};
{'EXIT', not_supported} ->
- case {os:type(), os:version()} of
- {{unix, sunos}, {Major, Minor, _}}
- when Major >= 5, Minor >= 7 ->
- ct:fail(Result);
- _ ->
- {skipped, "not_supported"}
- end;
+ {skipped, "not_supported"};
_ ->
ct:fail(Result)
end,
@@ -633,6 +631,8 @@ verify(Tab, [{analysis_options, _},
{Proc, Cnt_P, Acc_P, Own_P} = Clocks
when Acc_P >= Own_P ->
Clocks;
+ {_, _, Acc_p, _} = Weird when Acc_p < 0 ->
+ throw({negative, Weird});
Weird ->
throw({error, [?MODULE, ?LINE, Weird]})
end
--
2.16.4