From b72ac8bb33177f6ca117fc0f7727d24de67cbc62 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 29 Jul 2011 14:47:00 +0200 Subject: Update to reflect addition of CTH priority addition --- lib/common_test/doc/src/common_test_app.xml | 2 +- lib/common_test/doc/src/ct_hooks.xml | 8 +++++++- lib/common_test/doc/src/ct_hooks_chapter.xml | 19 +++++++++++++++---- lib/common_test/doc/src/run_test_chapter.xml | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-) (limited to 'lib/common_test/doc') diff --git a/lib/common_test/doc/src/common_test_app.xml b/lib/common_test/doc/src/common_test_app.xml index c92566de37..57b032b3fd 100644 --- a/lib/common_test/doc/src/common_test_app.xml +++ b/lib/common_test/doc/src/common_test_app.xml @@ -144,7 +144,7 @@ UserData = term() Conns = [atom()] CSSFile = string() - CTHs = [CTHModule | {CTHModule, CTHInitArgs}] + CTHs = [CTHModule | {CTHModule, CTHInitArgs} | {CTHModule, CTHInitArgs, CTHPriority}] CTHModule = atom() CTHInitArgs = term() diff --git a/lib/common_test/doc/src/ct_hooks.xml b/lib/common_test/doc/src/ct_hooks.xml index 7d5c9f4750..0ece3199bb 100644 --- a/lib/common_test/doc/src/ct_hooks.xml +++ b/lib/common_test/doc/src/ct_hooks.xml @@ -81,12 +81,14 @@ - Module:init(Id, Opts) -> State + Module:init(Id, Opts) -> {ok, State} | + {ok, State, Priority} Initiates the Common Test Hook Id = reference() | term() Opts = term() State = term() + Priority = integer() @@ -103,6 +105,10 @@ if id/1 is not implemented.

+

Priority is the relative priority of this hook. Hooks with a + lower priority will be executed first. If no priority is given, + it will be set to 0.

+

For details about when init is called see scope in the User's Guide.

diff --git a/lib/common_test/doc/src/ct_hooks_chapter.xml b/lib/common_test/doc/src/ct_hooks_chapter.xml index fc5ab48e1b..dbb4310040 100644 --- a/lib/common_test/doc/src/ct_hooks_chapter.xml +++ b/lib/common_test/doc/src/ct_hooks_chapter.xml @@ -94,9 +94,11 @@ init_per_group/2. CTH in this case can be either only the module name of the CTH or a tuple with the module name and the - initial arguments to the CTH. Eg: + initial arguments and optionally the hook priority of the CTH. Eg: {ct_hooks,[my_cth_module]} or - {ct_hooks,[{my_cth_module,[{debug,true}]}]}

+ {ct_hooks,[{my_cth_module,[{debug,true}]}]} or + {ct_hooks,[{my_cth_module,[{debug,true}],500}]} +

Overriding CTHs @@ -109,7 +111,16 @@ id in both places, Common Test knows that this CTH has already been installed and will not try to install it again.

- + +
+ CTH Priority +

By default each CTH installed will be executed in the order which + they are installed. This is not always wanted so common_test allows + the user to specify a priority for each hook. The priority can either + be specified in the CTH init/2 + function or when installing the hook. The priority given at + installation will override the priority returned by the CTH.

+
@@ -331,7 +342,7 @@ id(Opts) -> %% any common state. init(Id, Opts) -> {ok,D} = file:open(Id,[write]), - #state{ file_handle = D, total = 0, data = [] }. + {ok, #state{ file_handle = D, total = 0, data = [] }}. %% @doc Called before init_per_suite is called. pre_init_per_suite(Suite,Config,State) -> diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml index e6fb85634f..e668568795 100644 --- a/lib/common_test/doc/src/run_test_chapter.xml +++ b/lib/common_test/doc/src/run_test_chapter.xml @@ -488,7 +488,7 @@ LogDir = string() EventHandlers = atom() | [atom()] InitArgs = [term()] - CTHModules = [CTHModule | {CTHModule, CTHInitArgs}] + CTHModules = [CTHModule | {CTHModule, CTHInitArgs} | {CTHModule, CTHInitArgs, CTHPriority}] CTHModule = atom() CTHInitArgs = term() DirRef = DirAlias | Dir -- cgit v1.2.3