Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
2932-prof_bench_SUITE-Robustify-test-for-insuff...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2932-prof_bench_SUITE-Robustify-test-for-insufficient-dis.patch of Package erlang
From 3b11f8c93ae1f9e768ae9b467201bffa597555b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Thu, 5 May 2022 08:37:45 +0200 Subject: [PATCH 2/3] prof_bench_SUITE: Robustify test for insufficient disk space Testing for a 32-bit computer is not reliable. A modern Raspberry Pi have a 64-bit CPU but can still have a very small disk. While we are it, remove out-commented code. --- lib/tools/test/prof_bench_SUITE.erl | 53 ++++++++++++++++++----------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/lib/tools/test/prof_bench_SUITE.erl b/lib/tools/test/prof_bench_SUITE.erl index 28473872bd..ea526bcf79 100644 --- a/lib/tools/test/prof_bench_SUITE.erl +++ b/lib/tools/test/prof_bench_SUITE.erl @@ -38,12 +38,22 @@ all() -> [overhead]. init_per_suite(Config) -> - case {whereis(cover_server) =/= undefined, - erlang:system_info(wordsize)} - of - {true, _} -> {skip, "Cover is running"}; - {_, 4} -> {skip, "Can't run on 32-bit as files will be large"}; - {false, 8} -> Config + case whereis(cover_server) of + undefined -> + application:ensure_all_started(os_mon), + Free = disk_free(proplists:get_value(priv_dir, Config)), + if + Free >= 16_000_000 -> + %% The size of the log files is about 4 Gb. + %% The disk has at least 4 times that amount free. + Config; + true -> + %% There might not be sufficient disk space free. + io:format("Free disk space: ~p Kb\n", [Free]), + {skip, "Insufficient free disk space"} + end; + Pid when is_pid(Pid) -> + {skip, "Cover is running"} end. end_per_suite(Config) -> @@ -51,6 +61,23 @@ end_per_suite(Config) -> file:delete(LogFile), ok. +%% Return amount disk space free in Kbs for the disk that Path +%% is located on. +disk_free(Path) -> + Data = disksup:get_disk_data(), + + %% What partitions could Data be mounted on? + Partitions = + [D || {P, _Tot, _Perc}=D <- Data, + lists:prefix(filename:nativename(P), filename:nativename(Path))], + + %% Sorting in descending order places the partition with the most specific + %% path first. + case lists:sort(fun erlang:'>='/2, Partitions) of + [{_,Tot, Perc} | _] -> round(Tot * (1-(Perc/100))); + [] -> error + end. + %%%--------------------------------------------------------------------- %% ct:run_test([{suite, prof_bench_SUITE}]). @@ -83,20 +110,6 @@ overhead(Config) -> data = [{name, cover_overhead}, {value, NormTime / CoverTime * 100}]}). -%% overhead(Config) -> -%% LogFile = filename:join(proplists:get_value(priv_dir, Config), "fprof.trace"), -%% SofsCopy = filename:join(proplists:get_value(data_dir, Config), "sofs_copy.erl"), -%% TC = fun() -> compile:file(SofsCopy, [binary]) end, -%% _Warmup = timer:tc(TC), - -%% [{ok,{EProfTime,{ok,sofs_copy,_}}} = eprof:profile([], timer, tc, [TC]) -%% || _ <- lists:seq(1,10)], -%% %% [fprof:apply(timer, tc, [TC], [{file, LogFile}]) || _ <- lists:seq(1,10)], -%% {FProfTime,{ok,sofs_copy,_}} = fprof:apply(timer, tc, [TC], [{file, LogFile}]), -%% {NormTime,{ok, sofs_copy, _}} = timer:tc(TC), - - %% ct:pal("FProf: ~p Norm: ~p Ratio: ~p",[FProfTime, NormTime, FProfTime / NormTime]). - cprof_apply(M, F, A) -> cprof:start(), Res = apply(M, F, A), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor