Merge lp:~brianaker/gearmand/yatl-list into lp:gearmand

Proposed by Brian Aker on 2013-08-03
Status: Merged
Merged at revision: 851
Proposed branch: lp:~brianaker/gearmand/yatl-list
Merge into: lp:gearmand
Diff against target: 128 lines (+52/-1)
3 files modified
libtest/collection.h (+5/-0)
libtest/framework.cc (+1/-1)
libtest/main.cc (+46/-0)
To merge this branch: bzr merge lp:~brianaker/gearmand/yatl-list
Reviewer Review Type Date Requested Status
Tangent Trunk 2013-08-03 Pending
Review via email: mp+178422@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libtest/collection.h'
2--- libtest/collection.h 2013-07-02 12:18:03 +0000
3+++ libtest/collection.h 2013-08-03 10:12:27 +0000
4@@ -67,6 +67,11 @@
5 return _name.c_str();
6 }
7
8+ TestCases& tests()
9+ {
10+ return _testcases;
11+ }
12+
13 void succeess();
14
15 void skip();
16
17=== modified file 'libtest/framework.cc'
18--- libtest/framework.cc 2013-07-02 12:18:03 +0000
19+++ libtest/framework.cc 2013-08-03 10:12:27 +0000
20@@ -192,7 +192,7 @@
21
22 void Framework::exec()
23 {
24- for (std::vector<Collection*>::iterator iter= _collection.begin();
25+ for (Suites::iterator iter= _collection.begin();
26 iter != _collection.end() and (_signal.is_shutdown() == false);
27 ++iter)
28 {
29
30=== modified file 'libtest/main.cc'
31--- libtest/main.cc 2013-07-18 09:54:49 +0000
32+++ libtest/main.cc 2013-08-03 10:12:27 +0000
33@@ -70,6 +70,8 @@
34 unsigned long int opt_repeat= 1; // Run all tests once
35 bool opt_verbose= false;
36 bool opt_quiet= false;
37+ bool opt_list_collection= false;
38+ bool opt_list_tests= false;
39 std::string collection_to_run;
40 std::string wildcard;
41 std::string binary_name;
42@@ -104,9 +106,12 @@
43 // Options parsing
44 {
45 enum long_option_t {
46+ OPT_LIBYATL_HELP,
47 OPT_LIBYATL_VERBOSE,
48 OPT_LIBYATL_VERSION,
49 OPT_LIBYATL_MATCH_COLLECTION,
50+ OPT_LIBYATL_LIST_COLLECTIONS,
51+ OPT_LIBYATL_LIST_TESTS,
52 OPT_LIBYATL_MASSIVE,
53 OPT_LIBYATL_QUIET,
54 OPT_LIBYATL_MATCH_WILDCARD,
55@@ -117,11 +122,14 @@
56
57 static struct option long_options[]=
58 {
59+ { "help", no_argument, NULL, OPT_LIBYATL_HELP },
60 { "verbose", no_argument, NULL, OPT_LIBYATL_VERBOSE },
61 { "version", no_argument, NULL, OPT_LIBYATL_VERSION },
62 { "quiet", no_argument, NULL, OPT_LIBYATL_QUIET },
63 { "repeat", required_argument, NULL, OPT_LIBYATL_REPEAT },
64 { "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION },
65+ { "list-collections", no_argument, NULL, OPT_LIBYATL_LIST_COLLECTIONS },
66+ { "list-tests", no_argument, NULL, OPT_LIBYATL_LIST_TESTS },
67 { "wildcard", required_argument, NULL, OPT_LIBYATL_MATCH_WILDCARD },
68 { "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE },
69 { "ssl", no_argument, NULL, OPT_LIBYATL_SSL },
70@@ -139,6 +147,13 @@
71
72 switch (option_rv)
73 {
74+ case OPT_LIBYATL_HELP:
75+ for (struct option *opt= long_options; opt->name; ++opt)
76+ {
77+ Out << "--" << opt->name;
78+ }
79+ exit(EXIT_SUCCESS);
80+
81 case OPT_LIBYATL_VERBOSE:
82 opt_verbose= true;
83 break;
84@@ -160,6 +175,13 @@
85 }
86 break;
87
88+ case OPT_LIBYATL_LIST_TESTS:
89+ opt_list_tests= true;
90+
91+ case OPT_LIBYATL_LIST_COLLECTIONS:
92+ opt_list_collection= true;
93+ break;
94+
95 case OPT_LIBYATL_MATCH_COLLECTION:
96 collection_to_run= optarg;
97 break;
98@@ -316,6 +338,30 @@
99
100 std::auto_ptr<libtest::Framework> frame(new libtest::Framework(signal, binary_name, collection_to_run, wildcard));
101
102+ if (opt_list_collection)
103+ {
104+ for (Suites::iterator iter= frame->suites().begin();
105+ iter != frame->suites().end();
106+ ++iter)
107+ {
108+ if (opt_list_tests)
109+ {
110+ for (TestCases::iterator test_iter= (*iter)->tests().begin();
111+ test_iter != (*iter)->tests().end();
112+ ++test_iter)
113+ {
114+ Out << (*iter)->name() << "." << (*test_iter)->name();
115+ }
116+ }
117+ else
118+ {
119+ Out << (*iter)->name();
120+ }
121+ }
122+
123+ continue;
124+ }
125+
126 // Run create(), bail on error.
127 {
128 switch (frame->create())

Subscribers

People subscribed via source and target branches

to all changes: