diff options
author | Siri Hansen <[email protected]> | 2017-02-22 10:04:47 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-02-22 10:04:47 +0100 |
commit | b1d9a9f0785ded0a70a4e0669a6e2b5234ab1163 (patch) | |
tree | 1232f0f952272e1daf35befdc6467a99095e2b8f /lib/common_test/src/ct_testspec.erl | |
parent | 4f56fb3e9120e92ff7b0700402707ad032114311 (diff) | |
parent | 113f8e99991b70709eb58168a6c4572a01e907b6 (diff) | |
download | otp-b1d9a9f0785ded0a70a4e0669a6e2b5234ab1163.tar.gz otp-b1d9a9f0785ded0a70a4e0669a6e2b5234ab1163.tar.bz2 otp-b1d9a9f0785ded0a70a4e0669a6e2b5234ab1163.zip |
Merge branch 'siri/ct/get_dirs_from_testspec/OTP-14132' into maint
* siri/ct/get_dirs_from_testspec/OTP-14132:
[ct] Add ct_testspec:get_tests/1
Diffstat (limited to 'lib/common_test/src/ct_testspec.erl')
-rw-r--r-- | lib/common_test/src/ct_testspec.erl | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index 991abb0666..16001ce4c8 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -26,7 +26,8 @@ -export([prepare_tests/1, prepare_tests/2, collect_tests_from_list/2, collect_tests_from_list/3, - collect_tests_from_file/2, collect_tests_from_file/3]). + collect_tests_from_file/2, collect_tests_from_file/3, + get_tests/1]). -export([testspec_rec2list/1, testspec_rec2list/2]). @@ -803,6 +804,31 @@ list_nodes(#testspec{nodes=NodeRefs}) -> lists:map(fun({_Ref,Node}) -> Node end, NodeRefs). +%%%----------------------------------------------------------------- +%%% Parse the given test specs and return the complete set of specs +%%% and tests to run/skip. +%%% [Spec1,Spec2,...] means create separate tests per spec +%%% [[Spec1,Spec2,...]] means merge all specs into one +-spec get_tests(Specs) -> {ok,[{Specs,Tests}]} | {error,Reason} when + Specs :: [string()] | [[string()]], + Tests :: {Node,Run,Skip}, + Node :: atom(), + Run :: {Dir,Suites,Cases}, + Skip :: {Dir,Suites,Comment} | {Dir,Suites,Cases,Comment}, + Dir :: string(), + Suites :: atom | [atom()] | all, + Cases :: atom | [atom()] | all, + Comment :: string(), + Reason :: term(). + +get_tests(Specs) -> + case collect_tests_from_file(Specs,true) of + Tests when is_list(Tests) -> + {ok,[{S,prepare_tests(R)} || {S,R} <- Tests]}; + Error -> + Error + end. + %% ----------------------------------------------------- %% / \ %% | When adding test/config terms, remember to update | |