Skip to content

Commit

Permalink
Merge branch 'siri/sasl/no-default-module-test/OTP-9146' into dev
Browse files Browse the repository at this point in the history
* siri/sasl/no-default-module-test/OTP-9146:
  Change default behaviour to not check src code when creating release
  • Loading branch information
sirihansen committed Mar 31, 2011
2 parents cbb9787 + ed2b38d commit 07307ef
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 52 deletions.
16 changes: 7 additions & 9 deletions lib/sasl/doc/src/systools.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<fsummary>Generate a boot script <c>.script/.boot</c>.</fsummary>
<type>
<v>Name = string()</v>
<v>Opt = no_module_tests | {path,[Dir]} | local | {variables,[Var]} | exref | {exref,[App]}] | silent | {outdir,Dir}</v>
<v>Opt = src_tests | {path,[Dir]} | local | {variables,[Var]} | exref | {exref,[App]}] | silent | {outdir,Dir}</v>
<v>&nbsp;Dir = string()</v>
<v>&nbsp;Var = {VarName,Prefix}</v>
<v>&nbsp;&nbsp;VarName = Prefix = string()</v>
Expand Down Expand Up @@ -174,15 +174,13 @@
the applications.</p>
</item>
<item>
<p>There should no duplicated modules, that is, modules with
<p>There should be no duplicated modules, that is, modules with
the same name but belonging to different applications.</p>
</item>
<item>
<p>A warning is issued if the source code for a module is
missing or newer than the object code. <br></br>

If the <c>no_module_tests</c> option is specified, this
check is omitted.</p>
<p>If the <c>src_tests</c> option is specified, a
warning is issued if the source code for a module is
missing or newer than the object code.</p>
</item>
</list>
<p>The applications are sorted according to the dependencies
Expand Down Expand Up @@ -242,7 +240,7 @@
<fsummary>Create a release package.</fsummary>
<type>
<v>Name = string()</v>
<v>Opt = {dirs,[IncDir]} | {path,[Dir]} | {variables,[Var]} | {var_tar,VarTar} | {erts,Dir} | no_module_tests | exref | {exref,[App]} | silent | {outdir,Dir}</v>
<v>Opt = {dirs,[IncDir]} | {path,[Dir]} | {variables,[Var]} | {var_tar,VarTar} | {erts,Dir} | src_tests | exref | {exref,[App]} | silent | {outdir,Dir}</v>
<v>&nbsp;Dir = string()</v>
<v>&nbsp;IncDir = src | include | atom()</v>
<v>&nbsp;Var = {VarName,PreFix}</v>
Expand Down Expand Up @@ -330,7 +328,7 @@ myapp-1/ebin/myapp.app
system <c>{erts,Dir}</c> is copied to <c>erts-ErtsVsn/bin</c>.</p>
<p>All checks performed with the <c>make_script</c> function
are performed before the release package is created. The
<c>no_module_tests</c> and <c>exref</c> options are also
<c>src_tests</c> and <c>exref</c> options are also
valid here.</p>
<p>The return value and the handling of errors and warnings
are the same as described for <c>make_script</c> above.</p>
Expand Down
83 changes: 46 additions & 37 deletions lib/sasl/src/systools_make.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -50,7 +50,7 @@
%% the applications are found.
%%
%% New options: {path,Path} can contain wildcards
%% no_module_tests
%% src_tests
%% {variables,[{Name,AbsString}]}
%% {machine, jam | beam | vee}
%% exref | {exref, [AppName]}
Expand Down Expand Up @@ -82,8 +82,7 @@ make_script(RelName, Output, Flags) when is_list(RelName),
Path0 = get_path(Flags),
Path1 = mk_path(Path0), % expand wildcards etc.
Path = make_set(Path1 ++ code:get_path()),
ModTestP = {not member(no_module_tests, Flags),
xref_p(Flags)},
ModTestP = {member(src_tests, Flags),xref_p(Flags)},
case get_release(RelName, Path, ModTestP, machine(Flags)) of
{ok, Release, Appls, Warnings} ->
case generate_script(Output,Release,Appls,Flags) of
Expand Down Expand Up @@ -155,7 +154,7 @@ return({error,Mod,Error},_,Flags) ->
%% should be included in the release package and there it can be found.
%%
%% New options: {path,Path} can contain wildcards
%% no_module_tests
%% src_tests
%% exref | {exref, [AppName]}
%% {variables,[{Name,AbsString}]}
%% {machine, jam | beam | vee}
Expand Down Expand Up @@ -190,8 +189,7 @@ make_tar(RelName, Flags) when is_list(RelName), is_list(Flags) ->
Path0 = get_path(Flags),
Path1 = mk_path(Path0),
Path = make_set(Path1 ++ code:get_path()),
ModTestP = {not member(no_module_tests, Flags),
xref_p(Flags)},
ModTestP = {member(src_tests, Flags),xref_p(Flags)},
case get_release(RelName, Path, ModTestP, machine(Flags)) of
{ok, Release, Appls, Warnings} ->
case catch mk_tar(RelName, Release, Appls, Flags, Path1) of
Expand All @@ -218,7 +216,7 @@ make_tar(RelName, Flags) ->
%% {ok, #release, [{{Name,Vsn},#application}], Warnings} | {error, What}

get_release(File, Path) ->
get_release(File, Path, true, false).
get_release(File, Path, {false,false}, false).

get_release(File, Path, ModTestP) ->
get_release(File, Path, ModTestP, false).
Expand Down Expand Up @@ -771,36 +769,40 @@ get_mod_vsn([]) ->
%% Use the module extension of the running machine as extension for
%% the checked modules.

check_mods(Modules, Appls, Path, {true, XrefP}, Machine) ->
Ext = objfile_extension(Machine),
IncPath = create_include_path(Appls, Path),
Res = append(map(fun(ModT) ->
{Mod,_Vsn,App,_,Dir} = ModT,
case check_mod(Mod,App,Dir,Ext,IncPath) of
ok ->
[];
{error, Error} ->
[{error,{Error, ModT}}];
{warning, Warn} ->
[{warning,{Warn,ModT}}]
end
end,
Modules)),
Res2 = Res ++ check_xref(Appls, Path, XrefP),
check_mods(Modules, Appls, Path, {SrcTestP, XrefP}, Machine) ->
SrcTestRes = check_src(Modules, Appls, Path, SrcTestP, Machine),
XrefRes = check_xref(Appls, Path, XrefP),
Res = SrcTestRes ++ XrefRes,
case filter(fun({error, _}) -> true;
(_) -> false
end,
Res2) of
Res) of
[] ->
{ok, filter(fun({warning, _}) -> true;
(_) -> false
end,
Res2)};
Res)};
Errors ->
{error, Errors}
end;
check_mods(_, _, _, _, _) ->
{ok, []}.
end.

check_src(Modules, Appls, Path, true, Machine) ->
Ext = objfile_extension(Machine),
IncPath = create_include_path(Appls, Path),
append(map(fun(ModT) ->
{Mod,_Vsn,App,_,Dir} = ModT,
case check_mod(Mod,App,Dir,Ext,IncPath) of
ok ->
[];
{error, Error} ->
[{error,{Error, ModT}}];
{warning, Warn} ->
[{warning,{Warn,ModT}}]
end
end,
Modules));
check_src(_, _, _, _, _) ->
[].

check_xref(_Appls, _Path, false) ->
[];
Expand Down Expand Up @@ -1853,11 +1855,11 @@ cas([silent | Args], {Path, _Sil, Loc, Test, Var, Mach,
cas([local | Args], {Path, Sil, _Loc, Test, Var, Mach,
Xref, XrefApps, X}) ->
cas(Args, {Path, Sil, local, Test, Var, Mach, Xref, XrefApps, X});
%%% no_module_tests ----------------------------------------------------
cas([no_module_tests | Args], {Path, Sil, Loc, _Test, Var, Mach,
Xref, XrefApps, X}) ->
%%% src_tests -------------------------------------------------------
cas([src_tests | Args], {Path, Sil, Loc, _Test, Var, Mach,
Xref, XrefApps, X}) ->
cas(Args,
{Path, Sil, Loc, no_module_tests, Var, Mach, Xref, XrefApps,X});
{Path, Sil, Loc, src_tests, Var, Mach, Xref, XrefApps,X});
%%% variables ----------------------------------------------------------
cas([{variables, V} | Args], {Path, Sil, Loc, Test, Var, Mach,
Xref, XrefApps, X}) when is_list(V) ->
Expand Down Expand Up @@ -1896,6 +1898,10 @@ cas([{outdir, Dir} | Args], {Path, Sil, Loc, Test, Var, Mach,
cas([otp_build | Args], {Path, Sil, Loc, Test, Var, Mach,
Xref, XrefApps, X}) ->
cas(Args, {Path, Sil, Loc, Test, Var, Mach, Xref, XrefApps, X});
%%% no_module_tests (kept for backwards compatibility, but ignored) ----
cas([no_module_tests | Args], {Path, Sil, Loc, Test, Var, Mach,
Xref, XrefApps, X}) ->
cas(Args, {Path, Sil, Loc, Test, Var, Mach, Xref, XrefApps,X});
%%% ERROR --------------------------------------------------------------
cas([Y | Args], {Path, Sil, Loc, Test, Var, Mach, Xref, XrefApps, X}) ->
cas(Args, {Path, Sil, Loc, Test, Var, Mach, Xref, XrefApps,X++[Y]}).
Expand Down Expand Up @@ -1935,10 +1941,10 @@ cat([{dirs, D} | Args], {Path, Sil, Dirs, Erts, Test,
cat([{erts, E} | Args], {Path, Sil, Dirs, _Erts, Test,
Var, VarTar, Mach, Xref, XrefApps, X}) when is_list(E)->
cat(Args, {Path, Sil, Dirs, E, Test, Var, VarTar, Mach, Xref, XrefApps, X});
%%% no_module_tests ----------------------------------------------------
cat([no_module_tests | Args], {Path, Sil, Dirs, Erts, _Test, Var, VarTar, Mach, Xref, XrefApps, X}) ->
cat(Args, {Path, Sil, Dirs, Erts, no_module_tests, Var, VarTar, Mach,
Xref, XrefApps, X});
%%% src_tests ----------------------------------------------------
cat([src_tests | Args], {Path, Sil, Dirs, Erts, _Test, Var, VarTar, Mach, Xref, XrefApps, X}) ->
cat(Args, {Path, Sil, Dirs, Erts, src_tests, Var, VarTar, Mach,
Xref, XrefApps, X});
%%% variables ----------------------------------------------------------
cat([{variables, V} | Args], {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X}) when is_list(V) ->
case check_vars(V) of
Expand Down Expand Up @@ -1982,6 +1988,9 @@ cat([{outdir, Dir} | Args], {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xre
%%% otp_build (secret, not documented) ---------------------------------
cat([otp_build | Args], {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X}) ->
cat(Args, {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X});
%%% no_module_tests (kept for backwards compatibility, but ignored) ----
cat([no_module_tests | Args], {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X}) ->
cat(Args, {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X});
%%% ERROR --------------------------------------------------------------
cat([Y | Args], {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X}) ->
cat(Args, {Path, Sil, Dirs, Erts, Test, Var, VarTar, Mach, Xref, XrefApps, X++[Y]}).
Expand Down
9 changes: 3 additions & 6 deletions lib/sasl/src/systools_relup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ check_opts([]) ->
[].

do_mk_relup(TopRelFile, BaseUpRelDcs, BaseDnRelDcs, Path, Opts) ->
ModTest = false,
case systools_make:get_release(to_list(TopRelFile), Path, ModTest) of
case systools_make:get_release(to_list(TopRelFile), Path) of
%%
%% TopRel = #release
%% NameVsnApps = [{{Name, Vsn}, #application}]
Expand Down Expand Up @@ -246,9 +245,8 @@ foreach_baserel_up(TopRel, TopApps, [BaseRelDc|BaseRelDcs], Path, Opts,
{RUs4, Ws4} =
check_for_emulator_restart(TopRel, BaseRel, RUs3, Ws3, Opts),

ModTest = false,
BaseApps =
case systools_make:get_release(BaseRelFile, Path, ModTest) of
case systools_make:get_release(BaseRelFile, Path) of
{ok, _, NameVsnApps, _Warns} ->
lists:map(fun({_,App}) -> App end, NameVsnApps);
Other1 ->
Expand Down Expand Up @@ -283,9 +281,8 @@ foreach_baserel_dn(TopRel, TopApps, [BaseRelDc|BaseRelDcs], Path, Opts,
%%
{RUs1, Ws1} = collect_appup_scripts(dn, TopApps, BaseRel, Ws, []),

ModTest = false,
{BaseApps, Ws2} =
case systools_make:get_release(BaseRelFile, Path, ModTest) of
case systools_make:get_release(BaseRelFile, Path) of
%%
%% NameVsnApps = [{{Name, Vsn}, #application}]
{ok, _, NameVsnApps, Warns} ->
Expand Down

0 comments on commit 07307ef

Please sign in to comment.