Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E70401848E for ; Wed, 23 Sep 2015 12:28:57 +0000 (UTC) Received: (qmail 70789 invoked by uid 500); 23 Sep 2015 12:28:56 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 70616 invoked by uid 500); 23 Sep 2015 12:28:56 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 70278 invoked by uid 99); 23 Sep 2015 12:28:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Sep 2015 12:28:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 524BFE0AFD; Wed, 23 Sep 2015 12:28:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Wed, 23 Sep 2015 12:29:14 -0000 Message-Id: <99cb9f5b06884cbbb357394c7c5b0b7f@git.apache.org> In-Reply-To: <692fb373a1bf46c4b15cfbbbf6c6a4e9@git.apache.org> References: <692fb373a1bf46c4b15cfbbbf6c6a4e9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [20/50] rebar commit: updated refs/heads/import to 5dea85d Add options 'groups' and 'cases' to 'ct' command Add option 'groups' to 'rebar ct' command. So the command "rebar ct suites=Suite1 groups=Group1,Group2,...,GroupN" is equal to "ct_run -suite Suite1_SUITE -group Group1 Group2 ... GroupN". It allows to run specified test groups in specified test suite with Common Test tool. Besides it is absolutely necessary to specify groups for running test cases which are included in these groups, otherwise init_per_group/2 and end_per_group/1 callbacks are not called by ct_run. Add option 'cases' to 'rebar ct' command. So the command "rebar ct suites=Suite1 cases=Case1,Case2,...,CaseN" is equal to "ct_run -suite Suite1_SUITE -case Case1 Case2 ... CaseN". It allows to run one or more test cases in specified test suite. Currently rebar has an option 'case' which allows to run only one test case. The option case is remained for backward compability. It's suggested to consider the option 'case' as deprecaed and recommended to use 'cases' instead. Updated help messages according to new command line options. Add warning message when used deprecated options 'case', 'group', 'suite' in command "rebar ct". Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/b041bd99 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/b041bd99 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/b041bd99 Branch: refs/heads/import Commit: b041bd990d1c5db2a4d6f8bed6897528d467c743 Parents: c3b09ba Author: Danil Onishchenko Authored: Sun Apr 5 19:28:36 2015 +0700 Committer: Danil Onishchenko Committed: Wed May 27 17:17:26 2015 +0700 ---------------------------------------------------------------------- THANKS | 1 + src/rebar.erl | 2 +- src/rebar_ct.erl | 72 +++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 61 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/b041bd99/THANKS ---------------------------------------------------------------------- diff --git a/THANKS b/THANKS index 4032fd9..13e1cd7 100644 --- a/THANKS +++ b/THANKS @@ -135,3 +135,4 @@ Pavel Baturko Igor Savchuk Mark Anderson Brian H. Ward +Danil Onishchenko http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/b041bd99/src/rebar.erl ---------------------------------------------------------------------- diff --git a/src/rebar.erl b/src/rebar.erl index 2d356dd..6033297 100644 --- a/src/rebar.erl +++ b/src/rebar.erl @@ -450,7 +450,7 @@ eunit [suite[s]=foo] Run EUnit tests in foo.erl and [random_suite_order=Seed] with a random seed for the PRNG, or a specific one. -ct [suite[s]=] [case=] Run common_test suites +ct [suite[s]= [group[s]= [case[s]=]]] Run common_test suites qc Test QuickCheck properties http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/b041bd99/src/rebar_ct.erl ---------------------------------------------------------------------- diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index 480f7f0..022dfc4 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -67,8 +67,16 @@ info(help, ct) -> " ~p~n" " ~p~n" "Valid command line options:~n" - " suites=foo,bar - run /foo_SUITE and /bar_SUITE~n" - " case=\"mycase\" - run individual test case foo_SUITE:mycase~n", + " suites=Suite1,Suite2,...,SuiteN~n" + " - run Suite1_SUITE, Suite2_SUITE, ..., SuiteN_SUITE~n" + " in the test folder.~n" + " groups=Group1,Group2,...,GroupN~n" + " - run test groups Group1, Group2, ..., GroupN of specified suites.~n" + " cases=Case1,Case2,...,CaseM~n" + " - run test cases Case1, Case2, ..., CaseN of specified suites.~n" + " case=\"mycase\" - run individual test case Suite1_SUITE:mycase.~n" + " This option is deprecated and remains for backward compability.~n" + " It is recommended to use 'cases' instead.~n", [ {ct_dir, "itest"}, {ct_log_dir, "test/logs"}, @@ -227,7 +235,8 @@ make_cmd(TestDir, RawLogDir, Config) -> get_cover_config(Config, Cwd) ++ get_ct_config_file(TestDir) ++ get_suites(Config, TestDir) ++ - get_case(Config) ++ + get_groups(Config) ++ + get_cases(Config) ++ get_extra_params(Config) ++ get_config_file(TestDir); SpecFlags -> @@ -343,17 +352,24 @@ get_suites(Config, TestDir) -> undefined -> " -dir " ++ TestDir; Suites -> - Suites1 = string:tokens(Suites, ","), - Suites2 = [find_suite_path(Suite, TestDir) || Suite <- Suites1], - string:join([" -suite"] ++ Suites2, " ") + Suites1 = [find_suite_path(Suite, TestDir) || Suite <- Suites], + string:join([" -suite"] ++ Suites1, " ") end. get_suites(Config) -> case rebar_config:get_global(Config, suites, undefined) of undefined -> - rebar_config:get_global(Config, suite, undefined); + %% The option 'suite' is deprecated and remains + %% for backward compatibility. + %% It is recommended to use 'suites' instead. + case get_deprecated_global(Config, suite, suites) of + undefined -> + undefined; + Suite -> + [Suite] + end; Suites -> - Suites + string:tokens(Suites, ",") end. find_suite_path(Suite, TestDir) -> @@ -368,10 +384,40 @@ find_suite_path(Suite, TestDir) -> Path end. -get_case(Config) -> - case rebar_config:get_global(Config, 'case', undefined) of +get_groups(Config) -> + case rebar_config:get_global(Config, groups, undefined) of undefined -> - ""; - Case -> - " -case " ++ Case + %% The option 'group' was added only for consistency + %% because there are options 'suite' and 'case'. + case get_deprecated_global(Config, group, groups) of + undefined -> + ""; + Group -> + " -group " ++ Group + end; + Groups -> + Groups1 = string:tokens(Groups, ","), + string:join([" -group"] ++ Groups1, " ") + end. + +get_cases(Config) -> + case rebar_config:get_global(Config, cases, undefined) of + undefined -> + %% The option 'case' is deprecated and remains + %% for backward compatibility. + %% It is recommended to use 'cases' instead. + case get_deprecated_global(Config, 'case', cases) of + undefined -> + ""; + Case -> + " -case " ++ Case + end; + Cases -> + Cases1 = string:tokens(Cases, ","), + string:join([" -case"] ++ Cases1, " ") end. + +get_deprecated_global(Config, OldOpt, NewOpt) -> + rebar_utils:get_deprecated_global( + Config, OldOpt, NewOpt, undefined, "in the future"). +