aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_hooks_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-07-28 19:12:37 +0200
committerLukas Larsson <[email protected]>2011-08-31 10:41:36 +0200
commit6b9f8b54324891f2d7fed236cb2860896215d755 (patch)
tree79be0b0efce3d0b7a05c5a7076f185c354a51399 /lib/common_test/test/ct_hooks_SUITE.erl
parent71a49b5c88e2149e288168beb8cb6ff0ed39c671 (diff)
downloadotp-6b9f8b54324891f2d7fed236cb2860896215d755.tar.gz
otp-6b9f8b54324891f2d7fed236cb2860896215d755.tar.bz2
otp-6b9f8b54324891f2d7fed236cb2860896215d755.zip
Add priority functionality and tests for ct hooks
Priority allows the user of ct hooks to specify which order the hooks should execute in. The priority of a hook is specified when installing the hook, and stays the same for both pre and post hooks
Diffstat (limited to 'lib/common_test/test/ct_hooks_SUITE.erl')
-rw-r--r--lib/common_test/test/ct_hooks_SUITE.erl76
1 files changed, 72 insertions, 4 deletions
diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl
index 8574d7aabc..16a95461e6 100644
--- a/lib/common_test/test/ct_hooks_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE.erl
@@ -83,7 +83,7 @@ all(suite) ->
fail_post_suite_cth, skip_pre_suite_cth,
skip_post_suite_cth, recover_post_suite_cth, update_config_cth,
state_update_cth, options_cth, same_id_cth,
- fail_n_skip_with_minimal_cth
+ fail_n_skip_with_minimal_cth, prio_cth
]
)
.
@@ -209,6 +209,10 @@ fail_n_skip_with_minimal_cth(Config) when is_list(Config) ->
do_test(fail_n_skip_with_minimal_cth, "ct_cth_fail_one_skip_one_SUITE.erl",
[minimal_terminate_cth],Config).
+prio_cth(Config) when is_list(Config) ->
+ do_test(prio_cth, "ct_cth_prio_SUITE.erl",
+ [{empty_cth,[1000],1000},{empty_cth,[900],900}],Config).
+
%%%-----------------------------------------------------------------
%%% HELP FUNCTIONS
%%%-----------------------------------------------------------------
@@ -296,9 +300,9 @@ test_events(two_empty_cth) ->
{?eh,start_logging,{'DEF','RUNDIR'}},
{?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
{?eh,cth,{'_',id,[[]]}},
- {?eh,cth,{'_',init,['_',[]]}},
{?eh,cth,{'_',id,[[]]}},
{?eh,cth,{'_',init,['_',[]]}},
+ {?eh,cth,{'_',init,['_',[]]}},
{?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
{?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
{?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
@@ -365,9 +369,9 @@ test_events(minimal_and_maximal_cth) ->
[
{?eh,start_logging,{'DEF','RUNDIR'}},
{?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,cth,{'_',id,[[]]}},
{negative,{?eh,cth,{'_',id,['_',[]]}},
{?eh,cth,{'_',init,['_',[]]}}},
- {?eh,cth,{'_',id,[[]]}},
{?eh,cth,{'_',init,['_',[]]}},
{?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
{?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
@@ -954,8 +958,8 @@ test_events(same_id_cth) ->
{?eh,start_logging,{'DEF','RUNDIR'}},
{?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
{?eh,cth,{'_',id,[[]]}},
- {?eh,cth,{'_',init,[same_id_cth,[]]}},
{?eh,cth,{'_',id,[[]]}},
+ {?eh,cth,{'_',init,[same_id_cth,[]]}},
{?eh,tc_start,{ct_cth_empty_SUITE,init_per_suite}},
{?eh,cth,{'_',pre_init_per_suite,[ct_cth_empty_SUITE,'$proplist',[]]}},
{negative,
@@ -1001,6 +1005,70 @@ test_events(fail_n_skip_with_minimal_cth) ->
{?eh,stop_logging,[]}
];
+test_events(prio_cth) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+
+ {?eh,tc_start,{ct_cth_prio_SUITE,init_per_suite}},
+ {?eh,cth,{'_',pre_init_per_suite,['_','_',[800]]}},
+ {?eh,cth,{'_',pre_init_per_suite,['_','_',[900]]}},
+ {?eh,cth,{'_',pre_init_per_suite,['_','_',[1000]]}},
+ {?eh,cth,{'_',post_init_per_suite,['_','_','_',[700]]}},
+ {?eh,cth,{'_',post_init_per_suite,['_','_','_',[800]]}},
+ {?eh,cth,{'_',post_init_per_suite,['_','_','_',[900]]}},
+ {?eh,cth,{'_',post_init_per_suite,['_','_','_',[1000]]}},
+ {?eh,tc_done,{ct_cth_prio_SUITE,init_per_suite,ok}},
+
+
+ [{?eh,tc_start,{ct_cth_prio_SUITE,{init_per_group,'_',[]}}},
+ {?eh,cth,{'_',pre_init_per_group, ['_','_',[700]]}},
+ {?eh,cth,{'_',pre_init_per_group, ['_','_',[800]]}},
+ {?eh,cth,{'_',pre_init_per_group, ['_','_',[900]]}},
+ {?eh,cth,{'_',pre_init_per_group, ['_','_',[1000]]}},
+ {?eh,cth,{'_',post_init_per_group, ['_','_','_',[600]]}},
+ {?eh,cth,{'_',post_init_per_group, ['_','_','_',[700]]}},
+ {?eh,cth,{'_',post_init_per_group, ['_','_','_',[800]]}},
+ {?eh,cth,{'_',post_init_per_group, ['_','_','_',[900]]}},
+ {?eh,cth,{'_',post_init_per_group, ['_','_','_',[1000]]}},
+ {?eh,tc_done,{ct_cth_prio_SUITE,{init_per_group,'_',[]},ok}},
+
+ {?eh,tc_start,{ct_cth_prio_SUITE,test_case}},
+ {?eh,cth,{'_',pre_init_per_testcase, ['_','_',[600]]}},
+ {?eh,cth,{'_',pre_init_per_testcase, ['_','_',[700]]}},
+ {?eh,cth,{'_',pre_init_per_testcase, ['_','_',[800]]}},
+ {?eh,cth,{'_',pre_init_per_testcase, ['_','_',[900]]}},
+ {?eh,cth,{'_',pre_init_per_testcase, ['_','_',[1000]]}},
+ {?eh,cth,{'_',post_end_per_testcase, ['_','_','_',[600]]}},
+ {?eh,cth,{'_',post_end_per_testcase, ['_','_','_',[700]]}},
+ {?eh,cth,{'_',post_end_per_testcase, ['_','_','_',[800]]}},
+ {?eh,cth,{'_',post_end_per_testcase, ['_','_','_',[900]]}},
+ {?eh,cth,{'_',post_end_per_testcase, ['_','_','_',[1000]]}},
+ {?eh,tc_done,{ct_cth_prio_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_cth_prio_SUITE,{end_per_group,'_',[]}}},
+ {?eh,cth,{'_',pre_end_per_group, ['_','_',[600]]}},
+ {?eh,cth,{'_',pre_end_per_group, ['_','_',[700]]}},
+ {?eh,cth,{'_',pre_end_per_group, ['_','_',[800]]}},
+ {?eh,cth,{'_',pre_end_per_group, ['_','_',[900]]}},
+ {?eh,cth,{'_',pre_end_per_group, ['_','_',[1000]]}},
+ {?eh,cth,{'_',post_end_per_group, ['_','_','_',[700]]}},
+ {?eh,cth,{'_',post_end_per_group, ['_','_','_',[800]]}},
+ {?eh,cth,{'_',post_end_per_group, ['_','_','_',[900]]}},
+ {?eh,cth,{'_',post_end_per_group, ['_','_','_',[1000]]}},
+ {?eh,tc_done,{ct_cth_prio_SUITE,{end_per_group,'_',[]},ok}}],
+
+ {?eh,tc_start,{ct_cth_prio_SUITE,end_per_suite}},
+ {?eh,cth,{'_',pre_end_per_suite,['_','_',[800]]}},
+ {?eh,cth,{'_',pre_end_per_suite,['_','_',[900]]}},
+ {?eh,cth,{'_',pre_end_per_suite,['_','_',[1000]]}},
+ {?eh,cth,{'_',post_end_per_suite,['_','_','_',[800]]}},
+ {?eh,cth,{'_',post_end_per_suite,['_','_','_',[900]]}},
+ {?eh,cth,{'_',post_end_per_suite,['_','_','_',[1000]]}},
+ {?eh,tc_done,{ct_cth_prio_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
test_events(ok) ->
ok.