Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0439-otp_SUITE-Refactor-creation-of-the-xref-se...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0439-otp_SUITE-Refactor-creation-of-the-xref-server.patch of Package erlang
From fde0b52c46ba07a9ea6fd12970e1d6e85cbde28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Fri, 26 Feb 2021 09:23:37 +0100 Subject: [PATCH 2/3] otp_SUITE: Refactor creation of the xref server Break out the creation of the xref server to a separater helper functions to facilitate creation of multiple xref servers running in different modes. --- erts/test/otp_SUITE.erl | 53 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl index 4e0db62989..d00583fd15 100644 --- a/erts/test/otp_SUITE.erl +++ b/erts/test/otp_SUITE.erl @@ -43,29 +43,7 @@ all() -> runtime_dependencies]. init_per_suite(Config) -> - Root = code:root_dir(), - Server = daily_xref, - xref:start(Server), - xref:set_default(Server, [{verbose,false}, - {warnings,false}, - {builtins,true}]), - {ok,_Relname} = xref:add_release(Server, Root, {name,otp}), - - %% If we are running the tests in the source tree, the ERTS application - %% is not in the code path. We must add it explicitly. - case code:lib_dir(erts) of - {error,bad_name} -> - Erts = filename:join([code:root_dir(),"erts","preloaded","ebin"]), - {ok,_} = xref:add_directory(Server, Erts, []); - LibDir -> - case file:read_file_info(filename:join([LibDir,"ebin"])) of - {error,enoent} -> - Erts = filename:join([LibDir, "preloaded","ebin"]), - {ok,_} = xref:add_directory(Server, Erts, []); - _ -> - ok - end - end, + Server = start_xref_server(daily_xref, functions), [{xref_server,Server}|Config]. end_per_suite(Config) -> @@ -387,7 +365,6 @@ runtime_dependencies(Config) -> %% found by xref. IgnoreApps = [diameter], - %% Verify that (at least) OTP application runtime dependencies found %% by xref are listed in the runtime_dependencies field of the .app file %% of each application. @@ -511,3 +488,31 @@ app_exists(AppAtom) -> false end end. + +start_xref_server(Server, Mode) -> + Root = code:root_dir(), + xref:start(Server), + xref:set_default(Server, [{xref_mode,Mode}, + {verbose,false}, + {warnings,false}, + {builtins,true}]), + {ok,_Relname} = xref:add_release(Server, Root, {name,otp}), + + case code:lib_dir(erts) of + {error,bad_name} -> + %% This should not be possible since code_server always adds + %% an entry for erts. + ct:fail(no_erts_lib_dir); + LibDir -> + case filelib:is_dir(filename:join(LibDir, "ebin")) of + false -> + %% If we are running the tests in the git repository, + %% the preloaded BEAM files for Erts are not in the + %% code path. We must add them explicitly. + Erts = filename:join([LibDir,"preloaded","ebin"]), + {ok,_} = xref:add_directory(Server, Erts, []); + true -> + ok + end + end, + Server. -- 2.26.2
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