Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2015-06-23 17:38:13 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:52:12 +0300
commit59064d7d7e2ee8a9f46951b05f5df3a3be7185e7 (patch)
treea81a55ca4f0c2f61afdc2e89c43935c37ffbcb0c /testing/testingmain.cpp
parenta717005c9896ffccefefd1bfeb5cce69da7708cb (diff)
[testing] Added --suppress option.
Diffstat (limited to 'testing/testingmain.cpp')
-rw-r--r--testing/testingmain.cpp51
1 files changed, 38 insertions, 13 deletions
diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp
index e6c763cdf6..79cdd3222b 100644
--- a/testing/testingmain.cpp
+++ b/testing/testingmain.cpp
@@ -27,8 +27,33 @@
#endif
#endif
+namespace
+{
+bool g_bLastTestOK = true;
+
+char const kFilterOption[] = "--filter=";
+char const kSuppressOption[] = "--suppress=";
+
+struct CommandLineOptions
+{
+ CommandLineOptions() : filterRegExp(nullptr), suppressRegExp(nullptr) {}
-static bool g_bLastTestOK = true;
+ char const * filterRegExp;
+ char const * suppressRegExp;
+};
+
+void ParseOptions(int argc, char * argv[], CommandLineOptions & options)
+{
+ for (int i = 1; i < argc; ++i)
+ {
+ char const * const arg = argv[i];
+ if (strings::StartsWith(arg, kFilterOption))
+ options.filterRegExp = arg + sizeof(kFilterOption) - 1;
+ if (strings::StartsWith(arg, kSuppressOption))
+ options.suppressRegExp = arg + sizeof(kSuppressOption) - 1;
+ }
+}
+} // namespace
int main(int argc, char * argv[])
{
@@ -49,19 +74,16 @@ int main(int argc, char * argv[])
vector<bool> testResults;
int numFailedTests = 0;
- char const filterOptionPrefix[] = "--filter=";
- char const * testsFilter = nullptr;
+ CommandLineOptions options;
+ ParseOptions(argc, argv, options);
- regexp::RegExpT testsFilterRegExp;
+ regexp::RegExpT filterRegExp;
+ if (options.filterRegExp)
+ regexp::Create(options.filterRegExp, filterRegExp);
- for (int arg = 1; arg < argc; ++arg)
- {
- if (strings::StartsWith(argv[arg], filterOptionPrefix))
- testsFilter = argv[arg] + sizeof(filterOptionPrefix) - 1;
- }
-
- if (testsFilter)
- regexp::Create(testsFilter, testsFilterRegExp);
+ regexp::RegExpT suppressRegExp;
+ if (options.suppressRegExp)
+ regexp::Create(options.suppressRegExp, suppressRegExp);
for (TestRegister * pTest = TestRegister::FirstRegister(); pTest; pTest = pTest->m_pNext)
{
@@ -83,8 +105,11 @@ int main(int argc, char * argv[])
int iTest = 0;
for (TestRegister * pTest = TestRegister::FirstRegister(); pTest; ++iTest, pTest = pTest->m_pNext)
{
- if (testsFilter && !regexp::Matches(testNames[iTest], testsFilterRegExp))
+ if (options.filterRegExp && !regexp::Matches(testNames[iTest], filterRegExp))
+ continue;
+ if (options.suppressRegExp && regexp::Matches(testNames[iTest], suppressRegExp))
continue;
+
cerr << "Running " << testNames[iTest] << endl << flush;
if (!g_bLastTestOK)
{