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:
authorIlya Zverev <zverik@textual.ru>2015-07-02 20:36:04 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:54:03 +0300
commitb15e566b41a272b5a76b67ede12e643004963d2d (patch)
treeb7b6a93087bedb175c812f98173aced189dc33ca /testing
parent63006bbf8165e2b18d227365121cf38582463139 (diff)
[testing] Added SetWritableDir() and command-line args in testingmail
Diffstat (limited to 'testing')
-rw-r--r--testing/testing.hpp7
-rw-r--r--testing/testingmain.cpp18
2 files changed, 25 insertions, 0 deletions
diff --git a/testing/testing.hpp b/testing/testing.hpp
index db9c810f45..cd6d27dc57 100644
--- a/testing/testing.hpp
+++ b/testing/testing.hpp
@@ -27,6 +27,13 @@ namespace my
}
}
+struct TestingOptions
+{
+ string dataPath;
+ string resourcePath;
+};
+extern TestingOptions testingOptions;
+
#define TEST(X, msg) { if (X) {} else { \
::my::OnTestFailed(SRC(), ::my::impl::Message("TEST("#X")", ::my::impl::Message msg));}}
#define TEST_EQUAL(X, Y, msg) { if ((X) == (Y)) {} else { \
diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp
index 9268b773ee..d494be9957 100644
--- a/testing/testingmain.cpp
+++ b/testing/testingmain.cpp
@@ -28,6 +28,8 @@
#endif
#endif
+TestingOptions testingOptions;
+
namespace
{
bool g_bLastTestOK = true;
@@ -36,6 +38,8 @@ int const kOptionFieldWidth = 32;
char const kFilterOption[] = "--filter=";
char const kSuppressOption[] = "--suppress=";
char const kHelpOption[] = "--help";
+char const kDataPathOptions[] = "--data_path=";
+char const kResourcePathOptions[] = "--user_resource_path=";
enum Status
{
@@ -55,6 +59,9 @@ struct CommandLineOptions
// Non-owning ptr.
char const * suppressRegExp;
+ char const * dataPath;
+ char const * resourcePath;
+
bool help;
};
@@ -78,6 +85,8 @@ void Usage(char const * name)
"Run tests with names corresponding to regexp.");
DisplayOption(cerr, kSuppressOption, "<ECMA Regexp>",
"Do not run tests with names corresponding to regexp.");
+ DisplayOption(cerr, kDataPathOptions, "<Path>", "Path to data files.");
+ DisplayOption(cerr, kResourcePathOptions, "<Path>", "Path to resources, styles and classificators.");
DisplayOption(cerr, kHelpOption, "Print this help message and exit.");
}
@@ -90,6 +99,10 @@ void ParseOptions(int argc, char * argv[], CommandLineOptions & options)
options.filterRegExp = arg + sizeof(kFilterOption) - 1;
if (strings::StartsWith(arg, kSuppressOption))
options.suppressRegExp = arg + sizeof(kSuppressOption) - 1;
+ if (strings::StartsWith(arg, kDataPathOptions))
+ options.dataPath = arg + sizeof(kDataPathOptions) - 1;
+ if (strings::StartsWith(arg, kResourcePathOptions))
+ options.resourcePath = arg + sizeof(kResourcePathOptions) - 1;
if (strcmp(arg, kHelpOption) == 0)
options.help = true;
}
@@ -131,6 +144,11 @@ int main(int argc, char * argv[])
if (options.suppressRegExp)
regexp::Create(options.suppressRegExp, suppressRegExp);
+ if (options.resourcePath)
+ testingOptions.resourcePath = options.resourcePath;
+ if (options.dataPath)
+ testingOptions.dataPath = options.dataPath;
+
for (TestRegister * pTest = TestRegister::FirstRegister(); pTest; pTest = pTest->m_pNext)
{
string fileName(pTest->m_FileName);