1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2010-2020. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21
22-module(all_and_groups_cth).
23
24
25-include_lib("common_test/src/ct_util.hrl").
26-include_lib("common_test/include/ct_event.hrl").
27
28%% Send a cth_error event if a callback is called with unexpected arguments
29-define(fail(Info),
30        gen_event:notify(
31          ?CT_EVMGR_REF,
32          #event{ name = cth_error,
33                  node = node(),
34                  data = {illegal_hook_callback,{?MODULE,?FUNCTION_NAME,Info}}})).
35
36%% CT Hooks
37-compile(export_all).
38
39id(Opts) ->
40    empty_cth:id(Opts).
41
42post_groups(Suite,Groups) ->
43    case empty_cth:post_groups(Suite,ct:get_config(post_groups_return,Groups)) of
44        crash -> error(crash_in_post_groups);
45        R -> R
46    end.
47
48post_all(Suite,Tests,Groups) ->
49    case empty_cth:post_all(Suite,ct:get_config(post_all_return,Tests),Groups) of
50        crash -> error(crash_in_post_all);
51        R -> R
52    end.
53
54init(Id, Opts) ->
55    empty_cth:init(Id, Opts).
56
57pre_init_per_suite(Suite, Config, State) ->
58    empty_cth:pre_init_per_suite(Suite,Config,State).
59
60post_init_per_suite(Suite,Config,Return,State) ->
61    empty_cth:post_init_per_suite(Suite,Config,Return,State).
62
63pre_end_per_suite(Suite,Config,State) ->
64    empty_cth:pre_end_per_suite(Suite,Config,State).
65
66post_end_per_suite(Suite,Config,Return,State) ->
67    empty_cth:post_end_per_suite(Suite,Config,Return,State).
68
69pre_init_per_group(Suite,Group,Config,State) ->
70    empty_cth:pre_init_per_group(Suite,Group,Config,State).
71
72post_init_per_group(Suite,Group,Config,Return,State) ->
73    empty_cth:post_init_per_group(Suite,Group,Config,Return,State).
74
75pre_end_per_group(Suite,Group,Config,State) ->
76    empty_cth:pre_end_per_group(Suite,Group,Config,State).
77
78post_end_per_group(Suite,Group,Config,Return,State) ->
79    empty_cth:post_end_per_group(Suite,Group,Config,Return,State).
80
81pre_init_per_testcase(Suite,TC,Config,State) ->
82    empty_cth:pre_init_per_testcase(Suite,TC,Config,State).
83
84post_init_per_testcase(Suite,TC,Config,Return,State) ->
85    empty_cth:post_init_per_testcase(Suite,TC,Config,Return,State).
86
87pre_end_per_testcase(Suite,TC,Config,State) ->
88    empty_cth:pre_end_per_testcase(Suite,TC,Config,State).
89
90post_end_per_testcase(Suite,TC,Config,Return,State) ->
91    empty_cth:post_end_per_testcase(Suite,TC,Config,Return,State).
92
93on_tc_fail(Suite,TC,Reason,State) ->
94    empty_cth:on_tc_fail(Suite,TC,Reason,State).
95
96on_tc_skip(Suite,TC,Reason,State) ->
97    empty_cth:on_tc_skip(Suite,TC,Reason,State).
98
99terminate(State) ->
100    empty_cth:terminate(State).
101