diff options
author | Peter Andersson <[email protected]> | 2015-05-04 16:04:24 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2015-05-04 16:04:24 +0200 |
commit | 1fc847019eadb0190997dfe4fc4f9d97a688b887 (patch) | |
tree | f87b9f3548137de99c0d210d4cfdc7f61e18a382 /lib/common_test/src/ct.erl | |
parent | d766187ac01d8b5a73926f2a32bdac44e5933a7a (diff) | |
parent | 1378dee07e847c8af91aef1afc66ad0026a8cefb (diff) | |
download | otp-1fc847019eadb0190997dfe4fc4f9d97a688b887.tar.gz otp-1fc847019eadb0190997dfe4fc4f9d97a688b887.tar.bz2 otp-1fc847019eadb0190997dfe4fc4f9d97a688b887.zip |
Merge remote-tracking branch 'origin/peppe/common_test/test_categories'
* origin/peppe/common_test/test_categories:
Reintroduce functions for backwards compatibility
Update handling of failing all/0 function in test suites
Add tests for the get_testspec_terms functionality
Introduce test categories for OTP tests
OTP-11962
Diffstat (limited to 'lib/common_test/src/ct.erl')
-rw-r--r-- | lib/common_test/src/ct.erl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl index 9d8fce2789..5ed1346f1e 100644 --- a/lib/common_test/src/ct.erl +++ b/lib/common_test/src/ct.erl @@ -79,6 +79,7 @@ %% Other interface functions -export([get_status/0, abort_current_testcase/1, get_event_mgr_ref/0, + get_testspec_terms/0, get_testspec_terms/1, encrypt_config_file/2, encrypt_config_file/3, decrypt_config_file/2, decrypt_config_file/3]). @@ -463,6 +464,50 @@ reload_config(Required)-> ct_config:reload_config(Required). %%%----------------------------------------------------------------- +%%% @spec get_testspec_terms() -> TestSpecTerms | undefined +%%% TestSpecTerms = [{Tag,Value}] +%%% Value = [term()] +%%% +%%% @doc Get a list of all test specification terms used to +%%% configure and run this test. +%%% +get_testspec_terms() -> + case ct_util:get_testdata(testspec) of + undefined -> + undefined; + CurrSpecRec -> + ct_testspec:testspec_rec2list(CurrSpecRec) + end. + +%%%----------------------------------------------------------------- +%%% @spec get_testspec_terms(Tags) -> TestSpecTerms | undefined +%%% Tags = [Tag] | Tag +%%% Tag = atom() +%%% TestSpecTerms = [{Tag,Value}] | {Tag,Value} +%%% Value = [{Node,term()}] | [term()] +%%% Node = atom() +%%% +%%% @doc Read one or more terms from the test specification used +%%% to configure and run this test. Tag is any valid test specification +%%% tag, such as e.g. <c>label</c>, <c>config</c>, <c>logdir</c>. +%%% User specific terms are also available to read if the +%%% <c>allow_user_terms</c> option has been set. Note that all value tuples +%%% returned, except user terms, will have the node name as first element. +%%% Note also that in order to read test terms, use <c>Tag = tests</c> +%%% (rather than <c>suites</c>, <c>groups</c> or <c>cases</c>). Value is +%%% then the list of *all* tests on the form: +%%% <c>[{Node,Dir,[{TestSpec,GroupsAndCases1},...]},...], where +%%% GroupsAndCases = [{Group,[Case]}] | [Case]</c>. +get_testspec_terms(Tags) -> + case ct_util:get_testdata(testspec) of + undefined -> + undefined; + CurrSpecRec -> + ct_testspec:testspec_rec2list(Tags, CurrSpecRec) + end. + + +%%%----------------------------------------------------------------- %%% @spec log(Format) -> ok %%% @equiv log(default,50,Format,[]) log(Format) -> |