From 15e1ff76c9b14bb281c1e2438be6f49e1df2edaa Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Tue, 18 Feb 2014 12:12:21 +0100 Subject: Fix non-library appup files according to issue #240 Fix the appup files of runtime_tools and os_mon with wildcard version regexps. inets, odbc and ssh regexps have been corrected to match as originally intended. --- lib/inets/src/inets_app/inets.appup.src | 14 +++++--------- lib/odbc/src/odbc.appup.src | 20 ++++++++++++++++++-- lib/os_mon/src/os_mon.appup.src | 27 ++++----------------------- lib/runtime_tools/src/runtime_tools.appup.src | 10 ++++++---- lib/ssh/src/ssh.appup.src | 16 ++++++++-------- 5 files changed, 41 insertions(+), 46 deletions(-) (limited to 'lib') diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src index c63dcafa6c..7a909b2f3f 100644 --- a/lib/inets/src/inets_app/inets.appup.src +++ b/lib/inets/src/inets_app/inets.appup.src @@ -1,7 +1,7 @@ -%% This is an -*- erlang -*- file. +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2013. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. 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 @@ -15,11 +15,7 @@ %% under the License. %% %% %CopyrightEnd% - {"%VSN%", - [ - {<<"5\\.*">>, [{restart_application, inets}]} - ], - [ - {<<"5\\.*">>, [{restart_application, inets}]} -]}. + [{<<"5\\..*">>,[{restart_application, inets}]}], + [{<<"5\\..*">>,[{restart_application, inets}]}] +}. diff --git a/lib/odbc/src/odbc.appup.src b/lib/odbc/src/odbc.appup.src index c7c83ea079..bf8872eae4 100644 --- a/lib/odbc/src/odbc.appup.src +++ b/lib/odbc/src/odbc.appup.src @@ -1,8 +1,24 @@ %% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% {"%VSN%", [ - {<<"2\\.*">>, [{restart_application, odbc}]} + {<<"2\\..*">>, [{restart_application, odbc}]} ], [ - {<<"2\\.*">>, [{restart_application, odbc}]} + {<<"2\\..*">>, [{restart_application, odbc}]} ]}. diff --git a/lib/os_mon/src/os_mon.appup.src b/lib/os_mon/src/os_mon.appup.src index f8e09a7d87..480f5d9511 100644 --- a/lib/os_mon/src/os_mon.appup.src +++ b/lib/os_mon/src/os_mon.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. 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 @@ -16,26 +16,7 @@ %% %% %CopyrightEnd% %% - {"%VSN%", - [ - {"2.1", - [{load_module, cpu_sup}, - {load_module, disksup}, - {load_module, memsup}, - {load_module, os_mon}, - {load_module, os_mon_mib}]}, - {"2.1.1", - [{load_module, os_mon_mib}]} - ], - [ - {"2.1", - [{load_module, cpu_sup}, - {load_module, disksup}, - {load_module, memsup}, - {load_module, os_mon}, - {load_module, os_mon_mib}]}, - {"2.1.1", - [{load_module, os_mon_mib}]} - ] + [{<<".*">>,[{restart_application, os_mon}]}], + [{<<".*">>,[{restart_application, os_mon}]}] }. diff --git a/lib/runtime_tools/src/runtime_tools.appup.src b/lib/runtime_tools/src/runtime_tools.appup.src index 7a435e9b22..0c2bab316f 100644 --- a/lib/runtime_tools/src/runtime_tools.appup.src +++ b/lib/runtime_tools/src/runtime_tools.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. 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 @@ -15,5 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, runtime_tools}]}], + [{<<".*">>,[{restart_application, runtime_tools}]}] +}. diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src index 32f7cc470b..df34a5a3ff 100644 --- a/lib/ssh/src/ssh.appup.src +++ b/lib/ssh/src/ssh.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2013. All Rights Reserved. +%% Copyright Ericsson AB 2004-2014. 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 @@ -19,13 +19,13 @@ {"%VSN%", [ - {<<"2.1\\.*">>, [{restart_application, ssh}]}, - {<<"2.0\\.*">>, [{restart_application, ssh}]}, - {<<"1\\.*">>, [{restart_application, ssh}]} + {<<"2\\.1\\..*">>, [{restart_application, ssh}]}, + {<<"2\\.0\\..*">>, [{restart_application, ssh}]}, + {<<"1\\..*">>, [{restart_application, ssh}]} ], [ - {<<"2.1\\.*">>,[{restart_application, ssh}]}, - {<<"2.0\\.*">>, [{restart_application, ssh}]}, - {<<"1\\.*">>, [{restart_application, ssh}]} + {<<"2\\.1\\..*">>,[{restart_application, ssh}]}, + {<<"2\\.0\\..*">>, [{restart_application, ssh}]}, + {<<"1\\..*">>, [{restart_application, ssh}]} ] }. -- cgit v1.2.3 From a61f66e1157b0e77839b76ef416f436f28304579 Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Tue, 18 Feb 2014 12:29:01 +0100 Subject: Fix library application appup files As discussed in issue #240 *all* OTP library applications use the '.*' wildcard as up and down version. This makes library applications always up- and downgradeable. Using the wildcard version obsoletes all maintenance tasks regarding library applications' appup files. Additionally, it prevents upgrade problems caused by automatically included application dependencies when using reltool to create releases. Missing copyright headers are now consistently present. --- lib/asn1/src/asn1.appup.src | 30 ++++++++++++++-------- lib/common_test/src/common_test.appup.src | 22 +++++++++++++++- lib/compiler/src/compiler.appup.src | 22 +++++++++++++++- lib/crypto/src/crypto.appup.src | 14 +++------- lib/debugger/src/debugger.appup.src | 10 +++++--- lib/dialyzer/src/dialyzer.appup.src | 11 ++++---- lib/edoc/src/edoc.appup.src | 22 +++++++++++++++- lib/eldap/src/eldap.appup.src | 23 ++++++++++++++--- lib/erl_docgen/src/erl_docgen.appup.src | 22 +++++++++++++++- lib/et/src/et.appup.src | 10 +++----- lib/eunit/src/eunit.appup.src | 22 +++++++++++++++- lib/gs/src/gs.appup.src | 22 +++++++++++++++- lib/hipe/main/hipe.appup.src | 10 +++++--- lib/observer/src/observer.appup.src | 10 +++++--- lib/otp_mibs/src/otp_mibs.appup.src | 11 ++++---- lib/parsetools/src/parsetools.appup.src | 22 +++++++++++++++- lib/percept/src/percept.appup.src | 12 ++++----- lib/public_key/src/public_key.appup.src | 25 +++++++++++++----- lib/reltool/src/reltool.appup.src | 9 +++---- lib/syntax_tools/src/syntax_tools.appup.src | 22 +++++++++++++++- lib/test_server/src/test_server.appup.src | 22 +++++++++++++++- lib/tools/src/tools.appup.src | 40 +++++++++++++++-------------- lib/typer/src/typer.appup.src | 22 +++++++++++++++- lib/webtool/src/webtool.appup.src | 10 +++++--- lib/wx/src/wx.appup.src | 10 +++----- lib/xmerl/src/xmerl.appup.src | 31 +++++++++++++--------- 26 files changed, 366 insertions(+), 120 deletions(-) (limited to 'lib') diff --git a/lib/asn1/src/asn1.appup.src b/lib/asn1/src/asn1.appup.src index 2d11eddfbf..e4b3508cc4 100644 --- a/lib/asn1/src/asn1.appup.src +++ b/lib/asn1/src/asn1.appup.src @@ -1,11 +1,21 @@ +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% {"%VSN%", -% This version does not change anything of the runtime modules -% Only changes in compile time modules and thus no need for upgrade on target -[ - ], - [ - ]}. - - - - + [{<<".*">>,[{restart_application, asn1}]}], + [{<<".*">>,[{restart_application, asn1}]}] +}. diff --git a/lib/common_test/src/common_test.appup.src b/lib/common_test/src/common_test.appup.src index 0fbe5f23f7..4dfd9f1b0d 100644 --- a/lib/common_test/src/common_test.appup.src +++ b/lib/common_test/src/common_test.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. \ No newline at end of file +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, common_test}]}], + [{<<".*">>,[{restart_application, common_test}]}] +}. diff --git a/lib/compiler/src/compiler.appup.src b/lib/compiler/src/compiler.appup.src index 54a63833e6..fe273b269c 100644 --- a/lib/compiler/src/compiler.appup.src +++ b/lib/compiler/src/compiler.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, compiler}]}], + [{<<".*">>,[{restart_application, compiler}]}] +}. diff --git a/lib/crypto/src/crypto.appup.src b/lib/crypto/src/crypto.appup.src index 5b4ce5acee..42816773c1 100644 --- a/lib/crypto/src/crypto.appup.src +++ b/lib/crypto/src/crypto.appup.src @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2013. All Rights Reserved. +%% Copyright Ericsson AB 1999-2014. 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 @@ -16,13 +16,7 @@ %% under the License. %% %% %CopyrightEnd% -%% {"%VSN%", - [ - {<<"2\\.*">>, [{restart_application, crypto}]} - {<<"1\\.*">>, [{restart_application, crypto}]} - ], - [ - {<<"2\\.*">>, [{restart_application, crypto}]} - {<<"1\\.*">>, [{restart_application, crypto}]} - ]}. + [{<<".*">>,[{restart_application, crypto}]}], + [{<<".*">>,[{restart_application, crypto}]}] +}. diff --git a/lib/debugger/src/debugger.appup.src b/lib/debugger/src/debugger.appup.src index 7a435e9b22..81d2fab05a 100644 --- a/lib/debugger/src/debugger.appup.src +++ b/lib/debugger/src/debugger.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. 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 @@ -15,5 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, debugger}]}], + [{<<".*">>,[{restart_application, debugger}]}] +}. diff --git a/lib/dialyzer/src/dialyzer.appup.src b/lib/dialyzer/src/dialyzer.appup.src index 26d14ee8f4..1e293e407a 100644 --- a/lib/dialyzer/src/dialyzer.appup.src +++ b/lib/dialyzer/src/dialyzer.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-2014. 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 @@ -15,6 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% - -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, dialyzer}]}], + [{<<".*">>,[{restart_application, dialyzer}]}] +}. diff --git a/lib/edoc/src/edoc.appup.src b/lib/edoc/src/edoc.appup.src index 54a63833e6..45b4046ed8 100644 --- a/lib/edoc/src/edoc.appup.src +++ b/lib/edoc/src/edoc.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, edoc}]}], + [{<<".*">>,[{restart_application, edoc}]}] +}. diff --git a/lib/eldap/src/eldap.appup.src b/lib/eldap/src/eldap.appup.src index 8d33482f11..7a9a5ef548 100644 --- a/lib/eldap/src/eldap.appup.src +++ b/lib/eldap/src/eldap.appup.src @@ -1,6 +1,21 @@ %% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% {"%VSN%", - [ - ], - [ - ]}. + [{<<".*">>,[{restart_application, eldap}]}], + [{<<".*">>,[{restart_application, eldap}]}] +}. diff --git a/lib/erl_docgen/src/erl_docgen.appup.src b/lib/erl_docgen/src/erl_docgen.appup.src index 54a63833e6..972a881c41 100644 --- a/lib/erl_docgen/src/erl_docgen.appup.src +++ b/lib/erl_docgen/src/erl_docgen.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, erl_docgen}]}], + [{<<".*">>,[{restart_application, erl_docgen}]}] +}. diff --git a/lib/et/src/et.appup.src b/lib/et/src/et.appup.src index b6344a9387..5f15b00386 100644 --- a/lib/et/src/et.appup.src +++ b/lib/et/src/et.appup.src @@ -1,8 +1,7 @@ -%% This is an -*- erlang -*- file. -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. 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 @@ -16,8 +15,7 @@ %% under the License. %% %% %CopyrightEnd% - {"%VSN%", - [ ] + [{<<".*">>,[{restart_application, et}]}], + [{<<".*">>,[{restart_application, et}]}] }. - diff --git a/lib/eunit/src/eunit.appup.src b/lib/eunit/src/eunit.appup.src index 54a63833e6..18934d44c2 100644 --- a/lib/eunit/src/eunit.appup.src +++ b/lib/eunit/src/eunit.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, eunit}]}], + [{<<".*">>,[{restart_application, eunit}]}] +}. diff --git a/lib/gs/src/gs.appup.src b/lib/gs/src/gs.appup.src index 54a63833e6..2cb3b547e8 100644 --- a/lib/gs/src/gs.appup.src +++ b/lib/gs/src/gs.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, gs}]}], + [{<<".*">>,[{restart_application, gs}]}] +}. diff --git a/lib/hipe/main/hipe.appup.src b/lib/hipe/main/hipe.appup.src index 1d5a0d93f5..bd4a4f0671 100644 --- a/lib/hipe/main/hipe.appup.src +++ b/lib/hipe/main/hipe.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. 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 @@ -15,5 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, hipe}]}], + [{<<".*">>,[{restart_application, hipe}]}] +}. diff --git a/lib/observer/src/observer.appup.src b/lib/observer/src/observer.appup.src index 1d5a0d93f5..9fde365ff3 100644 --- a/lib/observer/src/observer.appup.src +++ b/lib/observer/src/observer.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. +%% Copyright Ericsson AB 2002-2014. 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 @@ -15,5 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, observer}]}], + [{<<".*">>,[{restart_application, observer}]}] +}. diff --git a/lib/otp_mibs/src/otp_mibs.appup.src b/lib/otp_mibs/src/otp_mibs.appup.src index 5e99dfe325..fd5ce1e391 100644 --- a/lib/otp_mibs/src/otp_mibs.appup.src +++ b/lib/otp_mibs/src/otp_mibs.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-2014. 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 @@ -15,6 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% - -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, otp_mibs}]}], + [{<<".*">>,[{restart_application, otp_mibs}]}] +}. diff --git a/lib/parsetools/src/parsetools.appup.src b/lib/parsetools/src/parsetools.appup.src index 54a63833e6..0e02099893 100644 --- a/lib/parsetools/src/parsetools.appup.src +++ b/lib/parsetools/src/parsetools.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, parsetools}]}], + [{<<".*">>,[{restart_application, parsetools}]}] +}. diff --git a/lib/percept/src/percept.appup.src b/lib/percept/src/percept.appup.src index 4fc2852878..23e67f772f 100644 --- a/lib/percept/src/percept.appup.src +++ b/lib/percept/src/percept.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-2014. 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 @@ -15,7 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% - -{"%VSN%",[],[]}. - +{"%VSN%", + [{<<".*">>,[{restart_application, percept}]}], + [{<<".*">>,[{restart_application, percept}]}] +}. diff --git a/lib/public_key/src/public_key.appup.src b/lib/public_key/src/public_key.appup.src index aacd3b866d..5278732c87 100644 --- a/lib/public_key/src/public_key.appup.src +++ b/lib/public_key/src/public_key.appup.src @@ -1,8 +1,21 @@ %% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% {"%VSN%", - [ - {<<"0\\.*">>, [{restart_application, public_key}]} - ], - [ - {<<"0\\.*">>, [{restart_application, public_key}]} - ]}. + [{<<".*">>,[{restart_application, public_key}]}], + [{<<".*">>,[{restart_application, public_key}]}] +}. diff --git a/lib/reltool/src/reltool.appup.src b/lib/reltool/src/reltool.appup.src index c02edd2afb..79ecdbd392 100644 --- a/lib/reltool/src/reltool.appup.src +++ b/lib/reltool/src/reltool.appup.src @@ -1,8 +1,7 @@ -%% This is an -*- erlang -*- file. -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. 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 @@ -16,7 +15,7 @@ %% under the License. %% %% %CopyrightEnd% - {"%VSN%", - [ ] + [{<<".*">>,[{restart_application, reltool}]}], + [{<<".*">>,[{restart_application, reltool}]}] }. diff --git a/lib/syntax_tools/src/syntax_tools.appup.src b/lib/syntax_tools/src/syntax_tools.appup.src index 54a63833e6..89c25d14d7 100644 --- a/lib/syntax_tools/src/syntax_tools.appup.src +++ b/lib/syntax_tools/src/syntax_tools.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, syntax_tools}]}], + [{<<".*">>,[{restart_application, syntax_tools}]}] +}. diff --git a/lib/test_server/src/test_server.appup.src b/lib/test_server/src/test_server.appup.src index 0fbe5f23f7..42c6fe2e46 100644 --- a/lib/test_server/src/test_server.appup.src +++ b/lib/test_server/src/test_server.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. \ No newline at end of file +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, test_server}]}], + [{<<".*">>,[{restart_application, test_server}]}] +}. diff --git a/lib/tools/src/tools.appup.src b/lib/tools/src/tools.appup.src index 8de1ec76c9..9a27456a81 100644 --- a/lib/tools/src/tools.appup.src +++ b/lib/tools/src/tools.appup.src @@ -1,19 +1,21 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. 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 -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. -# -# %CopyrightEnd% -# -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, tools}]}], + [{<<".*">>,[{restart_application, tools}]}] +}. diff --git a/lib/typer/src/typer.appup.src b/lib/typer/src/typer.appup.src index 54a63833e6..bebe7a159c 100644 --- a/lib/typer/src/typer.appup.src +++ b/lib/typer/src/typer.appup.src @@ -1 +1,21 @@ -{"%VSN%",[],[]}. +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +{"%VSN%", + [{<<".*">>,[{restart_application, typer}]}], + [{<<".*">>,[{restart_application, typer}]}] +}. diff --git a/lib/webtool/src/webtool.appup.src b/lib/webtool/src/webtool.appup.src index 7a435e9b22..9e6f4b9b5b 100644 --- a/lib/webtool/src/webtool.appup.src +++ b/lib/webtool/src/webtool.appup.src @@ -1,7 +1,7 @@ -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-2014. 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 @@ -15,5 +15,7 @@ %% under the License. %% %% %CopyrightEnd% -%% -{"%VSN%",[],[]}. +{"%VSN%", + [{<<".*">>,[{restart_application, webtool}]}], + [{<<".*">>,[{restart_application, webtool}]}] +}. diff --git a/lib/wx/src/wx.appup.src b/lib/wx/src/wx.appup.src index 1102af612e..311c0c0f52 100644 --- a/lib/wx/src/wx.appup.src +++ b/lib/wx/src/wx.appup.src @@ -1,8 +1,7 @@ -%% This is an -*- erlang -*- file. -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. 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 @@ -16,8 +15,7 @@ %% under the License. %% %% %CopyrightEnd% - {"%VSN%", - [ ], - [ ] + [{<<".*">>,[{restart_application, wx}]}], + [{<<".*">>,[{restart_application, wx}]}] }. diff --git a/lib/xmerl/src/xmerl.appup.src b/lib/xmerl/src/xmerl.appup.src index 0d8aa4eb04..0a84966576 100644 --- a/lib/xmerl/src/xmerl.appup.src +++ b/lib/xmerl/src/xmerl.appup.src @@ -1,14 +1,21 @@ +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2014. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% {"%VSN%", - [ - {"1.1.11", - [ - ] - } - ], - [ - {"1.1.11", - [ - ] - } - ] + [{<<".*">>,[{restart_application, xmerl}]}], + [{<<".*">>,[{restart_application, xmerl}]}] }. -- cgit v1.2.3 From e13698de39397b8adf774467ff4c9c9b8e22bd3a Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Tue, 18 Feb 2014 12:31:52 +0100 Subject: Introduce appup test utility This adds a test function similar to the app file test function existing in test_server. The code is mostly taken from the asn1, snmp and inets test suites. Low-level upgrade instruction checking is stripped. Library application's appup files get specialized treatment, since their content is almost static. --- lib/test_server/doc/src/test_server.xml | 25 ++++ lib/test_server/src/test_server.erl | 9 +- lib/test_server/src/test_server_sup.erl | 246 +++++++++++++++++++++++++++++++- 3 files changed, 276 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/test_server/doc/src/test_server.xml b/lib/test_server/doc/src/test_server.xml index 4a47a8f45c..ed5569e1fe 100644 --- a/lib/test_server/doc/src/test_server.xml +++ b/lib/test_server/doc/src/test_server.xml @@ -624,6 +624,31 @@ Only valid for peer nodes. Note that slave nodes always + + appup_test(App) -> ok | test_server:fail() + Checks an applications .appup file for obvious errors + + App = term() + The name of the application to test + + +

Checks an applications .appup file for obvious errors. + The following is checked: +

+ + syntax + + that .app file version and .appup file version match + + for non-library applications: validity of high-level upgrade + instructions, specifying no instructions is explicitly allowed + (in this case the application is not upgradeable) + for library applications: that there is exactly one wildcard + regexp clause restarting the application when upgrading or + downgrading from any version + +
+
comment(Comment) -> ok Print a comment on the HTML result page diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index d367e7b5d6..82672521f7 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -40,7 +40,7 @@ -export([call_crash/3,call_crash/4,call_crash/5]). -export([temp_name/1]). -export([start_node/3, stop_node/1, wait_for_node/1, is_release_available/1]). --export([app_test/1, app_test/2]). +-export([app_test/1, app_test/2, appup_test/1]). -export([is_native/1]). -export([comment/1, make_priv_dir/0]). -export([os_type/0]). @@ -2448,8 +2448,11 @@ app_test(App) -> app_test(App, Mode) -> test_server_sup:app_test(App, Mode). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% appup_test/1 +%% +appup_test(App) -> + test_server_sup:appup_test(App). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% is_native(Mod) -> true | false diff --git a/lib/test_server/src/test_server_sup.erl b/lib/test_server/src/test_server_sup.erl index 70ead42b1b..3cfa84a52f 100644 --- a/lib/test_server/src/test_server_sup.erl +++ b/lib/test_server/src/test_server_sup.erl @@ -30,7 +30,8 @@ framework_call/2,framework_call/3,framework_call/4, format_loc/1, util_start/0, util_stop/0, unique_name/0, - call_trace/1]). + call_trace/1, + appup_test/1]). -include("test_server_internal.hrl"). -define(crash_dump_tar,"crash_dumps.tar.gz"). -define(src_listing_ext, ".src.html"). @@ -265,6 +266,249 @@ app_check_export_all([Mod|Mods]) -> end end. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% appup_test/1 +%% +%% Checks one applications .appup file for obvious errors. +%% Checks.. +%% * .. syntax +%% * .. that version in app file matches appup file version +%% * .. validity of appup instructions +%% +%% For library application this function checks that the proper +%% 'restart_application' upgrade and downgrade clauses exist. +appup_test(Application) -> + case is_app(Application) of + {ok, AppFile} -> + case is_appup(Application, proplists:get_value(vsn, AppFile)) of + {ok, Up, Down} -> + StartMod = proplists:get_value(mod, AppFile), + Modules = proplists:get_value(modules, AppFile), + do_appup_tests(StartMod, Application, Up, Down, Modules); + Error -> + test_server:fail(Error) + end; + Error -> + test_server:fail(Error) + end. + +is_appup(Application, Version) -> + AppupFile = atom_to_list(Application) ++ ".appup", + AppupPath = filename:join([code:lib_dir(Application), "ebin", AppupFile]), + case file:consult(AppupPath) of + {ok, [{Version, Up, Down}]} when is_list(Up), is_list(Down) -> + {ok, Up, Down}; + _ -> + test_server:format( + minor, + "Application upgrade (.appup) file not found, " + "or it has very bad syntax.~n"), + {error, appup_not_readable} + end. + +do_appup_tests(undefined, Application, Up, Down, _Modules) -> + %% library application + case Up of + [{<<".*">>, [{restart_application, Application}]}] -> + case Down of + [{<<".*">>, [{restart_application, Application}]}] -> + ok; + _ -> + test_server:format( + minor, + "Library application needs restart_application " + "downgrade instruction.~n"), + {error, library_downgrade_instruction_malformed} + end; + _ -> + test_server:format( + minor, + "Library application needs restart_application " + "upgrade instruction.~n"), + {error, library_upgrade_instruction_malformed} + end; +do_appup_tests(_, _Application, Up, Down, Modules) -> + %% normal application + case check_appup_clauses_plausible(Up, up, Modules) of + ok -> + case check_appup_clauses_plausible(Down, down, Modules) of + ok -> + test_server:format(minor, "OK~n"); + Error -> + test_server:format(minor, "ERROR ~p~n", [Error]), + test_server:fail(Error) + end; + Error -> + test_server:format(minor, "ERROR ~p~n", [Error]), + test_server:fail(Error) + end. + +check_appup_clauses_plausible([], _Direction, _Modules) -> + ok; +check_appup_clauses_plausible([{Re, Instrs} | Rest], Direction, Modules) + when is_binary(Re) -> + case re:compile(Re) of + {ok, _} -> + case check_appup_instructions(Instrs, Direction, Modules) of + ok -> + check_appup_clauses_plausible(Rest, Direction, Modules); + Error -> + Error + end; + {error, Error} -> + {error, {version_regex_malformed, Re, Error}} + end; +check_appup_clauses_plausible([{V, Instrs} | Rest], Direction, Modules) + when is_list(V) -> + case check_appup_instructions(Instrs, Direction, Modules) of + ok -> + check_appup_clauses_plausible(Rest, Direction, Modules); + Error -> + Error + end; +check_appup_clauses_plausible(Clause, _Direction, _Modules) -> + {error, {clause_malformed, Clause}}. + +check_appup_instructions(Instrs, Direction, Modules) -> + case check_instructions(Direction, Instrs, Instrs, [], [], Modules) of + {_Good, []} -> + ok; + {_, Bad} -> + {error, {bad_instructions, Bad}} + end. + +check_instructions(_, [], _, Good, Bad, _) -> + {lists:reverse(Good), lists:reverse(Bad)}; +check_instructions(UpDown, [Instr | Rest], All, Good, Bad, Modules) -> + case catch check_instruction(UpDown, Instr, All, Modules) of + ok -> + check_instructions(UpDown, Rest, All, [Instr | Good], Bad, Modules); + {error, Reason} -> + NewBad = [{Instr, Reason} | Bad], + check_instructions(UpDown, Rest, All, Good, NewBad, Modules) + end. + +check_instruction(up, {add_module, Module}, _, Modules) -> + %% A new module is added + check_module(Module, Modules); +check_instruction(down, {add_module, Module}, _, Modules) -> + %% An old module is re-added + case (catch check_module(Module, Modules)) of + {error, {unknown_module, Module, Modules}} -> ok; + ok -> throw({error, {existing_readded_module, Module}}) + end; +check_instruction(_, {load_module, Module}, _, Modules) -> + check_module(Module, Modules); +check_instruction(_, {load_module, Module, DepMods}, _, Modules) -> + check_module(Module, Modules), + check_depend(DepMods); +check_instruction(_, {load_module, Module, Pre, Post, DepMods}, _, Modules) -> + check_module(Module, Modules), + check_depend(DepMods), + check_purge(Pre), + check_purge(Post); +check_instruction(up, {delete_module, Module}, _, Modules) -> + case (catch check_module(Module, Modules)) of + {error, {unknown_module, Module, Modules}} -> + ok; + ok -> + throw({error,{existing_module_deleted, Module}}) + end; +check_instruction(down, {delete_module, Module}, _, Modules) -> + check_module(Module, Modules); +check_instruction(_, {update, Module}, _, Modules) -> + check_module(Module, Modules); +check_instruction(_, {update, Module, supervisor}, _, Modules) -> + check_module(Module, Modules); +check_instruction(_, {update, Module, DepMods}, _, Modules) + when is_list(DepMods) -> + check_module(Module, Modules); +check_instruction(_, {update, Module, Change}, _, Modules) -> + check_module(Module, Modules), + check_change(Change); +check_instruction(_, {update, Module, Change, DepMods}, _, Modules) -> + check_module(Module, Modules), + check_change(Change), + check_depend(DepMods); +check_instruction(_, {update, Module, Change, Pre, Post, DepMods}, _, Modules) -> + check_module(Module, Modules), + check_change(Change), + check_purge(Pre), + check_purge(Post), + check_depend(DepMods); +check_instruction(_, + {update, Module, Timeout, Change, Pre, Post, DepMods}, + _, + Modules) -> + check_module(Module, Modules), + check_timeout(Timeout), + check_change(Change), + check_purge(Pre), + check_purge(Post), + check_depend(DepMods); +check_instruction(_, + {update, Module, ModType, Timeout, Change, Pre, Post, DepMods}, + _, + Modules) -> + check_module(Module, Modules), + check_mod_type(ModType), + check_timeout(Timeout), + check_change(Change), + check_purge(Pre), + check_purge(Post), + check_depend(DepMods); +check_instruction(_, {restart_application, Application}, _, _) -> + check_application(Application); +check_instruction(_, {remove_application, Application}, _, _) -> + check_application(Application); +check_instruction(_, {add_application, Application}, _, _) -> + check_application(Application); +check_instruction(_, {add_application, Application, Type}, _, _) -> + check_application(Application), + check_restart_type(Type); +check_instruction(_, Instr, _, _) -> + throw({error, {low_level_or_invalid_instruction, Instr}}). + +check_module(Module, Modules) when is_atom(Module) -> + case {is_atom(Module), lists:member(Module, Modules)} of + {true, true} -> ok; + {true, false} -> throw({error, {unknown_module, Module}}); + {false, _} -> throw({error, {bad_module, Module}}) + end. + +check_application(App) -> + case is_atom(App) of + true -> ok; + false -> throw({error, {bad_application, App}}) + end. + +check_depend(Dep) when is_list(Dep) -> ok; +check_depend(Dep) -> throw({error, {bad_depend, Dep}}). + +check_restart_type(permanent) -> ok; +check_restart_type(transient) -> ok; +check_restart_type(temporary) -> ok; +check_restart_type(load) -> ok; +check_restart_type(none) -> ok; +check_restart_type(Type) -> throw({error, {bad_restart_type, Type}}). + +check_timeout(T) when is_integer(T), T > 0 -> ok; +check_timeout(default) -> ok; +check_timeout(infinity) -> ok; +check_timeout(T) -> throw({error, {bad_timeout, T}}). + +check_mod_type(static) -> ok; +check_mod_type(dynamic) -> ok; +check_mod_type(Type) -> throw({error, {bad_mod_type, Type}}). + +check_purge(soft_purge) -> ok; +check_purge(brutal_purge) -> ok; +check_purge(Purge) -> throw({error, {bad_purge, Purge}}). + +check_change(soft) -> ok; +check_change({advanced, _}) -> ok; +check_change(Change) -> throw({error, {bad_change, Change}}). + %% Given two sorted lists, L1 and L2, returns {NotInL2, NotInL1}, %% NotInL2 is the elements of L1 which don't occurr in L2, %% NotInL1 is the elements of L2 which don't ocurr in L1. -- cgit v1.2.3 From 841addf5d64a3b4775cd1d0a5aa4bf04ec4ef95e Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Tue, 18 Feb 2014 12:33:31 +0100 Subject: Add test suites performing app and appup file checks Add the mentioned test suites for *all* library and touched non-library applications. --- lib/asn1/test/asn1_appup_test.erl | 359 +----------------- lib/compiler/test/compile_SUITE.erl | 8 +- lib/crypto/test/crypto_SUITE.erl | 6 + lib/debugger/test/debugger_SUITE.erl | 7 +- lib/dialyzer/test/dialyzer_SUITE.erl | 8 +- lib/edoc/test/edoc_SUITE.erl | 11 +- lib/eldap/test/eldap_basic_SUITE.erl | 7 +- lib/erl_docgen/test/Makefile | 65 ++++ lib/erl_docgen/test/erl_docgen.spec | 1 + lib/erl_docgen/test/erl_docgen_SUITE.erl | 50 +++ lib/et/test/Makefile | 1 + lib/et/test/et_SUITE.erl | 50 +++ lib/eunit/src/eunit.app.src | 1 + lib/eunit/test/eunit_SUITE.erl | 10 +- lib/gs/test/Makefile | 65 ++++ lib/gs/test/gs.spec | 1 + lib/gs/test/gs_SUITE.erl | 50 +++ lib/hipe/test/Makefile | 65 ++++ lib/hipe/test/hipe.spec | 1 + lib/hipe/test/hipe_SUITE.erl | 50 +++ lib/inets/test/inets_appup_test.erl | 298 +-------------- lib/mnesia/test/mnesia_SUITE.erl | 15 +- lib/observer/test/observer_SUITE.erl | 8 +- lib/odbc/test/odbc_start_SUITE.erl | 12 +- lib/os_mon/test/os_mon_SUITE.erl | 9 +- lib/otp_mibs/test/otp_mibs_SUITE.erl | 15 +- lib/parsetools/test/Makefile | 1 + lib/parsetools/test/app_SUITE.erl | 50 +++ lib/percept/test/percept_SUITE.erl | 12 +- lib/public_key/test/public_key_SUITE.erl | 9 +- lib/reltool/test/reltool_app_SUITE.erl | 9 +- lib/runtime_tools/test/runtime_tools_SUITE.erl | 6 +- lib/snmp/test/snmp_appup_test.erl | 491 +------------------------ lib/ssh/test/ssh_basic_SUITE.erl | 6 + lib/ssl/test/ssl_basic_SUITE.erl | 6 + lib/syntax_tools/test/syntax_tools_SUITE.erl | 9 +- lib/tools/test/tools_SUITE.erl | 8 +- lib/typer/test/Makefile | 65 ++++ lib/typer/test/typer.spec | 1 + lib/typer/test/typer_SUITE.erl | 50 +++ lib/webtool/src/Makefile | 2 +- lib/webtool/test/Makefile | 65 ++++ lib/webtool/test/webtool.spec | 1 + lib/webtool/test/webtool_SUITE.erl | 50 +++ lib/wx/test/wx_app_SUITE.erl | 9 +- lib/xmerl/test/xmerl_appup_test.erl | 339 +---------------- 46 files changed, 860 insertions(+), 1502 deletions(-) create mode 100644 lib/erl_docgen/test/Makefile create mode 100644 lib/erl_docgen/test/erl_docgen.spec create mode 100644 lib/erl_docgen/test/erl_docgen_SUITE.erl create mode 100644 lib/et/test/et_SUITE.erl create mode 100644 lib/gs/test/Makefile create mode 100644 lib/gs/test/gs.spec create mode 100644 lib/gs/test/gs_SUITE.erl create mode 100644 lib/hipe/test/Makefile create mode 100644 lib/hipe/test/hipe.spec create mode 100644 lib/hipe/test/hipe_SUITE.erl create mode 100644 lib/parsetools/test/app_SUITE.erl create mode 100644 lib/typer/test/Makefile create mode 100644 lib/typer/test/typer.spec create mode 100644 lib/typer/test/typer_SUITE.erl create mode 100644 lib/webtool/test/Makefile create mode 100644 lib/webtool/test/webtool.spec create mode 100644 lib/webtool/test/webtool_SUITE.erl (limited to 'lib') diff --git a/lib/asn1/test/asn1_appup_test.erl b/lib/asn1/test/asn1_appup_test.erl index a2c1423eda..7391959645 100644 --- a/lib/asn1/test/asn1_appup_test.erl +++ b/lib/asn1/test/asn1_appup_test.erl @@ -21,8 +21,8 @@ %% Purpose: Verify the application specifics of the asn1 application %%---------------------------------------------------------------------- -module(asn1_appup_test). --compile({no_auto_import,[error/1]}). -compile(export_all). +-include_lib("common_test/include/ct.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -44,16 +44,9 @@ end_per_group(_GroupName, Config) -> init_per_suite(suite) -> []; init_per_suite(doc) -> []; init_per_suite(Config) when is_list(Config) -> - AppFile = file_name(asn1, ".app"), - AppupFile = file_name(asn1, ".appup"), - [{app_file, AppFile}, {appup_file, AppupFile}|Config]. + Config. -file_name(App, Ext) -> - LibDir = code:lib_dir(App), - filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). - - end_per_suite(suite) -> []; end_per_suite(doc) -> []; end_per_suite(Config) when is_list(Config) -> @@ -62,349 +55,7 @@ end_per_suite(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup(suite) -> - []; -appup(doc) -> - "perform a simple check of the appup file"; +appup() -> + [{doc, "perform a simple check of the asn1 appup file"}]. appup(Config) when is_list(Config) -> - AppupFile = key1search(appup_file, Config), - AppFile = key1search(app_file, Config), - Modules = modules(AppFile), - check_appup(AppupFile, Modules). - -modules(File) -> - case file:consult(File) of - {ok, [{application,asn1,Info}]} -> - case lists:keysearch(modules,1,Info) of - {value, {modules, Modules}} -> - Modules; - false -> - fail({bad_appinfo, Info}) - end; - Error -> - fail({bad_appfile, Error}) - end. - - -check_appup(AppupFile, Modules) -> - case file:consult(AppupFile) of - {ok, [{V, UpFrom, DownTo}]} -> - io:format("V= ~p, UpFrom= ~p, DownTo= ~p, Modules= ~p~n", - [V, UpFrom, DownTo, Modules]), - check_appup(V, UpFrom, DownTo, Modules); - Else -> - fail({bad_appupfile, Else}) - end. - - -check_appup(V, UpFrom, DownTo, Modules) -> - check_version(V), - check_depends(up, UpFrom, Modules), - check_depends(down, DownTo, Modules), - ok. - - -check_depends(_, [], _) -> - ok; -check_depends(UpDown, [Dep|Deps], Modules) -> - check_depend(UpDown, Dep, Modules), - check_depends(UpDown, Deps, Modules). - - -check_depend(up,I={add_application,_App},Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [up,I , Modules]), - ok; -check_depend(down,I={remove_application,_App},Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [down,I , Modules]), - ok; -check_depend(UpDown, {V, Instructions}, Modules) -> - d("check_instructions(~w) -> entry with" - "~n V: ~p" - "~n Modules: ~p", [UpDown, V, Modules]), - check_version(V), - case check_instructions(UpDown, - Instructions, Instructions, [], [], Modules) of - {_Good, []} -> - ok; - {_, Bad} -> - fail({bad_instructions, Bad, UpDown}) - end. - - -check_instructions(_, [], _, Good, Bad, _) -> - {lists:reverse(Good), lists:reverse(Bad)}; -check_instructions(UpDown, [Instr|Instrs], AllInstr, Good, Bad, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instr: ~p", [UpDown,Instr]), - case (catch check_instruction(UpDown, Instr, AllInstr, Modules)) of - ok -> - check_instructions(UpDown, Instrs, AllInstr, - [Instr|Good], Bad, Modules); - {error, Reason} -> - d("check_instructions(~w) -> bad instruction: " - "~n Reason: ~p", [UpDown,Reason]), - check_instructions(UpDown, Instrs, AllInstr, Good, - [{Instr, Reason}|Bad], Modules) - end. - -%% A new module is added -check_instruction(up, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when up-add_module instruction with" - "~n Module: ~p", [Module]), - check_module(Module, Modules); - -%% An old module is re-added -check_instruction(down, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when down-add_module instruction with" - "~n Module: ~p", [Module]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - error({existing_readded_module, Module}) - end; - -%% Removing a module on upgrade: -%% - the module has been removed from the app-file. -%% - check that no module depends on this (removed) module -check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - d("check_instruction -> entry when up-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - check_purge(Pre), - check_purge(Post); - ok -> - error({existing_removed_module, Module}) - end; - -%% Removing a module on downgrade: the module exist -%% in the app-file. -check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - d("check_instruction -> entry when down-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - ok -> - check_purge(Pre), - check_purge(Post), - check_no_remove_depends(Module, AllInstr); - {error, {unknown_module, Module, Modules}} -> - error({nonexisting_removed_module, Module}) - end; - -check_instruction(_, {load_module, Module, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - d("check_instruction -> entry when load_module instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {update, Module, Change, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - d("check_instruction -> entry when update instruction with" - "~n Module: ~p" - "~n Change: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Change, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_change(Change), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {apply, {Module, Function, Args}}, - _AllInstr, Modules) - when is_atom(Module), is_atom(Function), is_list(Args) -> - d("check_instruction -> entry when apply instruction with" - "~n Module: ~p" - "~n Function: ~p" - "~n Args: ~p", [Module, Function, Args]), - check_module(Module, Modules), - check_apply(Module,Function,Args); - -check_instruction(_, Instr, _AllInstr, _Modules) -> - d("check_instruction -> entry when unknown instruction with" - "~n Instr: ~p", [Instr]), - error({error, {unknown_instruction, Instr}}). - - -%% If Module X depends on Module Y, then module Y must have an update -%% instruction of some sort (otherwise the depend is faulty). -updated_modules([], Modules) -> - d("update_modules -> entry when done with" - "~n Modules: ~p", [Modules]), - Modules; -updated_modules([Instr|Instrs], Modules) -> - d("update_modules -> entry with" - "~n Instr: ~p" - "~n Modules: ~p", [Instr,Modules]), - Module = instruction_module(Instr), - d("update_modules -> Module: ~p", [Module]), - updated_modules(Instrs, [Module|Modules]). - -instruction_module({add_module, Module}) -> - Module; -instruction_module({remove, {Module, _, _}}) -> - Module; -instruction_module({load_module, Module, _, _, _}) -> - Module; -instruction_module({update, Module, _, _, _, _}) -> - Module; -instruction_module({apply, {Module, _, _}}) -> - Module; -instruction_module(Instr) -> - d("instruction_module -> entry when unknown instruction with" - "~n Instr: ~p", [Instr]), - error({error, {unknown_instruction, Instr}}). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_version(V) when is_list(V) -> - ok; -check_version(V) -> - error({bad_version, V}). - - -check_module(M, Modules) when is_atom(M) -> - case lists:member(M,Modules) of - true -> - ok; - false -> - error({unknown_module, M, Modules}) - end; -check_module(M, _) -> - error({bad_module, M}). - -check_apply(Module,Function,Args) -> - case (catch Module:module_info()) of - Info when is_list(Info) -> - check_exported(Function,Args,Info); - {'EXIT',{undef,_}} -> - error({not_existing_module,Module}) - end. - -check_exported(Function,Args,Info) -> - case lists:keysearch(exports,1,Info) of - {value,{exports,FunList}} -> - case lists:keysearch(Function,1,FunList) of - {value,{_,Arity}} when Arity==length(Args) -> - ok; - _ -> - error({not_exported_function,Function,length(Args)}) - end; - _ -> - error({bad_export,Info}) - end. - -check_module_depend(M, [], _) when is_atom(M) -> - d("check_module_depend -> entry with" - "~n M: ~p", [M]), - ok; -check_module_depend(M, Deps, Modules) when is_atom(M), is_list(Deps) -> - d("check_module_depend -> entry with" - "~n M: ~p" - "~n Deps: ~p" - "~n Modules: ~p", [M, Deps, Modules]), - case [Dep || Dep <- Deps, lists:member(Dep, Modules) == false] of - [] -> - ok; - Unknown -> - error({unknown_depend_modules, Unknown}) - end; -check_module_depend(_M, D, _Modules) -> - d("check_module_depend -> entry when bad depend with" - "~n D: ~p", [D]), - error({bad_depend, D}). - - -check_no_remove_depends(_Module, []) -> - ok; -check_no_remove_depends(Module, [Instr|Instrs]) -> - check_no_remove_depend(Module, Instr), - check_no_remove_depends(Module, Instrs). - -check_no_remove_depend(Module, {load_module, Mod, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, load_module, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(Module, {update, Mod, _Change, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, update, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(_, _) -> - ok. - - -check_change(soft) -> - ok; -check_change({advanced, _Something}) -> - ok; -check_change(Change) -> - error({bad_change, Change}). - - -check_purge(soft_purge) -> - ok; -check_purge(brutal_purge) -> - ok; -check_purge(Purge) -> - error({bad_purge, Purge}). - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -error(Reason) -> - throw({error, Reason}). - -fail(Reason) -> - exit({suite_failed, Reason}). - -key1search(Key, L) -> - case lists:keysearch(Key, 1, L) of - undefined -> - fail({not_found, Key, L}); - {value, {Key, Value}} -> - Value - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -d(F, A) -> - d(false, F, A). - -d(true, F, A) -> - io:format(F ++ "~n", A); -d(_, _, _) -> - ok. - - + ok = ?t:appup_test(asn1). diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl index 34c4b1e264..8cb7d1b55b 100644 --- a/lib/compiler/test/compile_SUITE.erl +++ b/lib/compiler/test/compile_SUITE.erl @@ -24,7 +24,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, - app_test/1, + app_test/1,appup_test/1, file_1/1, forms_2/1, module_mismatch/1, big_file/1, outdir/1, binary/1, makedep/1, cond_and_ifdef/1, listings/1, listings_big/1, other_output/1, encrypted_abstr/1, @@ -42,7 +42,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> test_lib:recompile(?MODULE), - [app_test, file_1, forms_2, module_mismatch, big_file, outdir, + [app_test, appup_test, file_1, forms_2, module_mismatch, big_file, outdir, binary, makedep, cond_and_ifdef, listings, listings_big, other_output, encrypted_abstr, {group, bad_record_use}, strict_record, @@ -71,6 +71,10 @@ end_per_group(_GroupName, Config) -> app_test(Config) when is_list(Config) -> ?line ?t:app_test(compiler). +%% Test that the Application upgrade file has no `basic' errors."; +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(compiler). + %% Tests that we can compile and run a simple Erlang program, %% using compile:file/1. diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index d1be7cea68..8efd962283 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -30,6 +30,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [app, + appup, {group, md4}, {group, md5}, {group, ripemd160}, @@ -142,6 +143,11 @@ app() -> app(Config) when is_list(Config) -> ok = ?t:app_test(crypto). %%-------------------------------------------------------------------- +appup() -> + [{doc, "Test that the crypto appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(crypto). +%%-------------------------------------------------------------------- hash() -> [{doc, "Test all different hash functions"}]. hash(Config) when is_list(Config) -> diff --git a/lib/debugger/test/debugger_SUITE.erl b/lib/debugger/test/debugger_SUITE.erl index 6f5442e97d..c74550be86 100644 --- a/lib/debugger/test/debugger_SUITE.erl +++ b/lib/debugger/test/debugger_SUITE.erl @@ -27,13 +27,13 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - app_test/1,erts_debug/1,encrypted_debug_info/1, + app_test/1,appup_test/1,erts_debug/1,encrypted_debug_info/1, no_abstract_code/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test, erts_debug, no_abstract_code, + [app_test, appup_test, erts_debug, no_abstract_code, encrypted_debug_info]. groups() -> @@ -64,6 +64,9 @@ app_test(Config) when is_list(Config) -> ?line ?t:app_test(debugger), ok. +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(debugger). + erts_debug(Config) when is_list(Config) -> c:l(erts_debug), ok. diff --git a/lib/dialyzer/test/dialyzer_SUITE.erl b/lib/dialyzer/test/dialyzer_SUITE.erl index 63214c915d..1b62291a00 100644 --- a/lib/dialyzer/test/dialyzer_SUITE.erl +++ b/lib/dialyzer/test/dialyzer_SUITE.erl @@ -30,12 +30,12 @@ -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. --export([app_test/1]). +-export([app_test/1, appup_test/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test]. + [app_test, appup_test]. groups() -> []. @@ -71,3 +71,7 @@ app_test(suite) -> []; app_test(Config) when is_list(Config) -> ?line ?t:app_test(dialyzer). + +%% Test that the .appup file does not contain any `basic' errors +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(dialyzer). diff --git a/lib/edoc/test/edoc_SUITE.erl b/lib/edoc/test/edoc_SUITE.erl index b649971e99..c9c7811afb 100644 --- a/lib/edoc/test/edoc_SUITE.erl +++ b/lib/edoc/test/edoc_SUITE.erl @@ -22,12 +22,12 @@ init_per_group/2,end_per_group/2]). %% Test cases --export([build_std/1,build_map_module/1]). +-export([app/1,appup/1,build_std/1,build_map_module/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [build_std,build_map_module]. + [app,appup,build_std,build_map_module]. groups() -> []. @@ -44,6 +44,13 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +%% Test that the .app file does not contain any `basic' errors +app(Config) when is_list(Config) -> + ok = ?t:app_test(edoc). + +%% Test that the .appup file does not contain any `basic' errors +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(edoc). build_std(suite) -> []; build_std(doc) -> ["Build some documentation using standard EDoc layout"]; diff --git a/lib/eldap/test/eldap_basic_SUITE.erl b/lib/eldap/test/eldap_basic_SUITE.erl index bf5fa83c3c..6c3d303da0 100644 --- a/lib/eldap/test/eldap_basic_SUITE.erl +++ b/lib/eldap/test/eldap_basic_SUITE.erl @@ -84,6 +84,7 @@ end_per_testcase(_TestCase, Config) -> all() -> [app, + appup, api, ssl_api, start_tls, @@ -95,7 +96,11 @@ all() -> app(doc) -> "Test that the eldap app file is ok"; app(suite) -> []; app(Config) when is_list(Config) -> - ok = test_server:app_test(public_key). + ok = test_server:app_test(eldap). + +%% Test that the eldap appup file is ok +appup(Config) when is_list(Config) -> + ok = test_server:appup_test(eldap). api(doc) -> "Basic test that all api functions works as expected"; api(suite) -> []; diff --git a/lib/erl_docgen/test/Makefile b/lib/erl_docgen/test/Makefile new file mode 100644 index 0000000000..9f4cc04105 --- /dev/null +++ b/lib/erl_docgen/test/Makefile @@ -0,0 +1,65 @@ +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + erl_docgen_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/erl_docgen_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \ + > $(EMAKEFILE) + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \ + >> $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) $(GEN_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" + $(INSTALL_DATA) erl_docgen.spec "$(RELSYSDIR)" + chmod -R u+w "$(RELSYSDIR)" + +release_docs_spec: diff --git a/lib/erl_docgen/test/erl_docgen.spec b/lib/erl_docgen/test/erl_docgen.spec new file mode 100644 index 0000000000..98833614df --- /dev/null +++ b/lib/erl_docgen/test/erl_docgen.spec @@ -0,0 +1 @@ +{suites,"../erl_docgen_test",all}. diff --git a/lib/erl_docgen/test/erl_docgen_SUITE.erl b/lib/erl_docgen/test/erl_docgen_SUITE.erl new file mode 100644 index 0000000000..20fbc1229b --- /dev/null +++ b/lib/erl_docgen/test/erl_docgen_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(erl_docgen_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the erl_docgen app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(erl_docgen). + +appup() -> + [{doc, "Test that the erl_docgen appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(erl_docgen). diff --git a/lib/et/test/Makefile b/lib/et/test/Makefile index 3817079b5f..1be5aac3fd 100644 --- a/lib/et/test/Makefile +++ b/lib/et/test/Makefile @@ -25,6 +25,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES= \ ett \ + et_SUITE \ et_wx_SUITE \ et_test_lib diff --git a/lib/et/test/et_SUITE.erl b/lib/et/test/et_SUITE.erl new file mode 100644 index 0000000000..e0bce41e15 --- /dev/null +++ b/lib/et/test/et_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(et_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the et app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(et). + +appup() -> + [{doc, "Test that the et appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(et). diff --git a/lib/eunit/src/eunit.app.src b/lib/eunit/src/eunit.app.src index 431abac98b..5e16dfa2ce 100644 --- a/lib/eunit/src/eunit.app.src +++ b/lib/eunit/src/eunit.app.src @@ -14,6 +14,7 @@ eunit_striptests, eunit_surefire, eunit_test, + eunit_tests, eunit_tty]}, {registered,[]}, {applications, [kernel,stdlib]}, diff --git a/lib/eunit/test/eunit_SUITE.erl b/lib/eunit/test/eunit_SUITE.erl index 47c2435d63..d13dc73923 100644 --- a/lib/eunit/test/eunit_SUITE.erl +++ b/lib/eunit/test/eunit_SUITE.erl @@ -19,14 +19,15 @@ -module(eunit_SUITE). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,eunit_test/1]). + init_per_group/2,end_per_group/2, + app_test/1,appup_test/1,eunit_test/1]). -include_lib("common_test/include/ct.hrl"). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [eunit_test]. + [app_test, appup_test, eunit_test]. groups() -> []. @@ -43,6 +44,11 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +app_test(Config) when is_list(Config) -> + ok = ?t:app_test(eunit). + +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(eunit). eunit_test(Config) when is_list(Config) -> ok = file:set_cwd(code:lib_dir(eunit)), diff --git a/lib/gs/test/Makefile b/lib/gs/test/Makefile new file mode 100644 index 0000000000..493770745f --- /dev/null +++ b/lib/gs/test/Makefile @@ -0,0 +1,65 @@ +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + gs_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/gs_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \ + > $(EMAKEFILE) + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \ + >> $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) $(GEN_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" + $(INSTALL_DATA) gs.spec "$(RELSYSDIR)" + chmod -R u+w "$(RELSYSDIR)" + +release_docs_spec: diff --git a/lib/gs/test/gs.spec b/lib/gs/test/gs.spec new file mode 100644 index 0000000000..46e6b2061e --- /dev/null +++ b/lib/gs/test/gs.spec @@ -0,0 +1 @@ +{suites,"../gs_test",all}. diff --git a/lib/gs/test/gs_SUITE.erl b/lib/gs/test/gs_SUITE.erl new file mode 100644 index 0000000000..01ce90df0b --- /dev/null +++ b/lib/gs/test/gs_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(gs_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the gs app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(gs, tolerant). + +appup() -> + [{doc, "Test that the gs appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(gs). diff --git a/lib/hipe/test/Makefile b/lib/hipe/test/Makefile new file mode 100644 index 0000000000..19fa227912 --- /dev/null +++ b/lib/hipe/test/Makefile @@ -0,0 +1,65 @@ +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + hipe_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/hipe_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \ + > $(EMAKEFILE) + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \ + >> $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) $(GEN_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" + $(INSTALL_DATA) hipe.spec "$(RELSYSDIR)" + chmod -R u+w "$(RELSYSDIR)" + +release_docs_spec: diff --git a/lib/hipe/test/hipe.spec b/lib/hipe/test/hipe.spec new file mode 100644 index 0000000000..6b0b226dc3 --- /dev/null +++ b/lib/hipe/test/hipe.spec @@ -0,0 +1 @@ +{suites,"../hipe_test",all}. diff --git a/lib/hipe/test/hipe_SUITE.erl b/lib/hipe/test/hipe_SUITE.erl new file mode 100644 index 0000000000..3beff95e90 --- /dev/null +++ b/lib/hipe/test/hipe_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(hipe_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the hipe app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(hipe, tolerant). + +appup() -> + [{doc, "Test that the hipe appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(hipe). diff --git a/lib/inets/test/inets_appup_test.erl b/lib/inets/test/inets_appup_test.erl index d563b52ae7..a8051c6c85 100644 --- a/lib/inets/test/inets_appup_test.erl +++ b/lib/inets/test/inets_appup_test.erl @@ -23,13 +23,7 @@ -module(inets_appup_test). -compile(export_all). --compile({no_auto_import,[error/1]}). - --include("inets_test_lib.hrl"). - - - % t() -> megaco_test_lib:t(?MODULE). - % t(Case) -> megaco_test_lib:t({?MODULE, Case}). +-include_lib("common_test/include/ct.hrl"). %% Test server callbacks @@ -59,16 +53,9 @@ end_per_group(_GroupName, Config) -> init_per_suite(suite) -> []; init_per_suite(doc) -> []; init_per_suite(Config) when is_list(Config) -> - AppFile = file_name(inets, ".app"), - AppupFile = file_name(inets, ".appup"), - [{app_file, AppFile}, {appup_file, AppupFile}|Config]. + Config. -file_name(App, Ext) -> - LibDir = code:lib_dir(App), - filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). - - end_per_suite(suite) -> []; end_per_suite(doc) -> []; end_per_suite(Config) when is_list(Config) -> @@ -77,282 +64,7 @@ end_per_suite(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup(suite) -> - []; -appup(doc) -> - "perform a simple check of the appup file"; +appup() -> + [{doc, "Perform a simple check of the inets appup file"}]. appup(Config) when is_list(Config) -> - AppupFile = key1search(appup_file, Config), - AppFile = key1search(app_file, Config), - Modules = modules(AppFile), - check_appup(AppupFile, Modules). - -modules(File) -> - case file:consult(File) of - {ok, [{application,inets,Info}]} -> - case lists:keysearch(modules,1,Info) of - {value, {modules, Modules}} -> - Modules; - false -> - fail({bad_appinfo, Info}) - end; - Error -> - fail({bad_appfile, Error}) - end. - - -check_appup(AppupFile, Modules) -> - case file:consult(AppupFile) of - {ok, [{V, UpFrom, DownTo}]} -> -% io:format("~p => " -% "~n ~p" -% "~n ~p" -% "~n", [V, UpFrom, DownTo]), - check_appup(V, UpFrom, DownTo, Modules); - Else -> - fail({bad_appupfile, Else}) - end. - - -check_appup(V, UpFrom, DownTo, Modules) -> - check_version(V), - check_depends(up, UpFrom, Modules), - check_depends(down, DownTo, Modules), - ok. - - -check_depends(_, [], _) -> - ok; -check_depends(UpDown, [Dep|Deps], Modules) -> - check_depend(UpDown, Dep, Modules), - check_depends(UpDown, Deps, Modules). - - -check_depend(UpDown, {V, Instructions}, Modules) -> - check_version(V), - case check_instructions(UpDown, - Instructions, Instructions, [], [], Modules) of - {_Good, []} -> - ok; - {_, Bad} -> - fail({bad_instructions, Bad, UpDown}) - end. - - -check_instructions(_, [], _, Good, Bad, _) -> - {lists:reverse(Good), lists:reverse(Bad)}; -check_instructions(UpDown, [Instr|Instrs], AllInstr, Good, Bad, Modules) -> - case (catch check_instruction(UpDown, Instr, AllInstr, Modules)) of - ok -> - check_instructions(UpDown, Instrs, AllInstr, - [Instr|Good], Bad, Modules); - {error, Reason} -> - check_instructions(UpDown, Instrs, AllInstr, Good, - [{Instr, Reason}|Bad], Modules) - end; -check_instructions(UpDown, Instructions, _, _, _, _) -> - fail({bad_instructions, {UpDown, Instructions}}). - -%% A new module is added -check_instruction(up, {add_module, Module}, _, Modules) - when is_atom(Module) -> - check_module(Module, Modules); - -%% An old module is re-added -check_instruction(down, {add_module, Module}, _, Modules) - when is_atom(Module) -> - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - error({existing_readded_module, Module}) - end; - -%% Removing a module on upgrade: -%% - the module has been removed from the app-file. -%% - check that no module depends on this (removed) module -check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - check_purge(Pre), - check_purge(Post); - ok -> - error({existing_removed_module, Module}) - end; - -%% Removing a module on downgrade: the module exist -%% in the app-file. -check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - case (catch check_module(Module, Modules)) of - ok -> - check_purge(Pre), - check_purge(Post), - check_no_remove_depends(Module, AllInstr); - {error, {unknown_module, Module, Modules}} -> - error({nonexisting_removed_module, Module}) - end; - -check_instruction(up, {load_module, Module, Pre, Post, Depend}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_purge(Pre), - check_purge(Post); - -check_instruction(down, {load_module, Module, Pre, Post, Depend}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - check_module(Module, Modules), - % Can not be sure that the the dependent module exists in the new appfile - %%check_module_depend(Module, Depend, Modules), - check_purge(Pre), - check_purge(Post); - - - -check_instruction(up, {delete_module, Module}, _, Modules) - when is_atom(Module) -> - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - error({existing_module_deleted, Module}) - end; - -check_instruction(down, {delete_module, Module}, _, Modules) - when is_atom(Module) -> - check_module(Module, Modules); - - -check_instruction(_, {apply, {Module, Function, Args}}, _, _) when is_atom(Module), is_atom(Function), is_list(Args) -> - ok; - -check_instruction(_, {update, Module, supervisor}, _, Modules) when is_atom(Module) -> - check_module(Module, Modules); - -check_instruction(_, {update, Module, {advanced, _}, DepMods}, _, Modules) when is_atom(Module), is_list(DepMods) -> - check_module(Module, Modules), - check_module_depend(Module, DepMods, Modules); - -check_instruction(_, {update, Module, Change, Pre, Post, Depend}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_change(Change), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {restart_application, inets}, _AllInstr, _Modules) -> - ok; - -check_instruction(_, {update, Module, {advanced, _}}, _, Modules) -> - check_module(Module, Modules); - -check_instruction(_, Instr, _AllInstr, _Modules) -> - error({error, {unknown_instruction, Instr}}). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_version(V) when is_list(V) -> - ok; -check_version(REBin) when is_binary(REBin) -> - try - begin - RE = binary_to_list(REBin), - case re:compile(RE) of - {ok, _} -> - ok; - {error, _} -> - error({bad_version, REBin}) - end - end - catch - _T:_E -> - error({bad_version, REBin}) - end; -check_version(V) -> - error({bad_version, V}). - - -check_module(M, Modules) when is_atom(M) -> - case lists:member(M,Modules) of - true -> - ok; - false -> - error({unknown_module, M, Modules}) - end; -check_module(M, _) -> - error({bad_module, M}). - - -check_module_depend(M, [], _) when is_atom(M) -> - ok; -check_module_depend(M, Deps, Modules) when is_atom(M), is_list(Deps) -> - case [Dep || Dep <- Deps, lists:member(Dep, Modules) == false] of - [] -> - ok; - Unknown -> - error({unknown_depend_modules, Unknown}) - end; -check_module_depend(_M, D, _Modules) -> - error({bad_depend, D}). - - -check_no_remove_depends(_Module, []) -> - ok; -check_no_remove_depends(Module, [Instr|Instrs]) -> - check_no_remove_depend(Module, Instr), - check_no_remove_depends(Module, Instrs). - -check_no_remove_depend(Module, {load_module, Mod, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, load_module, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(Module, {update, Mod, _Change, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, update, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(_, _) -> - ok. - - -check_change(soft) -> - ok; -check_change({advanced, _Something}) -> - ok; -check_change(Change) -> - error({bad_change, Change}). - - -check_purge(soft_purge) -> - ok; -check_purge(brutal_purge) -> - ok; -check_purge(Purge) -> - error({bad_purge, Purge}). - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -error(Reason) -> - throw({error, Reason}). - -fail(Reason) -> - exit({suite_failed, Reason}). - -key1search(Key, L) -> - case lists:keysearch(Key, 1, L) of - undefined -> - fail({not_found, Key, L}); - {value, {Key, Value}} -> - Value - end. + ok = ?t:appup_test(inets). diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl index e0004ecb51..921ebb71e9 100644 --- a/lib/mnesia/test/mnesia_SUITE.erl +++ b/lib/mnesia/test/mnesia_SUITE.erl @@ -21,6 +21,7 @@ -module(mnesia_SUITE). -author('hakan@erix.ericsson.se'). -compile([export_all]). +-include_lib("common_test/include/ct.hrl"). -include("mnesia_test_lib.hrl"). init_per_testcase(Func, Conf) -> @@ -50,7 +51,7 @@ suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]}]. %% and do not involve the normal test machinery. all() -> - [{group, light}, {group, medium}, {group, heavy}, + [app, appup, {group, light}, {group, medium}, {group, heavy}, clean_up_suite]. groups() -> @@ -144,6 +145,18 @@ silly() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Test structure of the mnesia application resource file +app(Config) when is_list(Config) -> + ok = ?t:app_test(mnesia). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Test that all required versions have appup directives +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(mnesia). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where" "started during the tests"]; clean_up_suite(suite) -> diff --git a/lib/observer/test/observer_SUITE.erl b/lib/observer/test/observer_SUITE.erl index b6665cb70b..c076c5e81e 100644 --- a/lib/observer/test/observer_SUITE.erl +++ b/lib/observer/test/observer_SUITE.erl @@ -26,7 +26,7 @@ -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases --export([app_file/1]). +-export([app_file/1, appup_file/1]). %% Default timetrap timeout (set in init_per_testcase) -define(default_timeout, ?t:minutes(1)). @@ -43,7 +43,7 @@ end_per_testcase(_Case, Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_file]. + [app_file, appup_file]. groups() -> []. @@ -68,3 +68,7 @@ app_file(doc) -> app_file(Config) when is_list(Config) -> ?line ok = ?t:app_test(observer), ok. + +%% Testing .appup file +appup_file(Config) when is_list(Config) -> + ok = ?t:appup_test(observer). diff --git a/lib/odbc/test/odbc_start_SUITE.erl b/lib/odbc/test/odbc_start_SUITE.erl index e3a3440559..a7bb1d0ffe 100644 --- a/lib/odbc/test/odbc_start_SUITE.erl +++ b/lib/odbc/test/odbc_start_SUITE.erl @@ -109,8 +109,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> case odbc_test_lib:odbc_check() of - ok -> [start]; - Other -> {skip, Other} + ok -> [app, appup, start]; + Other -> [app, appup] end. groups() -> @@ -127,6 +127,14 @@ end_per_group(_GroupName, Config) -> %% Test cases starts here. %%-------------------------------------------------------------------- +%% Test that the odbc app file is ok +app(Config) when is_list(Config) -> + ok = ?t:app_test(odbc). + +%% Test that the odbc appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(odbc). + start(doc) -> ["Test start/stop of odbc"]; start(suite) -> diff --git a/lib/os_mon/test/os_mon_SUITE.erl b/lib/os_mon/test/os_mon_SUITE.erl index f074657d4c..08ad8436dd 100644 --- a/lib/os_mon/test/os_mon_SUITE.erl +++ b/lib/os_mon/test/os_mon_SUITE.erl @@ -25,7 +25,7 @@ -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases --export([app_file/1, config/1]). +-export([app_file/1, appup_file/1, config/1]). %% Default timetrap timeout (set in init_per_testcase) -define(default_timeout, ?t:minutes(1)). @@ -43,8 +43,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> case test_server:os_type() of - {unix, sunos} -> [app_file, config]; - _OS -> [app_file] + {unix, sunos} -> [app_file, appup_file, config]; + _OS -> [app_file, appup_file] end. groups() -> @@ -71,6 +71,9 @@ app_file(Config) when is_list(Config) -> ?line ok = test_server:app_test(os_mon), ok. +appup_file(Config) when is_list(Config) -> + ok = test_server:appup_test(os_mon). + config(suite) -> []; config(doc) -> diff --git a/lib/otp_mibs/test/otp_mibs_SUITE.erl b/lib/otp_mibs/test/otp_mibs_SUITE.erl index 5fd52ac2ac..5376c54210 100644 --- a/lib/otp_mibs/test/otp_mibs_SUITE.erl +++ b/lib/otp_mibs/test/otp_mibs_SUITE.erl @@ -45,7 +45,7 @@ end_per_testcase/2]). % Test cases must be exported. --export([nt_basic_types/1, nt_high_reduction_count/1]). +-export([app/1, appup/1, nt_basic_types/1, nt_high_reduction_count/1]). -define(TRAP_UDP, 5000). -define(AGENT_UDP, 4000). @@ -75,9 +75,10 @@ end_per_testcase(_Case, Config) when is_list(Config) -> suite() -> [{ct_hooks,[ts_install_cth]}, {require, snmp_mgr_agent, snmp}]. -all() -> [{group, node_table}]. +all() -> [{group, app}, {group, node_table}]. -groups() -> [{node_table, [], [nt_basic_types, nt_high_reduction_count]}]. +groups() -> [{app, [], [app, appup]}, + {node_table, [], [nt_basic_types, nt_high_reduction_count]}]. init_per_group(_GroupName, Config) -> Config. @@ -118,6 +119,14 @@ end_per_suite(Config) -> %% Test cases %%--------------------------------------------------------------------- +%% Test that the otp_mibs app file is ok +app(Config) when is_list(Config) -> + ok = ?t:app_test(otp_mibs). + +%% Test that the otp_mibs appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(otp_mibs). + nt_basic_types(suite) -> []; nt_basic_types(doc) -> diff --git a/lib/parsetools/test/Makefile b/lib/parsetools/test/Makefile index 6455f6ade7..7c7cc13965 100644 --- a/lib/parsetools/test/Makefile +++ b/lib/parsetools/test/Makefile @@ -20,6 +20,7 @@ include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES = \ + app_SUITE \ leex_SUITE \ yecc_SUITE diff --git a/lib/parsetools/test/app_SUITE.erl b/lib/parsetools/test/app_SUITE.erl new file mode 100644 index 0000000000..88ac95e311 --- /dev/null +++ b/lib/parsetools/test/app_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(app_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the parsetools app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(parsetools). + +appup() -> + [{doc, "Test that the parsetools appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(parsetools). diff --git a/lib/percept/test/percept_SUITE.erl b/lib/percept/test/percept_SUITE.erl index e415d92a04..aea2462b2e 100644 --- a/lib/percept/test/percept_SUITE.erl +++ b/lib/percept/test/percept_SUITE.erl @@ -27,6 +27,8 @@ %% Test cases -export([ + app/1, + appup/1, profile/1, analyze/1, analyze_dist/1, @@ -54,7 +56,7 @@ end_per_testcase(_Case, Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [webserver, profile, analyze, analyze_dist]. + [app, appup, webserver, profile, analyze, analyze_dist]. groups() -> []. @@ -70,6 +72,14 @@ end_per_group(_GroupName, Config) -> %% Tests %%---------------------------------------------------------------------- +%% Test that the percept app file is ok +app(Config) when is_list(Config) -> + ok = ?t:app_test(percept). + +%% Test that the percept appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(percept). + webserver(suite) -> []; webserver(doc) -> diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl index d3e9bf7cf6..163f5f4413 100644 --- a/lib/public_key/test/public_key_SUITE.erl +++ b/lib/public_key/test/public_key_SUITE.erl @@ -36,7 +36,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app, + [app, appup, {group, pem_decode_encode}, {group, ssh_public_key_decode_encode}, encrypt_decrypt, @@ -95,6 +95,13 @@ app(Config) when is_list(Config) -> %%-------------------------------------------------------------------- +appup() -> + [{doc, "Test that the public_key appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(public_key). + +%%-------------------------------------------------------------------- + dsa_pem() -> [{doc, "DSA PEM-file decode/encode"}]. dsa_pem(Config) when is_list(Config) -> diff --git a/lib/reltool/test/reltool_app_SUITE.erl b/lib/reltool/test/reltool_app_SUITE.erl index a6e00cde08..9abc7fea41 100644 --- a/lib/reltool/test/reltool_app_SUITE.erl +++ b/lib/reltool/test/reltool_app_SUITE.erl @@ -26,6 +26,7 @@ -compile(export_all). -include("reltool_test_lib.hrl"). +-include_lib("common_test/include/ct.hrl"). t() -> reltool_test_lib:t(?MODULE). @@ -64,7 +65,7 @@ end_per_testcase(Func,Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [fields, modules, export_all, app_depend, undef_funcs]. + [fields, modules, export_all, app_depend, undef_funcs, appup]. groups() -> []. @@ -290,3 +291,9 @@ key1search(Key, L) -> {value, {Key, Value}} -> Value end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Test that the reltool appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(reltool). diff --git a/lib/runtime_tools/test/runtime_tools_SUITE.erl b/lib/runtime_tools/test/runtime_tools_SUITE.erl index 62497ab527..48ed810918 100644 --- a/lib/runtime_tools/test/runtime_tools_SUITE.erl +++ b/lib/runtime_tools/test/runtime_tools_SUITE.erl @@ -25,7 +25,7 @@ -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases --export([app_file/1, start_stop_app/1]). +-export([app_file/1, appup_file/1, start_stop_app/1]). %% Default timetrap timeout (set in init_per_testcase) -define(default_timeout, ?t:minutes(1)). @@ -43,6 +43,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [app_file, + appup_file, start_stop_app]. groups() -> @@ -65,6 +66,9 @@ app_file(_Config) -> ?line ok = ?t:app_test(runtime_tools), ok. +appup_file(_Config) -> + ok = ?t:appup_test(runtime_tools). + start_stop_app(_Config) -> ok = application:start(runtime_tools), Sup = whereis(runtime_tools_sup), diff --git a/lib/snmp/test/snmp_appup_test.erl b/lib/snmp/test/snmp_appup_test.erl index 99994a2410..021d42a978 100644 --- a/lib/snmp/test/snmp_appup_test.erl +++ b/lib/snmp/test/snmp_appup_test.erl @@ -63,33 +63,9 @@ end_per_group(_GroupName, Config) -> init_per_suite(suite) -> []; init_per_suite(doc) -> []; init_per_suite(Config) when is_list(Config) -> - PrivDir = ?config(priv_dir, Config), - TopDir = filename:join(PrivDir, appup), - case file:make_dir(TopDir) of - ok -> - ok; - Error -> - fail({failed_creating_subsuite_top_dir, Error}) - end, - AppFile = file_name(?APPLICATION, ".app"), - AppupFile = file_name(?APPLICATION, ".appup"), - [{app_file, AppFile}, - {appup_file, AppupFile}, - {appup_topdir, TopDir} | Config]. + Config. -file_name(App, Ext) -> - Env = init:get_arguments(), - LibDir = - case lists:keysearch(clearcase, 1, Env) of - false -> - code:lib_dir(App); - _ -> - ".." - end, - filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). - - end_per_suite(suite) -> []; end_per_suite(doc) -> []; end_per_suite(Config) when is_list(Config) -> @@ -108,467 +84,6 @@ end_per_testcase(_Case, Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup_file(suite) -> - []; -appup_file(doc) -> - "Perform a simple check of the appup file"; +%% Perform a simple check of the appup file appup_file(Config) when is_list(Config) -> - AppupFile = key1search(appup_file, Config), - AppFile = key1search(app_file, Config), - Modules = modules(AppFile), - check_appup(AppupFile, Modules). - -modules(File) -> - case file:consult(File) of - {ok, [{application,snmp,Info}]} -> - case lists:keysearch(modules,1,Info) of - {value, {modules, Modules}} -> - Modules; - false -> - fail({bad_appinfo, Info}) - end; - Error -> - fail({bad_appfile, Error, File}) - end. - - -check_appup(AppupFile, Modules) -> - case file:consult(AppupFile) of - {ok, [{V, UpFrom, DownTo}]} -> - check_appup(V, UpFrom, DownTo, Modules); - Else -> - fail({bad_appupfile, Else}) - end. - - -check_appup(V, UpFrom, DownTo, Modules) -> - check_version(V), - check_depends(up, UpFrom, Modules), - check_depends(down, DownTo, Modules), - check_module_subset(up, UpFrom), - check_module_subset(down, DownTo), - ok. - -check_depends(_, [], _) -> - ok; -check_depends(UpDown, [Dep|Deps], Modules) -> - check_depend(UpDown, Dep, Modules), - check_depends(UpDown, Deps, Modules). - - -check_depend(up = UpDown, {add_application, ?APPLICATION} = Instr, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [UpDown, Instr, Modules]), - ok; -check_depend(down = UpDown, {remove_application, ?APPLICATION} = Instr, - Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [UpDown, Instr, Modules]), - ok; -check_depend(UpDown, {V, Instructions}, Modules) -> - d("check_instructions(~w) -> entry with" - "~n V: ~p" - "~n Modules: ~p", [UpDown, V, Modules]), - check_version(V), - case check_instructions(UpDown, - Instructions, Instructions, [], [], Modules) of - {_Good, []} -> - ok; - {_, Bad} -> - fail({bad_instructions, Bad, UpDown}) - end. - - -check_instructions(_, [], _, Good, Bad, _) -> - {lists:reverse(Good), lists:reverse(Bad)}; -check_instructions(UpDown, [Instr|Instrs], AllInstr, Good, Bad, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instr: ~p", [UpDown,Instr]), - case (catch check_instruction(UpDown, Instr, AllInstr, Modules)) of - ok -> - check_instructions(UpDown, Instrs, AllInstr, - [Instr|Good], Bad, Modules); - {error, Reason} -> - check_instructions(UpDown, Instrs, AllInstr, Good, - [{Instr, Reason}|Bad], Modules) - end; -check_instructions(UpDown, Instructions, _, _, _, _) -> - fail({bad_instructions, {UpDown, Instructions}}). - -check_instruction(_, {restart_application, ?APPLICATION}, _, _Modules) -> - d("check_instruction -> entry when restart_application instruction"), - ok; - -%% A new module is added -check_instruction(up, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when up-add_module instruction with" - "~n Module: ~p", [Module]), - check_module(Module, Modules); - -%% An old module is re-added -check_instruction(down, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when down-add_module instruction with" - "~n Module: ~p", [Module]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - error({existing_readded_module, Module}) - end; - -check_instruction(up, {delete_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when up-delete_module instruction with" - "~n Module: ~p", [Module]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - error({module_cannot_be_deleted, Module}) - end; - -%% An new module is deleted -check_instruction(down, {delete_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when down-delete_module instruction with" - "~n Module: ~p", [Module]), - check_module(Module, Modules); - -%% Removing a module on upgrade: -%% - the module has been removed from the app-file. -%% - check that no module depends on this (removed) module -check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) - when is_atom(Module) and is_atom(Pre) and is_atom(Post) -> - d("check_instruction -> entry when up-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - check_purge(Pre), - check_purge(Post); - ok -> - error({existing_removed_module, Module}) - end; - -%% Removing a module on downgrade: the module exist -%% in the app-file. -check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) - when is_atom(Module) and is_atom(Pre) and is_atom(Post) -> - d("check_instruction -> entry when down-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - ok -> - check_purge(Pre), - check_purge(Post), - check_no_remove_depends(Module, AllInstr); - {error, {unknown_module, Module, Modules}} -> - error({nonexisting_removed_module, Module}) - end; - -check_instruction(_, {load_module, Module, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module) and - is_atom(Pre) and - is_atom(Post) and - is_list(Depend) -> - d("check_instruction -> entry when load_module instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {update, Module, Change, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module) and - is_atom(Pre) and - is_atom(Post) and - is_list(Depend) -> - d("check_instruction -> entry when update instruction with" - "~n Module: ~p" - "~n Change: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Change, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_change(Change), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {update, Module, supervisor}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when supervisor update instruction with" - "~n Module: ~p", [Module]), - check_module(Module, Modules); - -check_instruction(_, {apply, {Module, Function, Args}}, _, _Modules) - when is_atom(Module) and is_atom(Function) and is_list(Args) -> - d("check_instruction -> entry when apply instruction with" - "~n Module: ~p" - "~n Function: ~p" - "~n Args: ~p", [Module, Function, Args]), - check_apply(Module, Function, Args); - -check_instruction(_, Instr, _AllInstr, _Modules) -> - error({error, {unknown_instruction, Instr}}). - -%% If Module X depends on Module Y, then module Y must have an update -%% instruction of some sort (otherwise the depend is faulty). -updated_modules([], Modules) -> - d("updated_modules -> entry when done with" - "~n Modules: ~p", [Modules]), - Modules; -updated_modules([Instr|Instrs], Modules) -> - d("updated_modules -> entry with" - "~n Instr: ~p" - "~n Modules: ~p", [Instr,Modules]), - case instruction_module(Instr) of - {module, Module} -> - d("updated_modules -> Module: ~p", [Module]), - updated_modules(Instrs, [Module|Modules]); - no_module -> - updated_modules(Instrs, Modules) - end. - -instruction_module({add_module, Module}) -> - {module, Module}; -instruction_module({delete_module, Module}) -> - {module, Module}; -instruction_module({remove, {Module, _, _}}) -> - {module, Module}; -instruction_module({load_module, Module, _, _, _}) -> - {module, Module}; -instruction_module({update, Module, _, _, _, _}) -> - {module, Module}; -instruction_module({update, Module, _}) -> - {module, Module}; -instruction_module({apply, {_, _, _}}) -> - no_module; -instruction_module(Instr) -> - d("instruction_module -> entry when unknown instruction with" - "~n Instr: ~p", [Instr]), - error({error, {unknown_instruction, Instr}}). - - -%% Check that the modules handled in an instruction set for version X -%% is a subset of the instruction set for version X-1. -check_module_subset(Direction, Instructions) -> - d("check_module_subset(~w) -> entry when" - "~n Instructions: ~p", [Direction,Instructions]), - do_check_module_subset(modules_of(Instructions)). - -do_check_module_subset([]) -> - ok; -do_check_module_subset([_]) -> - ok; -do_check_module_subset([{_V1, Mods1}|T]) -> - d("do_check_module_subset -> entry with" - "~n V1: ~s" - "~n Mods1: ~p", [_V1, Mods1]), - {V2, Mods2} = hd(T), - d("do_check_module_subset -> " - "~n V2: ~s" - "~n Mods2: ~p", [V2, Mods2]), - %% Check that the modules in V1 is a subset of V2 - case do_check_module_subset2(Mods1, Mods2) of - ok -> - do_check_module_subset(T); - {error, Modules} -> - fail({subset_missing_instructions, V2, Modules}) - end. - -do_check_module_subset2(_Mods1, [{restart_application, ?APPLICATION}]) -> - ok; -do_check_module_subset2(Mods1, Mods2) -> - do_check_module_subset2(Mods1, Mods2, []). - -do_check_module_subset2([], _, []) -> - ok; -do_check_module_subset2([], _, Acc) -> - {error, lists:reverse(Acc)}; -do_check_module_subset2([Mod|Mods], Mods2, Acc) -> - case lists:member(Mod, Mods2) of - true -> - do_check_module_subset2(Mods, Mods2, Acc); - false -> - do_check_module_subset2(Mods, Mods2, [Mod|Acc]) - end. - - -modules_of(Instructions) -> - modules_of(Instructions, []). - -modules_of([], Acc) -> - lists:reverse(Acc); -modules_of([{_V,[{restart_application, ?APPLICATION}]}|T], Acc) -> - modules_of(T, Acc); -modules_of([{V,Instructions}|T], Acc) -> - Mods = modules_of2(Instructions, []), - modules_of(T, [{V, Mods}|Acc]). - -modules_of2([], Acc) -> - lists:reverse(Acc); -modules_of2([Instr|Instructions], Acc) -> - d("module_of -> entry with" - "~n Instr: ~p", [Instr]), - case module_of(Instr) of - {value, Mod} -> - d("module_of -> Mod: ~p", [Mod]), - modules_of2(Instructions, [Mod|Acc]); - false -> - modules_of2(Instructions, Acc) - end. - -module_of({add_module, Module}) -> - {value, Module}; -module_of({delete_module, Module}) -> - {value, Module}; -module_of({remove, {Module, _Pre, _Post}}) -> - {value, Module}; -module_of({load_module, Module, _Pre, _Post, _Depend}) -> - {value, Module}; -module_of({update, Module, _Change, _Pre, _Post, _Depend}) -> - {value, Module}; -module_of({update, Module, supervisor}) -> - {value, Module}; -module_of(_) -> - false. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_version(V) when is_list(V) -> - ok; -check_version(V) -> - error({bad_version, V}). - - -check_module(M, Modules) when is_atom(M) -> - case lists:member(M, Modules) of - true -> - ok; - false -> - error({unknown_module, M, Modules}) - end; -check_module(M, _) -> - error({bad_module, M}). - - -check_module_depend(M, [], _) when is_atom(M) -> - ok; -check_module_depend(M, Deps, Modules) when is_atom(M) and is_list(Deps) -> - case [Dep || Dep <- Deps, lists:member(Dep, Modules) == false] of - [] -> - ok; - Unknown -> - error({unknown_depend_modules, Unknown}) - end; -check_module_depend(_M, D, _Modules) -> - error({bad_depend, D}). - - -check_no_remove_depends(_Module, []) -> - ok; -check_no_remove_depends(Module, [Instr|Instrs]) -> - check_no_remove_depend(Module, Instr), - check_no_remove_depends(Module, Instrs). - -check_no_remove_depend(Module, {load_module, Mod, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, load_module, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(Module, {update, Mod, _Change, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - error({removed_module_in_depend, update, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(_, _) -> - ok. - - -check_change(soft) -> - ok; -check_change({advanced, _Something}) -> - ok; -check_change(Change) -> - error({bad_change, Change}). - - -check_purge(soft_purge) -> - ok; -check_purge(brutal_purge) -> - ok; -check_purge(Purge) -> - error({bad_purge, Purge}). - -check_apply(Module, Function, Args) -> - case (catch Module:module_info()) of - Info when is_list(Info) -> - check_exported(Function, Args, Info); - {'EXIT', {undef, _}} -> - error({not_existing_module, Module}) - end. - -check_exported(Function, Args, Info) -> - case lists:keysearch(exports, 1, Info) of - {value, {exports, FuncList}} -> - Arity = length(Args), - Arities = [A || {F, A} <- FuncList, F == Function], - case lists:member(Arity, Arities) of - true -> - ok; - false -> - fail({not_exported_function, Function, Arity}) - end; - _ -> - error({bad_export, Info}) - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -error(Reason) -> - throw({error, Reason}). - -fail(Reason) -> - exit({suite_failed, Reason}). - -key1search(Key, L) -> - case lists:keysearch(Key, 1, L) of - undefined -> - fail({not_found, Key, L}); - {value, {Key, Value}} -> - Value - end. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -d(F) -> - d(F, []). - -d(F, A) -> - d(true, F, A). - -d(true, F, A) -> - io:format(F ++ "~n", A); -d(_, _, _) -> - ok. - + ok = ?t:appup_test(snmp). diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index b4e3871efd..d2e52379fa 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -38,6 +38,7 @@ suite() -> all() -> [app_test, + appup_test, {group, dsa_key}, {group, rsa_key}, {group, dsa_pass_key}, @@ -150,6 +151,11 @@ app_test(Config) when is_list(Config) -> ?t:app_test(ssh), ok. %%-------------------------------------------------------------------- +appup_test() -> + [{doc, "Appup file consistency test."}]. +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(ssh). +%%-------------------------------------------------------------------- misc_ssh_options() -> [{doc, "Test that we can set some misc options not tested elsewhere, " "some options not yet present are not decided if we should support or " diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index 2e216b32fa..ffa5401bf9 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -84,6 +84,7 @@ all_versions_groups ()-> basic_tests() -> [app, + appup, alerts, send_close, version_option, @@ -292,6 +293,11 @@ app() -> app(Config) when is_list(Config) -> ok = ?t:app_test(ssl). %%-------------------------------------------------------------------- +appup() -> + [{doc, "Test that the ssl appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(ssl). +%%-------------------------------------------------------------------- alerts() -> [{doc, "Test ssl_alert:alert_txt/1"}]. alerts(Config) when is_list(Config) -> diff --git a/lib/syntax_tools/test/syntax_tools_SUITE.erl b/lib/syntax_tools/test/syntax_tools_SUITE.erl index b673b70a95..d4c54a72aa 100644 --- a/lib/syntax_tools/test/syntax_tools_SUITE.erl +++ b/lib/syntax_tools/test/syntax_tools_SUITE.erl @@ -24,12 +24,12 @@ init_per_group/2,end_per_group/2]). %% Test cases --export([smoke_test/1,revert/1]). +-export([app_test/1,appup_test/1,smoke_test/1,revert/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [smoke_test,revert]. + [app_test,appup_test,smoke_test,revert]. groups() -> []. @@ -46,6 +46,11 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +app_test(Config) when is_list(Config) -> + ok = ?t:app_test(syntax_tools). + +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(syntax_tools). %% Read and parse all source in the OTP release. smoke_test(Config) when is_list(Config) -> diff --git a/lib/tools/test/tools_SUITE.erl b/lib/tools/test/tools_SUITE.erl index ea3f59dbe1..e3582b995b 100644 --- a/lib/tools/test/tools_SUITE.erl +++ b/lib/tools/test/tools_SUITE.erl @@ -30,12 +30,12 @@ -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases must be exported. --export([app_test/1]). +-export([app_test/1, appup_test/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [app_test]. + [app_test, appup_test]. groups() -> []. @@ -71,3 +71,7 @@ app_test(suite) -> []; app_test(Config) when is_list(Config) -> ?line ?t:app_test(tools, tolerant). + +%% Test that the .appup file does not contain any `basic' errors +appup_test(Config) when is_list(Config) -> + ok = ?t:appup_test(tools). diff --git a/lib/typer/test/Makefile b/lib/typer/test/Makefile new file mode 100644 index 0000000000..d6dd22b6cf --- /dev/null +++ b/lib/typer/test/Makefile @@ -0,0 +1,65 @@ +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + typer_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/typer_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \ + > $(EMAKEFILE) + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \ + >> $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) $(GEN_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" + $(INSTALL_DATA) typer.spec "$(RELSYSDIR)" + chmod -R u+w "$(RELSYSDIR)" + +release_docs_spec: diff --git a/lib/typer/test/typer.spec b/lib/typer/test/typer.spec new file mode 100644 index 0000000000..79f51b6781 --- /dev/null +++ b/lib/typer/test/typer.spec @@ -0,0 +1 @@ +{suites,"../typer_test",all}. diff --git a/lib/typer/test/typer_SUITE.erl b/lib/typer/test/typer_SUITE.erl new file mode 100644 index 0000000000..b6f7b2119b --- /dev/null +++ b/lib/typer/test/typer_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(typer_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the typer app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(typer). + +appup() -> + [{doc, "Test that the typer appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(typer). diff --git a/lib/webtool/src/Makefile b/lib/webtool/src/Makefile index f28c777240..af565c8895 100644 --- a/lib/webtool/src/Makefile +++ b/lib/webtool/src/Makefile @@ -66,7 +66,7 @@ ERL_COMPILE_FLAGS += +warn_obsolete_guard debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) clean: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APP_TARGET) + rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) rm -f core docs: diff --git a/lib/webtool/test/Makefile b/lib/webtool/test/Makefile new file mode 100644 index 0000000000..93aa1c09eb --- /dev/null +++ b/lib/webtool/test/Makefile @@ -0,0 +1,65 @@ +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + webtool_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/webtool_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \ + > $(EMAKEFILE) + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \ + >> $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) $(GEN_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) "$(RELSYSDIR)" + $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)" + $(INSTALL_DATA) webtool.spec "$(RELSYSDIR)" + chmod -R u+w "$(RELSYSDIR)" + +release_docs_spec: diff --git a/lib/webtool/test/webtool.spec b/lib/webtool/test/webtool.spec new file mode 100644 index 0000000000..134e6ed40c --- /dev/null +++ b/lib/webtool/test/webtool.spec @@ -0,0 +1 @@ +{suites,"../webtool_test",all}. diff --git a/lib/webtool/test/webtool_SUITE.erl b/lib/webtool/test/webtool_SUITE.erl new file mode 100644 index 0000000000..64ff221a1b --- /dev/null +++ b/lib/webtool/test/webtool_SUITE.erl @@ -0,0 +1,50 @@ +%% ``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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(webtool_SUITE). + +-compile([export_all]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +app() -> + [{doc, "Test that the webtool app file is ok"}]. +app(Config) when is_list(Config) -> + ok = ?t:app_test(webtool). + +appup() -> + [{doc, "Test that the webtool appup file is ok"}]. +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(webtool). diff --git a/lib/wx/test/wx_app_SUITE.erl b/lib/wx/test/wx_app_SUITE.erl index 162923eaa3..6331180ece 100644 --- a/lib/wx/test/wx_app_SUITE.erl +++ b/lib/wx/test/wx_app_SUITE.erl @@ -26,6 +26,7 @@ -compile(export_all). -include("wx_test_lib.hrl"). +-include_lib("common_test/include/ct.hrl"). t() -> wx_test_lib:t(?MODULE). @@ -50,7 +51,7 @@ end_per_testcase(Func,Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [fields, modules, exportall, app_depend, undef_funcs]. + [fields, modules, exportall, app_depend, undef_funcs, appup]. groups() -> []. @@ -281,3 +282,9 @@ key1search(Key, L) -> {value, {Key, Value}} -> Value end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Test that the wx appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(wx). diff --git a/lib/xmerl/test/xmerl_appup_test.erl b/lib/xmerl/test/xmerl_appup_test.erl index 80c8d8e4fd..ff6b368bcc 100644 --- a/lib/xmerl/test/xmerl_appup_test.erl +++ b/lib/xmerl/test/xmerl_appup_test.erl @@ -23,20 +23,7 @@ -module(xmerl_appup_test). -compile(export_all). - -%-include("megaco_test_lib.hrl"). - - -%t() -> megaco_test_lib:t(?MODULE). -%t(Case) -> megaco_test_lib:t({?MODULE, Case}). - - -%% Test server callbacks -% init_per_testcase(Case, Config) -> -% megaco_test_lib:init_per_testcase(Case, Config). - -% end_per_testcase(Case, Config) -> -% megaco_test_lib:end_per_testcase(Case, Config). +-include_lib("common_test/include/ct.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -58,14 +45,7 @@ end_per_group(_GroupName, Config) -> init_per_suite(suite) -> []; init_per_suite(doc) -> []; init_per_suite(Config) when is_list(Config) -> - AppFile = file_name(xmerl, ".app"), - AppupFile = file_name(xmerl, ".appup"), - [{app_file, AppFile}, {appup_file, AppupFile}|Config]. - - -file_name(App, Ext) -> - LibDir = code:lib_dir(App), - filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). + Config. end_per_suite(suite) -> []; @@ -76,317 +56,6 @@ end_per_suite(Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -appup(suite) -> - []; -appup(doc) -> - "perform a simple check of the appup file"; +%% perform a simple check of the appup file appup(Config) when is_list(Config) -> - AppupFile = key1search(appup_file, Config), - AppFile = key1search(app_file, Config), - Modules = modules(AppFile), - check_appup(AppupFile, Modules). - -modules(File) -> - case file:consult(File) of - {ok, [{application,xmerl,Info}]} -> - case lists:keysearch(modules,1,Info) of - {value, {modules, Modules}} -> - Modules; - false -> - fail({bad_appinfo, Info}) - end; - Error -> - fail({bad_appfile, Error}) - end. - - -check_appup(AppupFile, Modules) -> - case file:consult(AppupFile) of - {ok, [{V, UpFrom, DownTo}]} -> - io:format("V= ~p, UpFrom= ~p, DownTo= ~p, Modules= ~p~n", - [V, UpFrom, DownTo, Modules]), - check_appup(V, UpFrom, DownTo, Modules); - Else -> - fail({bad_appupfile, Else}) - end. - - -check_appup(V, UpFrom, DownTo, Modules) -> - check_version(V), - check_depends(up, UpFrom, Modules), - check_depends(down, DownTo, Modules), - ok. - - -check_depends(_, [], _) -> - ok; -check_depends(UpDown, [Dep|Deps], Modules) -> - check_depend(UpDown, Dep, Modules), - check_depends(UpDown, Deps, Modules). - - -check_depend(up,I={add_application, _App}, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [up,I , Modules]), - ok; -check_depend(down,I={remove_application, _App}, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instruction: ~p" - "~n Modules: ~p", [down,I , Modules]), - ok; -check_depend(UpDown, {V, Instructions}, Modules) -> - d("check_instructions(~w) -> entry with" - "~n V: ~p" - "~n Modules: ~p", [UpDown, V, Modules]), - check_version(V), - case check_instructions(UpDown, - Instructions, Instructions, [], [], Modules) of - {_Good, []} -> - ok; - {_, Bad} -> - fail({bad_instructions, Bad, UpDown}) - end. - - -check_instructions(_, [], _, Good, Bad, _) -> - {lists:reverse(Good), lists:reverse(Bad)}; -check_instructions(UpDown, [Instr|Instrs], AllInstr, Good, Bad, Modules) -> - d("check_instructions(~w) -> entry with" - "~n Instr: ~p", [UpDown,Instr]), - case (catch check_instruction(UpDown, Instr, AllInstr, Modules)) of - ok -> - check_instructions(UpDown, Instrs, AllInstr, - [Instr|Good], Bad, Modules); - {error, Reason} -> - d("check_instructions(~w) -> bad instruction: " - "~n Reason: ~p", [UpDown,Reason]), - check_instructions(UpDown, Instrs, AllInstr, Good, - [{Instr, Reason}|Bad], Modules) - end. - -%% A new module is added -check_instruction(up, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when up-add_module instruction with" - "~n Module: ~p", [Module]), - check_module(Module, Modules); - -%% An old module is re-added -check_instruction(down, {add_module, Module}, _, Modules) - when is_atom(Module) -> - d("check_instruction -> entry when down-add_module instruction with" - "~n Module: ~p", [Module]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - ok; - ok -> - local_error({existing_readded_module, Module}) - end; - -%% Removing a module on upgrade: -%% - the module has been removed from the app-file. -%% - check that no module depends on this (removed) module -check_instruction(up, {remove, {Module, Pre, Post}}, _, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - d("check_instruction -> entry when up-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - {error, {unknown_module, Module, Modules}} -> - check_purge(Pre), - check_purge(Post); - ok -> - local_error({existing_removed_module, Module}) - end; - -%% Removing a module on downgrade: the module exist -%% in the app-file. -check_instruction(down, {remove, {Module, Pre, Post}}, AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post) -> - d("check_instruction -> entry when down-remove instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p", [Module, Pre, Post]), - case (catch check_module(Module, Modules)) of - ok -> - check_purge(Pre), - check_purge(Post), - check_no_remove_depends(Module, AllInstr); - {error, {unknown_module, Module, Modules}} -> - local_error({nonexisting_removed_module, Module}) - end; - -check_instruction(_, {load_module, Module, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - d("check_instruction -> entry when load_module instruction with" - "~n Module: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, {update, Module, Change, Pre, Post, Depend}, - AllInstr, Modules) - when is_atom(Module), is_atom(Pre), is_atom(Post), is_list(Depend) -> - d("check_instruction -> entry when update instruction with" - "~n Module: ~p" - "~n Change: ~p" - "~n Pre: ~p" - "~n Post: ~p" - "~n Depend: ~p", [Module, Change, Pre, Post, Depend]), - check_module(Module, Modules), - check_module_depend(Module, Depend, Modules), - check_module_depend(Module, Depend, updated_modules(AllInstr, [])), - check_change(Change), - check_purge(Pre), - check_purge(Post); - -check_instruction(_, Instr, _AllInstr, _Modules) -> - d("check_instruction -> entry when unknown instruction with" - "~n Instr: ~p", [Instr]), - local_error({error, {unknown_instruction, Instr}}). - - -%% If Module X depends on Module Y, then module Y must have an update -%% instruction of some sort (otherwise the depend is faulty). -updated_modules([], Modules) -> - d("update_modules -> entry when done with" - "~n Modules: ~p", [Modules]), - Modules; -updated_modules([Instr |Instrs], Modules) -> - d("update_modules -> entry with" - "~n Instr: ~p" - "~n Modules: ~p", [Instr,Modules]), - Module = instruction_module(Instr), - d("update_modules -> Module: ~p", [Module]), - updated_modules(Instrs, [Module|Modules]). - -instruction_module({add_module, Module}) -> - Module; -instruction_module({remove, {Module, _, _}}) -> - Module; -instruction_module({load_module, Module, _, _, _}) -> - Module; -instruction_module({update, Module, _, _, _, _}) -> - Module; -instruction_module(Instr) -> - d("instruction_module -> entry when unknown instruction with" - "~n Instr: ~p", [Instr]), - local_error({error, {unknown_instruction, Instr}}). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -check_version(V) when is_list(V) -> - ok; -check_version(V) -> - local_error({bad_version, V}). - - -check_module(M, Modules) when is_atom(M) -> - case lists:member(M,Modules) of - true -> - ok; - false -> - local_error({unknown_module, M, Modules}) - end; -check_module(M, _) -> - local_error({bad_module, M}). - - -check_module_depend(M, [], _) when is_atom(M) -> - d("check_module_depend -> entry with" - "~n M: ~p", [M]), - ok; -check_module_depend(M, Deps, Modules) when is_atom(M), is_list(Deps) -> - d("check_module_depend -> entry with" - "~n M: ~p" - "~n Deps: ~p" - "~n Modules: ~p", [M, Deps, Modules]), - case [Dep || Dep <- Deps, lists:member(Dep, Modules) == false] of - [] -> - ok; - Unknown -> - local_error({unknown_depend_modules, Unknown}) - end; -check_module_depend(_M, D, _Modules) -> - d("check_module_depend -> entry when bad depend with" - "~n D: ~p", [D]), - local_error({bad_depend, D}). - - -check_no_remove_depends(_Module, []) -> - ok; -check_no_remove_depends(Module, [Instr|Instrs]) -> - check_no_remove_depend(Module, Instr), - check_no_remove_depends(Module, Instrs). - -check_no_remove_depend(Module, {load_module, Mod, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - local_error({removed_module_in_depend, load_module, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(Module, {update, Mod, _Change, _Pre, _Post, Depend}) -> - case lists:member(Module, Depend) of - true -> - local_error({removed_module_in_depend, update, Mod, Module}); - false -> - ok - end; -check_no_remove_depend(_, _) -> - ok. - - -check_change(soft) -> - ok; -check_change({advanced, _Something}) -> - ok; -check_change(Change) -> - local_error({bad_change, Change}). - - -check_purge(soft_purge) -> - ok; -check_purge(brutal_purge) -> - ok; -check_purge(Purge) -> - local_error({bad_purge, Purge}). - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -local_error(Reason) -> - throw({error, Reason}). - -fail(Reason) -> - exit({suite_failed, Reason}). - -key1search(Key, L) -> - case lists:keysearch(Key, 1, L) of - undefined -> - fail({not_found, Key, L}); - {value, {Key, Value}} -> - Value - end. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -d(F, A) -> - d(false, F, A). - -d(true, F, A) -> - io:format(F ++ "~n", A); -d(_, _, _) -> - ok. - - + ok = ?t:appup_test(xmerl). -- cgit v1.2.3 From 1cb2aa3ebba6c3d3b0f722fe669f4407d1cf31ea Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Tue, 18 Feb 2014 12:34:47 +0100 Subject: Fix missing module on hipe app file template --- lib/hipe/main/hipe.app.src | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/hipe/main/hipe.app.src b/lib/hipe/main/hipe.app.src index 7db4db8a57..bcdfcb0e03 100644 --- a/lib/hipe/main/hipe.app.src +++ b/lib/hipe/main/hipe.app.src @@ -192,7 +192,6 @@ hipe_tagscheme, hipe_temp_map, hipe_timing, - hipe_tool, hipe_vectors, hipe_x86, hipe_x86_assemble, -- cgit v1.2.3 From d5b4bd041f625324862ff51f995cd224fb7a9831 Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Wed, 19 Feb 2014 16:17:45 +0100 Subject: Make hipe non-upgradable by setting appup file empty The reason for this is that if you are running a system with native compiled code, then you will have major problems with soft upgrade and the only reasonable way to go is to restart your emulator. Currently there is no instruction that will force ONLY a restart of the emulator, so the solution would be to hand write a relup with only a restart_emulator instruction. By letting hipe.appup be empty, systools will complain and not generate a relup - which should indicate that you might have to write your relup by hand. --- lib/hipe/main/hipe.appup.src | 5 +---- lib/hipe/test/hipe_SUITE.erl | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/hipe/main/hipe.appup.src b/lib/hipe/main/hipe.appup.src index bd4a4f0671..02679fab21 100644 --- a/lib/hipe/main/hipe.appup.src +++ b/lib/hipe/main/hipe.appup.src @@ -15,7 +15,4 @@ %% under the License. %% %% %CopyrightEnd% -{"%VSN%", - [{<<".*">>,[{restart_application, hipe}]}], - [{<<".*">>,[{restart_application, hipe}]}] -}. +{"%VSN%", [], []}. diff --git a/lib/hipe/test/hipe_SUITE.erl b/lib/hipe/test/hipe_SUITE.erl index 3beff95e90..8eb3967993 100644 --- a/lib/hipe/test/hipe_SUITE.erl +++ b/lib/hipe/test/hipe_SUITE.erl @@ -47,4 +47,6 @@ app(Config) when is_list(Config) -> appup() -> [{doc, "Test that the hipe appup file is ok"}]. appup(Config) when is_list(Config) -> - ok = ?t:appup_test(hipe). + AppupFile = "hipe.appup", + AppupPath = filename:join([code:lib_dir(hipe), "ebin", AppupFile]), + {ok, [{_Vsn, [], []}]} = file:consult(AppupPath). -- cgit v1.2.3 From 4fe82b421fda09896392f239329d1d04cf4cab39 Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Fri, 21 Feb 2014 09:15:41 +0100 Subject: Disable hipe_SUITE when environment doesn't support it --- lib/hipe/test/hipe_SUITE.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/hipe/test/hipe_SUITE.erl b/lib/hipe/test/hipe_SUITE.erl index 8eb3967993..554bc972f6 100644 --- a/lib/hipe/test/hipe_SUITE.erl +++ b/lib/hipe/test/hipe_SUITE.erl @@ -28,7 +28,10 @@ groups() -> []. init_per_suite(Config) -> - Config. + case erlang:system_info(hipe_architecture) of + undefined -> {skip, "HiPE not available or enabled"}; + _ -> Config + end. end_per_suite(_Config) -> ok. -- cgit v1.2.3 From beae7ae0dab99a34ac6a6471feb8a7b9b2a3ed32 Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Fri, 21 Feb 2014 12:12:59 +0100 Subject: Dynamically configure typer_SUITE according to environment Disables the typer app_test when dependent applications are missing. --- lib/typer/test/typer_SUITE.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/typer/test/typer_SUITE.erl b/lib/typer/test/typer_SUITE.erl index b6f7b2119b..99c4facbad 100644 --- a/lib/typer/test/typer_SUITE.erl +++ b/lib/typer/test/typer_SUITE.erl @@ -22,7 +22,13 @@ suite() -> [{ct_hooks, [ts_install_cth]}]. all() -> - [app, appup]. + case application:ensure_all_started(typer) of + {ok, Apps} -> + [application:stop(App) || App <- lists:reverse(Apps)], + [app, appup]; + _ -> + [appup] + end. groups() -> []. -- cgit v1.2.3