From df88b47cdafcc2e04452456942ea572a7b72e2f2 Mon Sep 17 00:00:00 2001 From: Lars G Thorsen Date: Tue, 26 Jan 2010 10:13:35 +0000 Subject: OTP-8343 The documentation is now possible to build in an open source environment after a number of bugs are fixed and some features are added in the documentation build process. - The arity calculation is updated. - The module prefix used in the function names for bif's are removed in the generated links so the links will look like http://www.erlang.org/doc/man/erlang.html#append_element-2 instead of http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2 - Enhanced the menu positioning in the html documentation when a new page is loaded. - A number of corrections in the generation of man pages (thanks to Sergei Golovan) - Moved some man pages to more apropriate sections, pages in section 4 moved to 5 and pages in 6 moved to 7. - The legal notice is taken from the xml book file so OTP's build process can be used for non OTP applications. --- lib/appmon/doc/src/Makefile | 13 +- lib/common_test/doc/src/Makefile | 20 +- lib/crypto/doc/src/Makefile | 3 + lib/docbuilder/doc/src/inline_tags.xml | 8 +- lib/edoc/Makefile | 6 +- lib/edoc/doc/src/Makefile | 5 +- lib/edoc/src/Makefile | 2 + lib/erl_docgen/priv/bin/Makefile | 13 +- .../priv/bin/codeline_preprocessing.escript | 17 +- lib/erl_docgen/priv/bin/xml_from_edoc.escript | 149 +++++++ lib/erl_docgen/priv/xsl/db_eix.xsl | 68 ++- lib/erl_docgen/priv/xsl/db_html.xsl | 251 ++++++++--- lib/erl_docgen/priv/xsl/db_man.xsl | 180 +++++--- lib/erl_docgen/priv/xsl/db_pdf.xsl | 99 ++++- lib/erl_docgen/priv/xsl/db_pdf_params.xsl | 26 +- lib/et/doc/src/Makefile | 24 +- lib/eunit/doc/src/Makefile | 5 +- lib/hipe/Makefile | 18 +- lib/hipe/amd64/Makefile | 15 +- lib/hipe/arm/Makefile | 15 +- lib/hipe/cerl/Makefile | 15 +- lib/hipe/flow/Makefile | 15 +- lib/hipe/icode/Makefile | 15 +- lib/hipe/main/Makefile | 16 +- lib/hipe/misc/Makefile | 15 +- lib/hipe/opt/Makefile | 15 +- lib/hipe/ppc/Makefile | 15 +- lib/hipe/regalloc/Makefile | 16 +- lib/hipe/sparc/Makefile | 15 +- lib/hipe/tools/Makefile | 15 +- lib/hipe/util/Makefile | 15 +- lib/hipe/x86/Makefile | 15 +- lib/jinterface/doc/src/Makefile | 13 +- lib/odbc/doc/src/Makefile | 13 +- lib/percept/doc/src/Makefile | 14 +- lib/reltool/test/Makefile | 82 ++++ lib/reltool/test/README | 30 ++ lib/reltool/test/reltool.spec | 2 + lib/reltool/test/reltool_server_SUITE.erl | 494 +++++++++++++++++++++ lib/reltool/test/reltool_test_lib.erl | 329 ++++++++++++++ lib/reltool/test/reltool_test_lib.hrl | 91 ++++ lib/reltool/test/reltool_wx_SUITE.erl | 62 +++ lib/reltool/test/rtt | 55 +++ lib/reltool/test/rtt.erl | 154 +++++++ lib/stdlib/doc/src/beam_lib.xml | 152 ++++--- lib/stdlib/doc/src/io.xml | 9 +- lib/stdlib/doc/src/unicode.xml | 4 +- lib/stdlib/doc/src/unicode_usage.xml | 6 +- lib/syntax_tools/Makefile | 6 +- lib/syntax_tools/doc/src/Makefile | 14 +- lib/syntax_tools/src/Makefile | 12 +- lib/test_server/doc/src/Makefile | 13 +- lib/test_server/src/Makefile | 12 +- lib/wx/doc/src/Makefile | 18 +- 54 files changed, 2269 insertions(+), 435 deletions(-) create mode 100755 lib/erl_docgen/priv/bin/xml_from_edoc.escript create mode 100644 lib/reltool/test/Makefile create mode 100644 lib/reltool/test/README create mode 100644 lib/reltool/test/reltool.spec create mode 100644 lib/reltool/test/reltool_server_SUITE.erl create mode 100644 lib/reltool/test/reltool_test_lib.erl create mode 100644 lib/reltool/test/reltool_test_lib.hrl create mode 100644 lib/reltool/test/reltool_wx_SUITE.erl create mode 100755 lib/reltool/test/rtt create mode 100644 lib/reltool/test/rtt.erl (limited to 'lib') diff --git a/lib/appmon/doc/src/Makefile b/lib/appmon/doc/src/Makefile index ece0977810..743f123c06 100644 --- a/lib/appmon/doc/src/Makefile +++ b/lib/appmon/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. 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% include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk @@ -46,6 +46,9 @@ XML_CHAPTER_FILES = \ BOOK_FILES = book.xml +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + GIF_FILES = \ app_win.gif \ listbox_win.gif \ diff --git a/lib/common_test/doc/src/Makefile b/lib/common_test/doc/src/Makefile index a6ece5af28..a2c014418d 100644 --- a/lib/common_test/doc/src/Makefile +++ b/lib/common_test/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2003-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2003-2010. 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% # @@ -112,18 +112,16 @@ DVIPS_FLAGS += CT_SRC_DIR = $(ERL_TOP)/../internal_tools/common_test/src -EDOC_ARGS=[{preprocess,true},{includes,["$(XMERL_DIR)/include","../../../test_server/include","../../include","../../../../erts/lib/kernel/include","../../../../lib/kernel/include","../../../../erts/lib/snmp/include","../../../../lib/snmp/include"]}] - - $(HTMLDIR)/%.gif: %.gif $(INSTALL_DATA) $< $@ docs: pdf html man $(CT_XML_FILES): - erl -boot start_clean -noshell \ - -eval 'docb_gen:module("../../src/$(@:%.xml=%.erl)",$(EDOC_ARGS))' \ - -s erlang halt + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -preprocess true -i $(XMERL_DIR)/include \ + -i ../../../test_server/include -i ../../include \ + -i ../../../../erts/lib/kernel/include -i ../../../../lib/kernel/include \ + -i ../../../../erts/lib/snmp/include -i ../../../../lib/snmp/include ../../src/$(@:%.xml=%.erl) $(TOP_PDF_FILE): $(XML_FILES) diff --git a/lib/crypto/doc/src/Makefile b/lib/crypto/doc/src/Makefile index d2cec9b11b..03aaba939b 100644 --- a/lib/crypto/doc/src/Makefile +++ b/lib/crypto/doc/src/Makefile @@ -42,6 +42,9 @@ XML_CHAPTER_FILES = notes.xml licenses.xml BOOK_FILES = book.xml +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + GIF_FILES = # ---------------------------------------------------- diff --git a/lib/docbuilder/doc/src/inline_tags.xml b/lib/docbuilder/doc/src/inline_tags.xml index e1d392076a..10afbf143f 100644 --- a/lib/docbuilder/doc/src/inline_tags.xml +++ b/lib/docbuilder/doc/src/inline_tags.xml @@ -4,7 +4,7 @@
- 19972009 + 19972010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ 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. - + Inline Tags @@ -157,7 +157,7 @@

The default behaviour can be modified by using the callback module option to docb_transform:file/1,2 and defining a callback function - Module:seealso/1. + Module:seealso/1. This possibility is for example used in OTP to resolve cross references between applications.

diff --git a/lib/edoc/Makefile b/lib/edoc/Makefile index 2b011b55cc..e512e390e3 100644 --- a/lib/edoc/Makefile +++ b/lib/edoc/Makefile @@ -86,13 +86,13 @@ SYNTAX_TOOLS_DIR=$(ERL_TOP)/lib/syntax_tools XMERL_DIR=$(ERL_TOP)/lib/xmerl INCDIR=$(XMERL_DIR)/include -docs: +# The overriding docs target have been removed so the default make rules work properly. + +edocs: erl -noshell -pa $(BINDIR) -pa $(SYNTAX_TOOLS_DIR)/ebin \ -pa $(XMERL_DIR)/ebin -run edoc_run application \ "'$(APPNAME)'" '"."' '$(DOC_OPTS)' -edocs: docs - info: @echo $(HTML_FILES) diff --git a/lib/edoc/doc/src/Makefile b/lib/edoc/doc/src/Makefile index 8d22e1c1da..748691d173 100644 --- a/lib/edoc/doc/src/Makefile +++ b/lib/edoc/doc/src/Makefile @@ -103,11 +103,10 @@ html: gifs $(HTML_REF_MAN_FILE) man: $(MAN3_FILES) $(XML_REF3_FILES): - docb_gen -def vsn $(EDOC_VSN) -includes $(INC_DIR) \ - $(SRC_DIR)/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EDOC_VSN) -i $(ERL_TOP)/lib/edoc/include $(SRC_DIR)/$(@:%.xml=%.erl) $(XML_CHAPTER_FILES): - docb_gen -chapter -def vsn $(EDOC_VSN) ../overview.edoc + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EDOC_VSN) -chapter ../overview.edoc gifs: $(GIF_FILES:%=$(HTMLDIR)/%) diff --git a/lib/edoc/src/Makefile b/lib/edoc/src/Makefile index fd0fbac37d..ca95c4cdad 100644 --- a/lib/edoc/src/Makefile +++ b/lib/edoc/src/Makefile @@ -55,6 +55,8 @@ all: $(OBJECTS) $(OBJECTS): $(HRL_FILES) $(XMERL)/include/xmerl.hrl +docs: + clean: rm -f $(OBJECTS) edoc_parser.erl rm -f core *~ diff --git a/lib/erl_docgen/priv/bin/Makefile b/lib/erl_docgen/priv/bin/Makefile index bd59675003..95ad36216a 100644 --- a/lib/erl_docgen/priv/bin/Makefile +++ b/lib/erl_docgen/priv/bin/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2009-2010. 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% # # @@ -38,7 +38,8 @@ RELSYSDIR = $(RELEASE_PATH)/lib/erl_docgen-$(VSN) ESCRIPT_FILES= \ - codeline_preprocessing.escript + codeline_preprocessing.escript \ + xml_from_edoc.escript # ---------------------------------------------------- # FLAGS diff --git a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript index 33a678d3a4..592b3985e4 100755 --- a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript +++ b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript @@ -1,20 +1,20 @@ #!/usr/bin/env escript %% -*- erlang -*- %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2009-2010. 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% %%---------------------------------------------------------------------- %% File : codeline_preprocessing.escript @@ -54,13 +54,16 @@ main([InFile, OutFile]) -> main(_) -> usage(). +%%====================================================================== +%% Internal functions +%%====================================================================== %%---------------------------------------------------------------------- -%% Function: main/1 +%% Function: usage/0 %% Description: %%---------------------------------------------------------------------- usage() -> - io:format("usage: codeline_preprocessing \n"), + io:format("usage: codeline_preprocessing.escript \n"), halt(1). diff --git a/lib/erl_docgen/priv/bin/xml_from_edoc.escript b/lib/erl_docgen/priv/bin/xml_from_edoc.escript new file mode 100755 index 0000000000..ee79e82c3a --- /dev/null +++ b/lib/erl_docgen/priv/bin/xml_from_edoc.escript @@ -0,0 +1,149 @@ +#!/usr/bin/env escript +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010. 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% +%%---------------------------------------------------------------------- +%% File : xml_from_edoc.escript +%% +%% Created : 12 Dec 2009 by Lars Thorsen +%%---------------------------------------------------------------------- + + +%%====================================================================== +%% Records +%%====================================================================== +-record(args, {suffix=".xml", + layout=docb_edoc_xml_cb, + def=[], + includes=[], + preprocess=false, + sort_functions=true}). + + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function: main/1 +%% Description: +%%---------------------------------------------------------------------- +main(RawOpts) -> + case catch parse(RawOpts, erlref, #args{}) of + {ok, File, Type, Args} -> + case Type of + erlref -> + module(File, Args); + chapter -> + users_guide(File, Args) + end; + {error, Msg} -> + io:format("~p\n", [Msg]), + usage() + end; +main(_) -> + usage(). + +%%====================================================================== +%% Internal functions +%%====================================================================== + +%%---------------------------------------------------------------------- +%% Function: usage/0 +%% Description: +%%---------------------------------------------------------------------- +usage() -> + io:format("usage: xml_from_edoc.escript [] \n"), + halt(1). + + +%%---------------------------------------------------------------------- +%% Function: module/2 +%% Description: +%%---------------------------------------------------------------------- +module(File, Args) -> + case filelib:is_regular(File) of + true -> + Opts = [{def, Args#args.def}, + {includes, Args#args.includes}, + {preprocess, Args#args.preprocess}, + {sort_functions, Args#args.sort_functions}, + + {app_default, "OTPROOT"}, + {file_suffix, Args#args.suffix}, + {dir, "."}, + {layout, Args#args.layout}], + edoc:file(File, Opts); + false -> + io:format("~s: not a regular file\n", [File]), + usage() + end. + + +%%---------------------------------------------------------------------- +%% Function: users_guide/2 +%% Description: +%%---------------------------------------------------------------------- +users_guide(File, Args) -> + case filelib:is_regular(File) of + true -> + Opts = [{def, Args#args.def}, + {app_default, "OTPROOT"}, + {file_suffix, Args#args.suffix}, + {layout, Args#args.layout}], + + Env = edoc_lib:get_doc_env(Opts), + + {ok, Tags} = + edoc_extract:file(File, overview, Env, Opts), + Data = + edoc_data:overview("Overview", Tags, Env, Opts), + F = fun(M) -> M:overview(Data, Opts) end, + Text = edoc_lib:run_layout(F, Opts), + + OutFile = "chapter" ++ Args#args.suffix, + edoc_lib:write_file(Text, ".", OutFile); + false -> + io:format("~s: not a regular file\n", [File]), + usage() + end. + + + +parse(["-xml" |RawOpts], Type, Args) -> + parse(RawOpts, Type, Args); % default, no update of record necessary +parse(["-sgml" |RawOpts], Type, Args) -> + parse(RawOpts, Type, Args#args{suffix=".sgml", layout=docb_edoc_sgml_cb}); +parse(["-chapter" |RawOpts], _Type, Args) -> + parse(RawOpts, chapter, Args); +parse(["-def", Key, Val |RawOpts], Type, Args) -> + Args2 = Args#args{def=Args#args.def++[{list_to_atom(Key), Val}]}, + parse(RawOpts, Type, Args2); + +parse(["-i", Dir |RawOpts], Type, Args) -> + Args2 = Args#args{includes=Args#args.includes++[Dir]}, + parse(RawOpts, Type, Args2); +parse(["-preprocess", Bool |RawOpts], Type, Args) when Bool == "true"; + Bool == "false" -> + parse(RawOpts, Type, Args#args{preprocess=list_to_atom(Bool)}); +parse(["-sort_functions", Bool |RawOpts], Type, Args) when Bool == "true"; + Bool == "false" -> + parse(RawOpts, Type, Args#args{sort_functions=list_to_atom(Bool)}); +parse([File], Type, Args) -> + {ok, File, Type, Args}; +parse([Opt | _RawOpts], _Type, _Args) -> + {error, io_lib:format("Bad option: ~p", [Opt])}. + diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index 929272256a..970b85ccb9 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -137,7 +137,20 @@ - + + + + + + + + + + + + + + @@ -178,26 +191,63 @@ - - - + + + + + + ( + ) + + + + + + + { + } + + + + + + [ + ] + + + + + + + + + + + + + + + + + - - - + + + - + - + + diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index 984655fc26..c2b58e48ec 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -2,20 +2,20 @@ @@ -40,6 +40,46 @@
+ @@ -543,7 +583,13 @@ false -
  • + + + loadscrollpos + no + + +
    • @@ -731,12 +777,19 @@ + + + loadscrollpos + no + + + -
    • +
      • @@ -788,58 +841,73 @@
      • - () - -
      • - - -
      • - - () - -
      • -
        - - - - - - - - - - - - - - - + () + + - - - +
      • + + () + +
      • -
        -
        - - - - - - - - - - -
      • - - / - -
      • -
        - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      • + + / + +
      • +
        + + @@ -1065,6 +1133,7 @@ +

        EXPORTS @@ -1121,11 +1190,26 @@
        -
        + + + + + + + + + + + + + + + + +
        - @@ -1167,6 +1251,7 @@ +

        @@ -1458,29 +1543,65 @@ + + + + + + ( + ) + + + + + + + { + } + + + + + + + [ + ] + + + + + + + + + + + + - - + + - - - + + + - + - + + diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index c759a77496..300d1ed362 100644 --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl @@ -2,20 +2,20 @@ @@ -37,14 +37,12 @@ - .RE .SH "" - - .RE + .SS "" @@ -53,9 +51,9 @@ - .RS 2 + .RS 2 - .RE + .RE @@ -65,72 +63,80 @@ - .br - .br + .LP - .RS 2 - - .RE + .RS 2 + + .RE - .TP 4 + .TP 2 .B - + : - - .br - .br + + + + + + .RS 2 + .LP .LP + + .RE + + - - - + + + + + + + + + + + - .TP 4 .B Note: + .SS Note: + - .TP 4 .B Warning: + .SS Warning: + - - - - - - .LP - - - - .LP + .LP - \fB + \fB - \fR\& + \fR\& @@ -138,19 +144,20 @@ - \fI\fR\& + \fI\fR\& - \fI\fR\& + \fI \fR\& - \fB\fR\& + \fB\fR\& + .LP .nf .fi @@ -158,6 +165,7 @@ + .LP .nf .fi @@ -168,16 +176,7 @@ - - - - + @@ -192,7 +191,7 @@ .TH 3 " " "Ericsson AB" "Erlang Module Definition" - .SH MODULE + .SH NAME \- @@ -225,7 +224,7 @@ .TH 6 " " "Ericsson AB" "Erlang Application Definition" .SH NAME - \- + \- @@ -297,9 +296,80 @@ - + + + + .SH AUTHORS + + + + + + .LP + + + + + + .I < + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index bef86277ea..e12b4d219a 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -2,20 +2,20 @@ @@ -229,7 +229,9 @@ - The contents of this file are subject to the Erlang Public License, + + + . @@ -382,7 +385,9 @@ - + + + @@ -422,8 +427,26 @@ + + + + + + + + + + + + + + + + + + - / + / @@ -668,12 +691,12 @@ - + - + Code listing . @@ -687,12 +710,12 @@ - + - + Code listing . @@ -862,7 +885,7 @@ - + Exports @@ -958,6 +981,7 @@ + @@ -1103,27 +1127,62 @@ + + + + + ( + ) + + + + + + + { + } + + + + + + + [ + ] + + + + + + + + + + + + - - + + - - - + + + - + - + + diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index e2e264b90a..7de20f2092 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -2,20 +2,20 @@ @@ -110,7 +110,7 @@ 0.9em - bold + @@ -248,6 +248,8 @@ 1em 1em 2em + 0.5em + 0.5em false preserve no-wrap @@ -266,8 +268,10 @@ justify 1em 0.3em - 1em - 1em + 0.5em + 0.5em + 0.5em + 0.5em always @@ -278,8 +282,10 @@ justify 1em 0.3em - 1em - 1em + 0.5em + 0.5em + 0.5em + 0.5em always diff --git a/lib/et/doc/src/Makefile b/lib/et/doc/src/Makefile index bcbde437d1..6bb8164e91 100644 --- a/lib/et/doc/src/Makefile +++ b/lib/et/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2002-2010. 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% # @@ -41,6 +41,9 @@ include files.mk # ---------------------------------------------------- +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) @@ -60,7 +63,7 @@ XML_FLAGS += # ---------------------------------------------------- # Targets # ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif +$(HTMLDIR)/%: % $(INSTALL_DATA) $< $@ docs: pdf html man @@ -69,9 +72,14 @@ $(TOP_PDF_FILE): $(XML_FILES) pdf: $(TOP_PDF_FILE) -html: gifs $(HTML_REF_MAN_FILE) +html: images $(HTML_REF_MAN_FILE) clean clean_docs: + for file in $(XML_FILES); do \ + if [ -f $$file\src ]; then \ + rm -f $$file; \ + fi \ + done rm -rf $(HTMLDIR)/* rm -f $(MAN3DIR)/* rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) @@ -79,7 +87,7 @@ clean clean_docs: man: $(MAN3_FILES) -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) +images: $(IMAGE_FILES:%=$(HTMLDIR)/%) debug opt: diff --git a/lib/eunit/doc/src/Makefile b/lib/eunit/doc/src/Makefile index faf2f9a847..19be96d763 100644 --- a/lib/eunit/doc/src/Makefile +++ b/lib/eunit/doc/src/Makefile @@ -123,11 +123,10 @@ man: $(MAN3_FILES) gifs: $(GIF_FILES:%=$(HTMLDIR)/%) $(XML_REF3_FILES): - docb_gen -def vsn $(EUNIT_VSN) -includes $(EUNIT_INC_DIR) $(EUNIT_DIR)/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EUNIT_VSN) -i $(EUNIT_INC_DIR) $(EUNIT_DIR)/$(@:%.xml=%.erl) $(XML_CHAPTER_FILES): - docb_gen -chapter -def vsn $(EUNIT_VSN) ../overview.edoc - + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(EUNIT_VSN) -chapter ../overview.edoc info: @echo "XML_PART_FILES: $(XML_PART_FILES)" diff --git a/lib/hipe/Makefile b/lib/hipe/Makefile index be3a618e34..10bf82b2d7 100644 --- a/lib/hipe/Makefile +++ b/lib/hipe/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # SHELL=/bin/sh @@ -42,15 +42,13 @@ endif # include $(ERL_TOP)/make/otp_subdir.mk -# This overrides the default recursive-make edocs target in otp_subdir.mk -# It is not pretty, but it will have to do for now. -docs: +# The overriding docs target have been removed so the default make rules work properly. + +edocs: @if [ -d $(ERL_TOP)/lib/edoc/ebin ]; then \ erl -noshell -pa $(ERL_TOP)/lib/edoc/ebin $(ERL_TOP)/lib/syntax_tools/ebin $(ERL_TOP)/lib/xmerl/ebin -run edoc_run application 'hipe' '"."' '[new,no_packages]' -s init stop ; \ fi -edocs: docs - all-subdirs: -for dir in $(SUB_DIRECTORIES); do \ (cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../ebin; cd ..); \ diff --git a/lib/hipe/amd64/Makefile b/lib/hipe/amd64/Makefile index 93e5f086d9..58377e5349 100644 --- a/lib/hipe/amd64/Makefile +++ b/lib/hipe/amd64/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2004-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2004-2010. 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% # @@ -80,7 +80,10 @@ ERL_COMPILE_FLAGS += -DHIPE_AMD64 +warn_exported_vars debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/arm/Makefile b/lib/hipe/arm/Makefile index 571a1da0fc..3f60cd77cc 100644 --- a/lib/hipe/arm/Makefile +++ b/lib/hipe/arm/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2005-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2005-2010. 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% # @@ -81,7 +81,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/cerl/Makefile b/lib/hipe/cerl/Makefile index fb7ca1153b..7fcc44d27d 100644 --- a/lib/hipe/cerl/Makefile +++ b/lib/hipe/cerl/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2003-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2003-2010. 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% # @@ -73,7 +73,10 @@ ERL_COMPILE_FLAGS += +inline +warn_exported_vars +warn_unused_import +warn_missi debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/flow/Makefile b/lib/hipe/flow/Makefile index 5b9d0b7582..91dcfda6f5 100644 --- a/lib/hipe/flow/Makefile +++ b/lib/hipe/flow/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -73,7 +73,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/icode/Makefile b/lib/hipe/icode/Makefile index de37c4e4c4..eced90b0ec 100644 --- a/lib/hipe/icode/Makefile +++ b/lib/hipe/icode/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -91,7 +91,10 @@ ERL_COMPILE_FLAGS += +warn_unused_import +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/main/Makefile b/lib/hipe/main/Makefile index 0ac522b1b2..a14c9c3ca4 100644 --- a/lib/hipe/main/Makefile +++ b/lib/hipe/main/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -83,7 +83,11 @@ $(EBIN)/hipe_main.beam: hipe.hrl ../icode/hipe_icode.hrl #../rtl/hipe_rtl.hrl debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. + +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) $(DOC_FILES) $(HRL_FILES) diff --git a/lib/hipe/misc/Makefile b/lib/hipe/misc/Makefile index d5c395855a..98a69d62c7 100644 --- a/lib/hipe/misc/Makefile +++ b/lib/hipe/misc/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -76,7 +76,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/opt/Makefile b/lib/hipe/opt/Makefile index 972cf63944..74fde26c0b 100644 --- a/lib/hipe/opt/Makefile +++ b/lib/hipe/opt/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -71,7 +71,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/ppc/Makefile b/lib/hipe/ppc/Makefile index 0857043527..f24139e34b 100644 --- a/lib/hipe/ppc/Makefile +++ b/lib/hipe/ppc/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2004-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2004-2010. 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% # @@ -83,7 +83,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/regalloc/Makefile b/lib/hipe/regalloc/Makefile index 5ab70d1837..386f3589c6 100644 --- a/lib/hipe/regalloc/Makefile +++ b/lib/hipe/regalloc/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -84,7 +84,11 @@ ERL_COMPILE_FLAGS += +warn_exported_vars# +warn_missing_spec +warn_untyped_recor debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. + +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/sparc/Makefile b/lib/hipe/sparc/Makefile index efd4996046..f25212a89b 100644 --- a/lib/hipe/sparc/Makefile +++ b/lib/hipe/sparc/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -83,7 +83,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/tools/Makefile b/lib/hipe/tools/Makefile index 6ce5cb1b8b..0eaa3a7b05 100644 --- a/lib/hipe/tools/Makefile +++ b/lib/hipe/tools/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2002-2010. 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% # @@ -72,7 +72,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/util/Makefile b/lib/hipe/util/Makefile index 27cacedf11..85719ec3d6 100644 --- a/lib/hipe/util/Makefile +++ b/lib/hipe/util/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -76,7 +76,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars +warn_missing_spec +warn_untyped_record debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/hipe/x86/Makefile b/lib/hipe/x86/Makefile index 065b56fce3..d7d0c7bf5a 100644 --- a/lib/hipe/x86/Makefile +++ b/lib/hipe/x86/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. 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% # @@ -91,7 +91,10 @@ ERL_COMPILE_FLAGS += +warn_exported_vars debug opt: $(TARGET_FILES) -docs: $(DOC_FILES) +docs: + +# Moved docs target to edocs so the standard docs rule work properly. +edocs: $(DOC_FILES) clean: rm -f $(TARGET_FILES) diff --git a/lib/jinterface/doc/src/Makefile b/lib/jinterface/doc/src/Makefile index c4cfde0e9c..acd5307dee 100644 --- a/lib/jinterface/doc/src/Makefile +++ b/lib/jinterface/doc/src/Makefile @@ -2,20 +2,20 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2000-2010. 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% # include $(ERL_TOP)/make/target.mk @@ -53,6 +53,9 @@ XML_CHAPTER_FILES = \ BOOK_FILES = book.xml +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + GIF_FILES = \ notes.gif \ ref_man.gif \ diff --git a/lib/odbc/doc/src/Makefile b/lib/odbc/doc/src/Makefile index 136ddfb980..e2f09733d0 100644 --- a/lib/odbc/doc/src/Makefile +++ b/lib/odbc/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1999-2010. 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% # @@ -63,6 +63,9 @@ XML_CHAPTER_FILES = \ BOOK_FILES = book.xml +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + GIF_FILES = \ book.gif \ odbc.gif \ diff --git a/lib/percept/doc/src/Makefile b/lib/percept/doc/src/Makefile index c841d17c01..f0d43c5a01 100644 --- a/lib/percept/doc/src/Makefile +++ b/lib/percept/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2007-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2007-2010. 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% # @@ -153,10 +153,10 @@ gifs: $(GIF_FILES:%=$(HTMLDIR)/%) xml: $(MODULE_XML_FILES) $(PERCEPT_XML_FILES): - docb_gen $(PERCEPT_DIR)/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(PERCEPT_DIR)/$(@:%.xml=%.erl) $(RUNTIME_TOOLS_XML_FILES): - docb_gen $(RUNTIME_TOOLS_DIR)/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(RUNTIME_TOOLS_DIR)/$(@:%.xml=%.erl) info: @echo "XML_PART_FILES: $(XML_PART_FILES)" diff --git a/lib/reltool/test/Makefile b/lib/reltool/test/Makefile new file mode 100644 index 0000000000..00d2add3e5 --- /dev/null +++ b/lib/reltool/test/Makefile @@ -0,0 +1,82 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 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% + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + rtt \ + reltool_wx_SUITE \ + reltool_server_SUITE \ + reltool_test_lib + + +ERL_FILES= $(MODULES:%=%.erl) + +HRL_FILES= reltool_test_lib.hrl + +TARGET_FILES= \ + $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + +INSTALL_PROGS= $(TARGET_FILES) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/reltool_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +#ERL_COMPILE_FLAGS += + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +tests debug opt: $(TARGET_FILES) + +clean: + rm -f $(TARGET_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: opt + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) reltool.spec $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_PROGRAM) rtt $(INSTALL_PROGS) $(RELSYSDIR) +# chmod -f -R u+w $(RELSYSDIR) +# @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) + +release_docs_spec: + + diff --git a/lib/reltool/test/README b/lib/reltool/test/README new file mode 100644 index 0000000000..031bd2c961 --- /dev/null +++ b/lib/reltool/test/README @@ -0,0 +1,30 @@ + +Testing and running reltool tests. + +Testing gui api/applications can be hard, but we can at least +test that wxerlang behaves as we expected, i.e. that the api +is consistent and that it don't crash. + +The tests are structured as they are because we want you to +be able to run them in three different ways. + - direct via an erlang shell + - via common_test application + - via erlang/OTP inhouse ts tool. + +To run all the tests compile them and on unix +run ./rtt to create an erlang terminal. + +Invoke rtt:t(). in the erlang shell to run all regression tests. +If you want to specific tests invoke rtt:t(Module) +or rtt:t(Module, TestCase). + +To run all tests including the ones that require manual intervention run. +rtt:t(all, [{user,true}]). + +To see every test_case window use +rtt:t(all, [{user,step}]). +This requires that you manually close each window to step to the +next test_case. + +If you want to run specific test_cases use: +rtt:t({Module,TestCase}, [{user,step}]). diff --git a/lib/reltool/test/reltool.spec b/lib/reltool/test/reltool.spec new file mode 100644 index 0000000000..252232e09d --- /dev/null +++ b/lib/reltool/test/reltool.spec @@ -0,0 +1,2 @@ +{topcase, {dir, "../reltool_test"}}. + diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl new file mode 100644 index 0000000000..cf951191a0 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -0,0 +1,494 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% + +-module(reltool_server_SUITE). + +-export([all/0, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). + +-compile(export_all). + +-include("reltool_test_lib.hrl"). + +-define(NODE_NAME, '__RELTOOL__TEMPORARY_TEST__NODE__'). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Initialization functions. + +init_per_suite(Config) -> + reltool_test_lib:init_per_suite(Config). + +end_per_suite(Config) -> + reltool_test_lib:end_per_suite(Config). + +init_per_testcase(Func,Config) -> + reltool_test_lib:init_per_testcase(Func,Config). +end_per_testcase(Func,Config) -> + reltool_test_lib:end_per_testcase(Func,Config). +fin_per_testcase(Func,Config) -> %% For test_server + reltool_test_lib:end_per_testcase(Func,Config). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% SUITE specification + +all() -> + all(suite). +all(suite) -> + [ + start_server, + set_config, + create_release, + create_script, + create_target, + create_embedded, + create_standalone, + create_old_target + ]. + +%% The test cases + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Start a server process and check that it does not crash + +start_server(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +start_server(_Config) -> + {ok, Pid} = ?msym({ok, _}, reltool:start_server([])), + Libs = lists:sort(erl_libs()), + StrippedDefault = + case Libs of + [] -> {sys, []}; + _ -> {sys, [{lib_dirs, Libs}]} + end, + ?m({ok, StrippedDefault}, reltool:get_config(Pid)), + ?m(ok, reltool:stop(Pid)), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Start a server process and check that it does not crash + +set_config(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +set_config(_Config) -> + Libs = lists:sort(erl_libs()), + Default = + {sys, + [ + {mod_cond, all}, + {incl_cond, derived}, + {root_dir, code:root_dir()}, + {lib_dirs, Libs} + ]}, + {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Default}])), + StrippedDefault = + case Libs of + [] -> {sys, []}; + _ -> {sys, [{lib_dirs, Libs}]} + end, + ?m({ok, StrippedDefault}, reltool:get_config(Pid)), + + ?m(ok, reltool:stop(Pid)), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate releases + +create_release(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_release(_Config) -> + %% Configure the server + RelName = "Just testing...", + RelVsn = "1.0", + Config = + {sys, + [ + {lib_dirs, []}, + {boot_rel, RelName}, + {rel, RelName, RelVsn, [kernel, stdlib]} + ]}, + %% Generate release + ErtsVsn = erlang:system_info(version), + Apps = application:loaded_applications(), + {value, {_, _, KernelVsn}} = lists:keysearch(kernel, 1, Apps), + {value, {_, _, StdlibVsn}} = lists:keysearch(stdlib, 1, Apps), + Rel = {release, {RelName, RelVsn}, + {erts, ErtsVsn}, + [{kernel, KernelVsn}, + {stdlib, StdlibVsn}]}, + ?m({ok, Rel}, reltool:get_rel([{config, Config}], RelName)), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate boot scripts + +create_script(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_script(_Config) -> + %% Configure the server + RelName = "Just testing", + RelVsn = "1.0", + Config = + {sys, + [ + {lib_dirs, []}, + {boot_rel, RelName}, + {rel, RelName, RelVsn, [stdlib, kernel]} + ]}, + {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Config}])), + + %% Generate release file + ErtsVsn = erlang:system_info(version), + Apps = application:loaded_applications(), + {value, {_, _, KernelVsn}} = lists:keysearch(kernel, 1, Apps), + {value, {_, _, StdlibVsn}} = lists:keysearch(stdlib, 1, Apps), + Rel = {release, + {RelName, RelVsn}, + {erts, ErtsVsn}, + [{stdlib, StdlibVsn}, {kernel, KernelVsn}]}, + ?m({ok, Rel}, reltool:get_rel(Pid, RelName)), + RelFile = RelName ++ ".rel", + ?m(ok, file:write_file(RelFile, io_lib:format("~p.\n", [Rel]))), + + %% Generate script file + ?m(ok, systools:make_script(RelName, [])), + ScriptFile = RelName ++ ".script", + {ok, [OrigScript]} = ?msym({ok, [_]}, file:consult(ScriptFile)), + {ok, Script} = ?msym({ok, _}, reltool:get_script(Pid, RelName)), + %% OrigScript2 = sort_script(OrigScript), + %% Script2 = sort_script(Script), + %% ?m(OrigScript2, Script2), + + ?m(equal, diff_script(OrigScript, Script)), + + %% Stop server + ?m(ok, reltool:stop(Pid)), + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate target system + +create_target(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_target(_Config) -> + %% Configure the server + RelName1 = "Just testing", + RelName2 = "Just testing with SASL", + RelVsn = "1.0", + Config = + {sys, + [ + {root_dir, code:root_dir()}, + {lib_dirs, []}, + {boot_rel, RelName2}, + {rel, RelName1, RelVsn, [stdlib, kernel]}, + {rel, RelName2, RelVsn, [sasl, stdlib, kernel]}, + {app, sasl, [{incl_cond, include}]} + ]}, + + %% Generate target file + TargetDir = "reltool_target_dir_development", + ?m(ok, reltool_utils:recursive_delete(TargetDir)), + ?m(ok, file:make_dir(TargetDir)), + ?m(ok, reltool:create_target([{config, Config}], TargetDir)), + + Erl = filename:join([TargetDir, "bin", "erl"]), + {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)), + ?msym(ok, stop_node(Node)), + + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate embedded target system + +create_embedded(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_embedded(_Config) -> + %% Configure the server + RelName1 = "Just testing", + RelName2 = "Just testing with SASL", + RelVsn = "1.0", + Config = + {sys, + [ + {lib_dirs, []}, + {profile, embedded}, + {boot_rel, RelName2}, + {rel, RelName1, RelVsn, [stdlib, kernel]}, + {rel, RelName2, RelVsn, [sasl, stdlib, kernel]}, + {app, sasl, [{incl_cond, include}]} + ]}, + + %% Generate target file + TargetDir = "reltool_target_dir_embedded", + ?m(ok, reltool_utils:recursive_delete(TargetDir)), + ?m(ok, file:make_dir(TargetDir)), + ?m(ok, reltool:create_target([{config, Config}], TargetDir)), + + Erl = filename:join([TargetDir, "bin", "erl"]), + {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)), + ?msym(ok, stop_node(Node)), + + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate standalone system + +create_standalone(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_standalone(_Config) -> + %% Configure the server + ExDir = code:lib_dir(reltool, examples), + EscriptName = "display_args", + Escript = filename:join([ExDir, EscriptName]), + Config = + {sys, + [ + {lib_dirs, []}, + {escript, Escript, [{incl_cond, include}]}, + {profile, standalone} + ]}, + + %% Generate target file + TargetDir = "reltool_target_dir_standalone", + ?m(ok, reltool_utils:recursive_delete(TargetDir)), + ?m(ok, file:make_dir(TargetDir)), + ?m(ok, reltool:create_target([{config, Config}], TargetDir)), + + BinDir = filename:join([TargetDir, "bin"]), + Erl = filename:join([BinDir, "erl"]), + {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)), + RootDir = ?ignore(rpc:call(Node, code, root_dir, [])), + ?msym(ok, stop_node(Node)), + + Expected = iolist_to_binary(["Root dir: ", RootDir, "\n" + "Script args: [\"-arg1\",\"arg2\",\"arg3\"]\n", + "Smp: false\n", + "ExitCode:0"]), + io:format("Expected: ~s\n", [Expected]), + ?m(Expected, run(BinDir, EscriptName ++ " -arg1 arg2 arg3")), + + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generate old type of target system + +create_old_target(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +create_old_target(_Config) -> + %% Configure the server + RelName1 = "Just testing", + RelName2 = "Just testing with SASL", + RelVsn = "1.0", + Config = + {sys, + [ + {lib_dirs, []}, + {boot_rel, RelName2}, + {rel, RelName1, RelVsn, [stdlib, kernel]}, + {rel, RelName2, RelVsn, [sasl, stdlib, kernel]}, + {relocatable, false}, % Implies explicit old style installation + {app, sasl, [{incl_cond, include}]} + ]}, + + %% Generate target file + TargetDir = "reltool_target_dir_old", + ?m(ok, reltool_utils:recursive_delete(TargetDir)), + ?m(ok, file:make_dir(TargetDir)), + ?m(ok, reltool:create_target([{config, Config}], TargetDir)), + + %% io:format("Will fail on Windows (should patch erl.ini)\n", []), + ?m(ok, reltool:install(RelName2, TargetDir)), + + Erl = filename:join([TargetDir, "bin", "erl"]), + {ok, Node} = ?msym({ok, _}, start_node(?NODE_NAME, Erl)), + ?msym(ok, stop_node(Node)), + + ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Library functions + +erl_libs() -> + case os:getenv("ERL_LIBS") of + false -> []; + LibStr -> string:tokens(LibStr, ":;") + end. + +diff_script(Script, Script) -> + equal; +diff_script({script, Rel, Commands1}, {script, Rel, Commands2}) -> + diff_cmds(Commands1, Commands2); +diff_script({script, Rel1, _}, {script, Rel2, _}) -> + {error, {Rel1, Rel2}}. + +diff_cmds([Cmd | Commands1], [Cmd | Commands2]) -> + diff_cmds(Commands1, Commands2); +diff_cmds([Cmd1 | _Commands1], [Cmd2 | _Commands2]) -> + {diff, {expected, Cmd1}, {actual, Cmd2}}; +diff_cmds([], []) -> + equal. + +os_cmd(Cmd) when is_list(Cmd) -> + %% Call the plain os:cmd with an echo command appended to print command status + %% io:format("os:cmd(~p).\n", [Cmd]), + case os:cmd(Cmd++";echo \"#$?\"") of + %% There is (as far as I can tell) only one thing that will match this + %% and that is too silly to ever be used, but... + []-> + {99, []}; + Return-> + %% Find the position of the status code wich is last in the string + %% prepended with # + case string:rchr(Return, $#) of + + %% This happens only if the sh command pipe is somehow interrupted + 0-> + {98, Return}; + + Position-> + Result = string:left(Return,Position - 1), + Status = string:substr(Return,Position + 1, length(Return) - Position - 1), + {list_to_integer(Status), Result} + end + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Node handling + +start_node(Name, ErlPath) -> + FullName = full_node_name(Name), + CmdLine = mk_node_cmdline(Name, ErlPath), + io:format("Starting node ~p: ~s~n", [FullName, CmdLine]), + case open_port({spawn, CmdLine}, []) of + Port when is_port(Port) -> + unlink(Port), + erlang:port_close(Port), + case ping_node(FullName, 50) of + ok -> {ok, FullName}; + Other -> exit({failed_to_start_node, FullName, Other}) + end; + Error -> + exit({failed_to_start_node, FullName, Error}) + end. + +stop_node(Node) -> + monitor_node(Node, true), + spawn(Node, fun () -> halt() end), + receive {nodedown, Node} -> ok end. + +mk_node_cmdline(Name) -> + Prog = case catch init:get_argument(progname) of + {ok,[[P]]} -> P; + _ -> exit(no_progname_argument_found) + end, + mk_node_cmdline(Name, Prog). + +mk_node_cmdline(Name, Prog) -> + Static = "-detached -noinput", + Pa = filename:dirname(code:which(?MODULE)), + NameSw = case net_kernel:longnames() of + false -> "-sname "; + true -> "-name "; + _ -> exit(not_distributed_node) + end, + {ok, Pwd} = file:get_cwd(), + NameStr = atom_to_list(Name), + Prog ++ " " + ++ Static ++ " " + ++ NameSw ++ " " ++ NameStr ++ " " + ++ "-pa " ++ Pa ++ " " + ++ "-env ERL_CRASH_DUMP " ++ Pwd ++ "/erl_crash_dump." ++ NameStr ++ " " + ++ "-setcookie " ++ atom_to_list(erlang:get_cookie()). + +full_node_name(PreName) -> + HostSuffix = lists:dropwhile(fun ($@) -> false; (_) -> true end, + atom_to_list(node())), + list_to_atom(atom_to_list(PreName) ++ HostSuffix). + +ping_node(_Node, 0) -> + {error, net_adm}; +ping_node(Node, N) when is_integer(N), N > 0 -> + case catch net_adm:ping(Node) of + pong -> + wait_for_process(Node, code_server, 50); + _ -> + timer:sleep(1000), + ping_node(Node, N-1) + end. + +wait_for_process(_Node, Name, 0) -> + {error, Name}; +wait_for_process(Node, Name, N) when is_integer(N), N > 0 -> + case rpc:call(Node, erlang, whereis, [Name]) of + undefined -> + timer:sleep(1000), + wait_for_process(Node, Name, N-1); + {badrpc, _} = Reason -> + erlang:error({Reason, Node}); + Pid when is_pid(Pid) -> + ok + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Run escript + +run(Dir, Cmd0) -> + Cmd = case os:type() of + {win32,_} -> filename:nativename(Dir) ++ "\\" ++ Cmd0; + _ -> Cmd0 + end, + do_run(Dir, Cmd). + +run(Dir, Opts, Cmd0) -> + Cmd = case os:type() of + {win32,_} -> Opts ++ " " ++ filename:nativename(Dir) ++ "\\" ++ Cmd0; + _ -> Opts ++ " " ++ Dir ++ "/" ++ Cmd0 + end, + do_run(Dir, Cmd). + +do_run(Dir, Cmd) -> + io:format("Run: ~p\n", [Cmd]), + Env = [{"PATH",Dir++":"++os:getenv("PATH")}], + Port = open_port({spawn,Cmd}, [exit_status,eof,in,{env,Env}]), + Res = get_data(Port, []), + receive + {Port,{exit_status,ExitCode}} -> + iolist_to_binary([Res,"ExitCode:"++integer_to_list(ExitCode)]) + end. + +get_data(Port, SoFar) -> + receive + {Port,{data,Bytes}} -> + get_data(Port, [SoFar|Bytes]); + {Port,eof} -> + erlang:port_close(Port), + SoFar + end. + +expected_output([data_dir|T], Data) -> + Slash = case os:type() of + {win32,_} -> "\\"; + _ -> "/" + end, + [filename:nativename(Data)++Slash|expected_output(T, Data)]; +expected_output([H|T], Data) -> + [H|expected_output(T, Data)]; +expected_output([], _) -> + []; +expected_output(Bin, _) when is_binary(Bin) -> + Bin. diff --git a/lib/reltool/test/reltool_test_lib.erl b/lib/reltool/test/reltool_test_lib.erl new file mode 100644 index 0000000000..25978294ee --- /dev/null +++ b/lib/reltool/test/reltool_test_lib.erl @@ -0,0 +1,329 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% + +-module(reltool_test_lib). +-compile(export_all). + +-include("reltool_test_lib.hrl"). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +init_per_suite(Config) when is_list(Config)-> + incr_timetrap(Config, 5). + +end_per_suite(Config) when is_list(Config)-> + ok. + +incr_timetrap(Config, Times) -> + Key = tc_timeout, + KeyPos = 1, + NewTime = + case lists:keysearch(Key, KeyPos, Config) of + {value, {Key, OldTime}} -> + (timer:minutes(1) + OldTime) * Times; + false -> + timer:minutes(1) * Times + end, + lists:keystore(Key, KeyPos, Config, {Key, NewTime}). + +set_kill_timer(Config) -> + case init:get_argument(reltool_test_timeout) of + {ok, _} -> + Config; + _ -> + Time = + case lookup_config(tc_timeout, Config) of + [] -> + timer:minutes(5); + ConfigTime when is_integer(ConfigTime) -> + ConfigTime + end, + WatchDog = test_server:timetrap(Time), + [{kill_timer, WatchDog} | Config] + end. + +reset_kill_timer(Config) -> + DogKiller = + case get(reltool_test_server) of + true -> + fun(P) when is_pid(P) -> P ! stop; + (_) -> ok + end; + _ -> + fun(Ref) -> test_server:timetrap_cancel(Ref) end + end, + case lists:keysearch(kill_timer, 1, Config) of + {value, {kill_timer, WatchDog}} -> + DogKiller(WatchDog), + lists:keydelete(kill_timer, 1, Config); + _ -> + Config + end. + +lookup_config(Key,Config) -> + case lists:keysearch(Key, 1, Config) of + {value,{Key,Val}} -> + Val; + _ -> + [] + end. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +wx_init_per_suite(Config) -> + {_Pid, Ref} = + spawn_monitor(fun() -> + %% Avoid test case crash if wx master process dies + process_flag(trap_exit, true), + try + case os:type() of + {unix,darwin} -> + exit({skipped, "Can not test on MacOSX"}); + {unix, _} -> + io:format("DISPLAY ~s~n", [os:getenv("DISPLAY")]), + case proplists:get_value(xserver, Config, none) of + none -> ignore; + Server -> os:putenv("DISPLAY", Server) + end; + _ -> + ignore + end, + wx:new(), + wx:destroy() + catch + error:undef -> + exit({skipped, "No wx compiled for this platform"}); + _:Reason -> + exit({skipped, lists:flatten(io_lib:format("Start wx failed: ~p", [Reason]))}) + end, + exit(normal) + end), + receive + {'DOWN', Ref, _, _, normal} -> + init_per_suite(Config); + {'DOWN', Ref, _, _, {skipped, _} = Skipped} -> + Skipped; + {'DOWN', Ref, _, _, Reason} -> + exit({wx_init_per_suite, Reason}) + after timer:minutes(1) -> + exit({wx_init_per_suite, timeout}) + end. + +wx_end_per_suite(Config) -> + end_per_suite(Config). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +init_per_testcase(_Func, Config) when is_list(Config) -> + set_kill_timer(Config), + global:register_name(reltool_global_logger, group_leader()), + Config. + +end_per_testcase(_Func, Config) when is_list(Config) -> + global:unregister_name(reltool_global_logger), + reset_kill_timer(Config), + Config. + +%% Backwards compatible with test_server +tc_info(suite) -> []; +tc_info(doc) -> "". + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Use ?log(Format, Args) as wrapper +log(Format, Args, LongFile, Line) -> + File = filename:basename(LongFile), + Format2 = lists:concat([File, "(", Line, ")", ": ", Format]), + log(Format2, Args). + +log(Format, Args) -> + case global:whereis_name(reltool_global_logger) of + undefined -> + io:format(user, Format, Args); + Pid -> + io:format(Pid, Format, Args) + end. + +verbose(Format, Args, File, Line) -> + Arg = reltool_test_verbose, + case get(Arg) of + false -> + ok; + true -> + log(Format, Args, File, Line); + undefined -> + case init:get_argument(Arg) of + {ok, List} when is_list(List) -> + case lists:last(List) of + ["true"] -> + put(Arg, true), + log(Format, Args, File, Line); + _ -> + put(Arg, false), + ok + end; + _ -> + put(Arg, false), + ok + end + end. + +error(Format, Args, File, Line) -> + global:send(reltool_global_logger, {failed, File, Line}), + Fail = {filename:basename(File),Line,Args}, + case global:whereis_name(reltool_test_case_sup) of + undefined -> ignore; + Pid -> Pid ! Fail + %% global:send(reltool_test_case_sup, Fail), + end, + log("~n" ++ Format, Args, File, Line). + + +pick_msg() -> + receive + Message -> Message + after 4000 -> timeout + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Utility functions + +user_available(Config) -> + false /= proplists:get_value(user, Config, false). + + +wx_destroy(Frame, Config) -> + case proplists:get_value(user, Config, false) of + false -> + timer:sleep(100), + ?m(ok, wxFrame:destroy(Frame)), + ?m(ok, wx:destroy()); + true -> + timer:sleep(500), + ?m(ok, wxFrame:destroy(Frame)), + ?m(ok, wx:destroy()); + step -> %% Wait for user to close window + ?m(ok, wxEvtHandler:connect(Frame, close_window, [{skip,true}])), + wait_for_close() + end. + +wait_for_close() -> + receive + #wx{event=#wxClose{}} -> + ?log("Got close~n",[]), + ?m(ok, wx:destroy()); + #wx{obj=Obj, event=Event} -> + try + Name = wxTopLevelWindow:getTitle(Obj), + ?log("~p Event: ~p~n", [Name, Event]) + catch _:_ -> + ?log("Event: ~p~n", [Event]) + end, + wait_for_close(); + Other -> + ?log("Unexpected: ~p~n", [Other]), + wait_for_close() + end. + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% A small test server, which can be run standalone in a shell + +run_test(Test = {_,_},Config) -> + run_test([Test],Config); +run_test([{Module, TC} | Rest], Config) -> + log("\n\n=== Eval test suite: ~w ===~n", [Module]), + case catch Module:init_per_suite(Config) of + {skipped, Reason} -> + log("Test suite skipped: ~s~n", [Reason]), + [{skipped, Reason}]; + NewConfig when is_list(NewConfig) -> + Res = + if + TC =:= all -> + [do_run_test(Module, Test, NewConfig) || Test <- Module:all()]; + is_list(TC) -> + [do_run_test(Module, Test, NewConfig) || Test <- TC]; + true -> + [do_run_test(Module, TC, NewConfig)] + end, + Module:end_per_suite(NewConfig), + Res ++ run_test(Rest, NewConfig); + Error -> + ?error("Test suite skipped: ~w~n", [Error]), + [{skipped, Error}] + end; +run_test([], _Config) -> + []. + +do_run_test(Module, all, Config) -> + All = [{Module, Test} || Test <- Module:all()], + run_test(All, Config); +do_run_test(Module, TestCase, Config) -> + log("Eval test case: ~w~n", [{Module, TestCase}]), + Sec = timer:seconds(1) * 1000, + {T, Res} = + timer:tc(?MODULE, eval_test_case, [Module, TestCase, Config]), + log("Tested ~w in ~w sec~n", [TestCase, T div Sec]), + {T div Sec, Res}. + +eval_test_case(Mod, Fun, Config) -> + flush(), + global:register_name(reltool_test_case_sup, self()), + Flag = process_flag(trap_exit, true), + Pid = spawn_link(?MODULE, test_case_evaluator, [Mod, Fun, [Config]]), + R = wait_for_evaluator(Pid, Mod, Fun, Config), + global:unregister_name(reltool_test_case_sup), + process_flag(trap_exit, Flag), + R. + +test_case_evaluator(Mod, Fun, [Config]) -> + NewConfig = Mod:init_per_testcase(Fun, Config), + R = apply(Mod, Fun, [NewConfig]), + Mod:fin_per_testcase(Fun, NewConfig), + exit({test_case_ok, R}). + +wait_for_evaluator(Pid, Mod, Fun, Config) -> + receive + {'EXIT', Pid, {test_case_ok, _PidRes}} -> + Errors = flush(), + Res = + case Errors of + [] -> ok; + Errors -> failed + end, + {Res, {Mod, Fun}, Errors}; + {'EXIT', Pid, {skipped, Reason}} -> + log(" Test case ~w skipped, because ~p~n", + [{Mod, Fun}, Reason]), + Mod:fin_per_testcase(Fun, Config), + {skip, {Mod, Fun}, Reason}; + {'EXIT', Pid, Reason} -> + log(" Eval process ~w exited, because\n\t~p~n", + [{Mod, Fun}, Reason]), + Mod:fin_per_testcase(Fun, Config), + {crash, {Mod, Fun}, Reason} + end. + +flush() -> + receive Msg -> [Msg | flush()] + after 0 -> [] + end. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/reltool/test/reltool_test_lib.hrl b/lib/reltool/test/reltool_test_lib.hrl new file mode 100644 index 0000000000..93134144ea --- /dev/null +++ b/lib/reltool/test/reltool_test_lib.hrl @@ -0,0 +1,91 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% + +-include_lib("wx/include/wx.hrl"). + +-define(log(Format,Args), reltool_test_lib:log(Format,Args,?FILE,?LINE)). +-define(warning(Format,Args), ?log("\n " ++ Format,Args)). +-define(error(Format,Args), reltool_test_lib:error(Format,Args,?FILE,?LINE)). +-define(verbose(Format,Args), reltool_test_lib:verbose(Format,Args,?FILE,?LINE)). + +-define(fatal(Format,Args), + ?error(Format, Args), + exit({test_case_fatal, Format, Args, ?FILE, ?LINE})). + +-define(skip(Format,Args), + ?warning(Format, Args), + exit({skipped, ?flat_format(Format, Args)})). + +-define(ignore(Expr), + fun() -> + AcTuAlReS = (catch (Expr)), + ?verbose("ok: ~p\n",[AcTuAlReS]), + AcTuAlReS + end()). + +-define(msym(ExpectedRes, Expr), + fun() -> + AcTuAlReS = (catch (Expr)), + case AcTuAlReS of + ExpectedRes -> + ?verbose("ok: ~p\n",[AcTuAlReS]), + AcTuAlReS; + _ -> + reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~s\n", + [AcTuAlReS, ??ExpectedRes], + ?FILE, ?LINE), + AcTuAlReS + end + end()). + +-define(m(ExpectedRes, Expr), + fun() -> + AcTuAlReS = (catch (Expr)), + case AcTuAlReS of + ExpectedRes -> + ?verbose("ok: ~p\n",[AcTuAlReS]), + AcTuAlReS; + _ -> + reltool_test_lib:error("Not matching actual result was:\n\t~p \nExpected:\n\t~p\n", + [AcTuAlReS, ExpectedRes], + ?FILE, ?LINE), + AcTuAlReS + end + end()). + +-define(m_receive(ExpectedMsg), + ?m(ExpectedMsg,reltool_test_lib:pick_msg())). + +-define(m_multi_receive(ExpectedMsgs), + fun() -> + TmPeXpCtEdMsGs = lists:sort(ExpectedMsgs), + AcTuAlReS = + lists:sort(lists:map(fun(_) -> + reltool_test_lib:pick_msg() + end, TmPeXpCtEdMsGs)), + case AcTuAlReS of + TmPeXpCtEdMsGs -> + ?verbose("ok: ~p\n",[AcTuAlReS]), + AcTuAlReS; + _ -> + reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~p\n", + [AcTuAlReS, ExpectedMsgs], + ?FILE, ?LINE), + AcTuAlReS + end + end()). diff --git a/lib/reltool/test/reltool_wx_SUITE.erl b/lib/reltool/test/reltool_wx_SUITE.erl new file mode 100644 index 0000000000..2e2b355e07 --- /dev/null +++ b/lib/reltool/test/reltool_wx_SUITE.erl @@ -0,0 +1,62 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% + +-module(reltool_wx_SUITE). + +-export([all/0, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]). + +-compile(export_all). + +-include("reltool_test_lib.hrl"). + +%% Initialization functions. +init_per_suite(Config) -> + reltool_test_lib:wx_init_per_suite(Config). + +end_per_suite(Config) -> + reltool_test_lib:wx_end_per_suite(Config). + +init_per_testcase(Func,Config) -> + reltool_test_lib:init_per_testcase(Func,Config). +end_per_testcase(Func,Config) -> + reltool_test_lib:end_per_testcase(Func,Config). +fin_per_testcase(Func,Config) -> %% For test_server + reltool_test_lib:end_per_testcase(Func,Config). + +%% SUITE specification +all() -> + all(suite). +all(suite) -> + [ + start_all_windows + ]. + +%% The test cases + +%% Display all windows and see if something crashes +start_all_windows(TestInfo) when is_atom(TestInfo) -> + reltool_test_lib:tc_info(TestInfo); +start_all_windows(_Config) -> + {ok, SysPid} = ?msym({ok, _}, reltool:start([{trap_exit, false}])), + {ok, AppPid} = ?msym({ok, _}, reltool_sys_win:open_app(SysPid, stdlib)), + ?msym({ok, _}, reltool_app_win:open_mod(AppPid, escript)), + timer:sleep(timer:seconds(10)), + ?m(ok, reltool:stop(SysPid)), + + ok. diff --git a/lib/reltool/test/rtt b/lib/reltool/test/rtt new file mode 100755 index 0000000000..2411195338 --- /dev/null +++ b/lib/reltool/test/rtt @@ -0,0 +1,55 @@ +#! /bin/sh -f +# %CopyrightBegin% +# +# Copyright Ericsson AB 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% + +# Usage: rtt [-cerl] + +emu=erl +while [ $# -gt 0 ]; do + case "$1" in + "-cerl") + shift + emu=cerl + ;; + *) + break + ;; + esac +done + +log=test_log_$$ +latest=test_log_latest +args=${1+"$@"} + +erlcmd="$emu -sname test_server -smp -pa ../../reltool/ebin $p $args -reltool_test_verbose true -reltool_test_timeout" + +echo "Give the following command in order to see the outcome:" +echo "" +echo " less $log" + +rm "$latest" 2>/dev/null +ln -s "$log" "$latest" +touch "$log" + +ostype=`uname -s` +if [ "$ostype" = "SunOS" ] ; then + /usr/openwin/bin/xterm -T "Testing reltool" -l -lf "$log" -e $erlcmd & +else + xterm -T "Testing reltool" -e script -f -c "$erlcmd" "$log" & +fi + +tail -f "$log" | egrep 'Eval||NYI' diff --git a/lib/reltool/test/rtt.erl b/lib/reltool/test/rtt.erl new file mode 100644 index 0000000000..6755b8400f --- /dev/null +++ b/lib/reltool/test/rtt.erl @@ -0,0 +1,154 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 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% + +-module(rtt). +-compile(export_all). + +%% Modules or suites can be shortcuts, for example server expands to reltool_server_SUITE. +%% +%% t(Tests) run reltool testcases. +%% Tests can be module, {module, test_case} or [module|{module,test_case}] + +t() -> + t(read_test_case()). +t(Test) -> + t(Test, []). + +t(Mod, TC) when is_atom(Mod), is_atom(TC) -> + t({Mod,TC}, []); +t(all, Config) when is_list(Config) -> + Fs = filelib:wildcard("reltool_*_SUITE.erl"), + t([list_to_atom(filename:rootname(File)) || File <- Fs], Config); +t(Test,Config) when is_list(Config) -> + Tests = resolve(Test), + write_test_case(Test), + Res = reltool_test_lib:run_test(Tests, Config), + append_test_case_info(Test, Res). + +user() -> + user(read_test_case()). +user(Mod) -> + t(Mod, [{user,step}]). +user(Mod,Tc) when is_atom(Tc) -> + t({Mod,Tc}, [{user,step}]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Resolves the name of test suites and test cases +%% according to the alias definitions. Single atoms +%% are assumed to be the name of a test suite. + +resolve(Suite0) when is_atom(Suite0) -> + case alias(Suite0) of + Suite when is_atom(Suite) -> + {Suite, all}; + {Suite, Case} -> + {Suite, Case} + end; +resolve({Suite0, Case}) when is_atom(Suite0), is_atom(Case) -> + case alias(Suite0) of + Suite when is_atom(Suite) -> + {Suite, Case}; + {Suite, Case2} -> + {Suite, Case2} + end; +resolve(List) when is_list(List) -> + [resolve(Case) || Case <- List]. + +alias(Suite) when is_atom(Suite) -> + Str = atom_to_list(Suite), + case {Str, lists:reverse(Str)} of + {"reltool" ++ _, "ETIUS" ++ _} -> + Suite; + _ -> + list_to_atom("reltool_" ++ Str ++ "_SUITE") + end. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +config_fname() -> + "reltool_test_case_config". + +%% Read default config file +read_config() -> + Fname = config_fname(), + reltool_test_lib:log("Consulting file ~s...~n", [Fname]), + case file:consult(Fname) of + {ok, Config} -> + reltool_test_lib:log("Read config ~w~n", [Config]), + Config; + _Error -> + Config = reltool_test_lib:default_config(), + reltool_test_lib:log("<>WARNING<> Using default config: ~w~n", [Config]), + Config + end. + +%% Write new default config file +write_config(Config) when is_list(Config) -> + Fname = config_fname(), + {ok, Fd} = file:open(Fname, write), + write_list(Fd, Config), + file:close(Fd). + +write_list(Fd, [H | T]) -> + ok = io:format(Fd, "~p.~n",[H]), + write_list(Fd, T); +write_list(_, []) -> + ok. + +test_case_fname() -> + "reltool_test_case_info". + +%% Read name of test case +read_test_case() -> + Fname = test_case_fname(), + case file:open(Fname, [read]) of + {ok, Fd} -> + Res = io:read(Fd, []), + file:close(Fd), + case Res of + {ok, TestCase} -> + reltool_test_lib:log("Using test case ~w from file ~s~n", + [TestCase, Fname]), + TestCase; + {error, _} -> + default_test_case(Fname) + end; + {error, _} -> + default_test_case(Fname) + end. + +default_test_case(Fname) -> + TestCase = all, + reltool_test_lib:log("<>WARNING<> Cannot read file ~s, " + "using default test case: ~w~n", + [Fname, TestCase]), + TestCase. + +write_test_case(TestCase) -> + Fname = test_case_fname(), + {ok, Fd} = file:open(Fname, write), + ok = io:format(Fd, "~p.~n",[TestCase]), + file:close(Fd). + +append_test_case_info(TestCase, TestCaseInfo) -> + Fname = test_case_fname(), + {ok, Fd} = file:open(Fname, [read, write]), + ok = io:format(Fd, "~p.~n",[TestCase]), + ok = io:format(Fd, "~p.~n",[TestCaseInfo]), + file:close(Fd), + TestCaseInfo. diff --git a/lib/stdlib/doc/src/beam_lib.xml b/lib/stdlib/doc/src/beam_lib.xml index f2a9c2a671..b9286f1402 100644 --- a/lib/stdlib/doc/src/beam_lib.xml +++ b/lib/stdlib/doc/src/beam_lib.xml @@ -4,7 +4,7 @@

        - 20002009 + 20002010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ 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. - + beam_lib @@ -70,82 +70,88 @@ using strip/1, strip_files/1 and/or strip_release/1.

        -

        Reconstructing source code

        -

        Here is an example of how to reconstruct source code from - the debug information in a BEAM file Beam:

        - +
        + Reconstructing source code +

        Here is an example of how to reconstruct source code from + the debug information in a BEAM file Beam:

        + {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(Beam,[abstract_code]). io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). -

        Encrypted debug information

        -

        The debug information can be encrypted in order to keep - the source code secret, but still being able to use tools such as - Xref or Debugger.

        -

        To use encrypted debug information, a key must be provided to - the compiler and beam_lib. The key is given as a string and - it is recommended that it contains at least 32 characters and - that both upper and lower case letters as well as digits and - special characters are used.

        -

        -

        The default type -- and currently the only type -- of crypto - algorithm is des3_cbc, three rounds of DES. The key string - will be scrambled using erlang:md5/1 to generate - the actual keys used for des3_cbc.

        - -

        As far as we know by the time of writing, it is - infeasible to break des3_cbc encryption without any - knowledge of the key. Therefore, as long as the key is kept - safe and is unguessable, the encrypted debug information - should be safe from intruders.

        -
        -

        There are two ways to provide the key:

        - - -

        Use the compiler option {debug_info,Key}, see - compile(3), - and the function - crypto_key_fun/1 - to register a fun which returns the key whenever - beam_lib needs to decrypt the debug information.

        -

        If no such fun is registered, beam_lib will instead - search for a .erlang.crypt file, see below.

        -
        - -

        Store the key in a text file named .erlang.crypt.

        -

        In this case, the compiler option encrypt_debug_info - can be used, see - compile(3).

        -
        -
        -

        .erlang.crypt

        -

        beam_lib searches for .erlang.crypt in the current - directory and then the home directory for the current user. If - the file is found and contains a key, beam_lib will - implicitly create a crypto key fun and register it.

        -

        The .erlang.crypt file should contain a single list of - tuples:

        - +
        +
        + Encrypted debug information +

        The debug information can be encrypted in order to keep + the source code secret, but still being able to use tools such as + Xref or Debugger.

        +

        To use encrypted debug information, a key must be provided to + the compiler and beam_lib. The key is given as a string and + it is recommended that it contains at least 32 characters and + that both upper and lower case letters as well as digits and + special characters are used.

        +

        +

        The default type -- and currently the only type -- of crypto + algorithm is des3_cbc, three rounds of DES. The key string + will be scrambled using erlang:md5/1 to generate + the actual keys used for des3_cbc.

        + +

        As far as we know by the time of writing, it is + infeasible to break des3_cbc encryption without any + knowledge of the key. Therefore, as long as the key is kept + safe and is unguessable, the encrypted debug information + should be safe from intruders.

        +
        +

        There are two ways to provide the key:

        + + +

        Use the compiler option {debug_info,Key}, see + compile(3), + and the function + crypto_key_fun/1 + to register a fun which returns the key whenever + beam_lib needs to decrypt the debug information.

        +

        If no such fun is registered, beam_lib will instead + search for a .erlang.crypt file, see below.

        +
        + +

        Store the key in a text file named .erlang.crypt.

        +

        In this case, the compiler option encrypt_debug_info + can be used, see + compile(3).

        +
        +
        +
        +
        + .erlang.crypt +

        beam_lib searches for .erlang.crypt in the current + directory and then the home directory for the current user. If + the file is found and contains a key, beam_lib will + implicitly create a crypto key fun and register it.

        +

        The .erlang.crypt file should contain a single list of + tuples:

        + {debug_info, Mode, Module, Key} -

        Mode is the type of crypto algorithm; currently, the only - allowed value thus is des3_cbc. Module is either an - atom, in which case Key will only be used for the module - Module, or [], in which case Key will be - used for all modules. Key is the non-empty key string.

        -

        The Key in the first tuple where both Mode and - Module matches will be used.

        -

        Here is an example of an .erlang.crypt file that returns - the same key for all modules:

        - Mode is the type of crypto algorithm; currently, the only + allowed value thus is des3_cbc. Module is either an + atom, in which case Key will only be used for the module + Module, or [], in which case Key will be + used for all modules. Key is the non-empty key string.

        +

        The Key in the first tuple where both Mode and + Module matches will be used.

        +

        Here is an example of an .erlang.crypt file that returns + the same key for all modules:

        + 7}|pc/DM6Cga*68$Mw]L#&_Gejr]G^"}].]]> -

        And here is a slightly more complicated example of an - .erlang.crypt which provides one key for the module - t, and another key for all other modules:

        - And here is a slightly more complicated example of an + .erlang.crypt which provides one key for the module + t, and another key for all other modules:

        + 7}|pc/DM6Cga*68$Mw]L#&_Gejr]G^"}].]]> - -

        Do not use any of the keys in these examples. Use your own - keys.

        -
        + +

        Do not use any of the keys in these examples. Use your own + keys.

        +
        +
        diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index c075f11792..6f9d979c9a 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -4,7 +4,7 @@
        - 19962009 + 19962010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ 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. - + io @@ -1003,7 +1003,8 @@ enter>bar. Standard Error

        In certain situations, especially when the standard output is redirected, access to an io_server() specific for error messages might be convenient. The io_device 'standard_error' can be used to direct output to whatever the current operating system considers a suitable device for error output. Example on a Unix-like operating system:

        -$ erl -noshell -noinput -eval 'io:format(standard_error,"Error: ~s~n",["error 11"]),init:stop().' > /dev/null
        +$ erl -noshell -noinput -eval 'io:format(standard_error,"Error: ~s~n",["error 11"]),'\
        +'init:stop().' > /dev/null
         Error: error 11
        diff --git a/lib/stdlib/doc/src/unicode.xml b/lib/stdlib/doc/src/unicode.xml index b3aad51591..60edd8ade9 100644 --- a/lib/stdlib/doc/src/unicode.xml +++ b/lib/stdlib/doc/src/unicode.xml @@ -51,7 +51,9 @@ charlist() = [unicode_char() | unicode_binary() | charlist()] a unicode_binary is allowed as the tail of the list
        -external_unicode_binary() = binary() with characters coded in a user specified Unicode encoding other than UTF-8 (UTF-16 or UTF-32) +external_unicode_binary() = binary() + with characters coded in a user specified Unicode encoding other + than UTF-8 (UTF-16 or UTF-32) external_chardata() = external_charlist() | external_unicode_binary() diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml index 06347b3aae..c5bf10b63d 100644 --- a/lib/stdlib/doc/src/unicode_usage.xml +++ b/lib/stdlib/doc/src/unicode_usage.xml @@ -76,7 +76,8 @@ charlist() = [unicode_char() | unicode_binary() | charlist()] a unicode_binary is allowed as the tail of the list

        The module unicode in stdlib even supports similar mixes with binaries containing other encodings than UTF-8, but that is a special case to allow for conversions to and from external data:

        -external_unicode_binary() = binary() with characters coded in a user specified Unicode encoding other than UTF-8 (UTF-16 or UTF-32) +external_unicode_binary() = binary() with characters coded in a user specified Unicode + encoding other than UTF-8 (UTF-16 or UTF-32) external_chardata() = external_charlist() | external_unicode_binary() @@ -93,7 +94,8 @@ external_charlist() = [unicode_char() | external_unicode_binary() | external_cha <<Ch/utf8,_/binary>> = Bin1, <<Ch/utf16-little,_/binary>> = Bin2, -Bin3 = <<$H/utf32-little, $e/utf32-little, $l/utf32-little, $l/utf32-little, $o/utf32-little>>, +Bin3 = <<$H/utf32-little, $e/utf32-little, $l/utf32-little, $l/utf32-little, + $o/utf32-little>>,

        For convenience, literal strings can be encoded with a Unicode encoding in binaries using the following (or similar) syntax:

        Bin4 = <<"Hello"/utf16>>, diff --git a/lib/syntax_tools/Makefile b/lib/syntax_tools/Makefile index 08ede67209..37e84a80a5 100644 --- a/lib/syntax_tools/Makefile +++ b/lib/syntax_tools/Makefile @@ -58,10 +58,10 @@ include $(ERL_TOP)/make/otp_subdir.mk version: @echo "$(VSN)" -docs: - erl -noshell -pa "$(BINDIR)" -run edoc_run application "'$(APPNAME)'" '"."' '$(DOC_OPTS)' -s init stop +# The overriding "docs" target have been removed so the default make rules work properly. -edocs: docs +edocs: + erl -noshell -pa "$(BINDIR)" -run edoc_run application "'$(APPNAME)'" '"."' '$(DOC_OPTS)' -s init stop app_release: tar diff --git a/lib/syntax_tools/doc/src/Makefile b/lib/syntax_tools/doc/src/Makefile index 2065614251..291b3e3047 100644 --- a/lib/syntax_tools/doc/src/Makefile +++ b/lib/syntax_tools/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2006-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2006-2010. 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% # include $(ERL_TOP)/make/target.mk @@ -101,10 +101,10 @@ html: gifs $(HTML_REF_MAN_FILE) man: $(MAN3_FILES) $(XML_REF3_FILES): - docb_gen $(SRC_DIR)/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript $(SRC_DIR)/$(@:%.xml=%.erl) $(XML_CHAPTER_FILES): - docb_gen -chapter -def vsn $(VSN) ../overview.edoc + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -chapter ../overview.edoc gifs: $(GIF_FILES:%=$(HTMLDIR)/%) diff --git a/lib/syntax_tools/src/Makefile b/lib/syntax_tools/src/Makefile index 5ffe85c975..62a24d98c0 100644 --- a/lib/syntax_tools/src/Makefile +++ b/lib/syntax_tools/src/Makefile @@ -34,15 +34,15 @@ OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) APP_FILE= syntax_tools.app APP_SRC= $(APP_FILE).src APP_TARGET= $(EBIN)/$(APP_FILE) - + APPUP_FILE= syntax_tools.appup APPUP_SRC= $(APPUP_FILE).src APPUP_TARGET= $(EBIN)/$(APPUP_FILE) - + # ---------------------------------------------------- # Targets # ---------------------------------------------------- - + debug opt: $(OBJECTS) all: $(OBJECTS) @@ -52,6 +52,8 @@ clean: rm -f $(OBJECTS) rm -f core *~ +docs: + distclean: clean realclean: clean @@ -62,10 +64,10 @@ $(EBIN)/%.$(EMULATOR):%.erl # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- - + $(APP_TARGET): $(APP_SRC) ../vsn.mk sed -e 's;%VSN%;$(VSN);' $< > $@ - + $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk sed -e 's;%VSN%;$(VSN);' $< > $@ diff --git a/lib/test_server/doc/src/Makefile b/lib/test_server/doc/src/Makefile index e3c1b8ce92..c7ba415e5b 100644 --- a/lib/test_server/doc/src/Makefile +++ b/lib/test_server/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2002-2010. 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% # @@ -60,6 +60,9 @@ XML_CHAPTER_FILES = \ BOOK_FILES = book.xml +XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \ + $(XML_PART_FILES) $(XML_CHAPTER_FILES) + GIF_FILES = # ---------------------------------------------------- diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile index 2d7e5b28bc..d55a3a597d 100644 --- a/lib/test_server/src/Makefile +++ b/lib/test_server/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1996-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1996-2010. 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% # @@ -104,7 +104,7 @@ clean: rm -f $(TARGET_FILES) $(TS_TARGET_FILES) rm -f core -doc: +docs: configure: configure.in autoconf configure.in > configure diff --git a/lib/wx/doc/src/Makefile b/lib/wx/doc/src/Makefile index fd9f7441a3..c8eb6174c4 100644 --- a/lib/wx/doc/src/Makefile +++ b/lib/wx/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2008-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2008-2010. 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% # @@ -82,7 +82,6 @@ XML_FILES = \ $(XML_PART_FILES) $(XML_REF3_FILES) \ $(XML_NOTES_FILES) $(XML_APPLICATION_FILES) - # ---------------------------------------------------- INFO_FILE = ../../info @@ -130,12 +129,13 @@ ref_man.xml: ref_man.xml.src @echo $(ErlMods:%.erl=%.xml): - docb_gen -def vsn $(VSN) -sort_functions false ../../src/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -sort_functions false ../../src/$(@:%.xml=%.erl) + $(GenMods:%.erl=%.xml): - docb_gen -def vsn $(VSN) -sort_functions false ../../src/gen/$(@:%.xml=%.erl) + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -sort_functions false ../../src/gen/$(@:%.xml=%.erl) $(XML_CHAPTER_FILES): - docb_gen -chapter -def vsn $(VSN) ../overview.edoc + escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -chapter ../overview.edoc debug opt: -- cgit v1.2.3