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:
-rw-r--r--omim.pro2
-rw-r--r--platform/downloader_tests/downloader_test.cpp (renamed from platform/platform_tests/downloader_test.cpp)0
-rw-r--r--platform/downloader_tests/downloader_tests.pro27
-rw-r--r--platform/platform_tests/platform_tests.pro1
-rwxr-xr-xtools/run_desktop_tests.py67
-rw-r--r--tools/testserver.py2
6 files changed, 78 insertions, 21 deletions
diff --git a/omim.pro b/omim.pro
index a176c16e17..35db5408ac 100644
--- a/omim.pro
+++ b/omim.pro
@@ -27,7 +27,6 @@ win32:CONFIG(drape) {
}
SUBDIRS = 3party base geometry coding
-
SUBDIRS += indexer
SUBDIRS += routing
@@ -78,6 +77,7 @@ SUBDIRS += routing
SUBDIRS += platform/platform_tests_support
SUBDIRS += geometry/geometry_tests
SUBDIRS += platform/platform_tests
+ SUBDIRS += platform/downloader_tests
SUBDIRS += qt_tstfrm
SUBDIRS += render/render_tests
SUBDIRS += storage/storage_tests
diff --git a/platform/platform_tests/downloader_test.cpp b/platform/downloader_tests/downloader_test.cpp
index c204dbd97a..c204dbd97a 100644
--- a/platform/platform_tests/downloader_test.cpp
+++ b/platform/downloader_tests/downloader_test.cpp
diff --git a/platform/downloader_tests/downloader_tests.pro b/platform/downloader_tests/downloader_tests.pro
new file mode 100644
index 0000000000..22545d5340
--- /dev/null
+++ b/platform/downloader_tests/downloader_tests.pro
@@ -0,0 +1,27 @@
+TARGET = downloader_tests
+CONFIG += console warn_on
+CONFIG -= app_bundle
+TEMPLATE = app
+
+ROOT_DIR = ../..
+DEPENDENCIES = platform_tests_support platform coding base minizip tomcrypt jansson
+
+include($$ROOT_DIR/common.pri)
+
+INCLUDEPATH *= $$ROOT_DIR/3party/jansson/src
+
+DEFINES *= OMIM_UNIT_TEST_WITH_QT_EVENT_LOOP
+
+QT *= core
+
+macx-* {
+ QT *= gui widgets # needed for QApplication with event loop, to test async events (downloader, etc.)
+ LIBS *= "-framework IOKit" "-framework QuartzCore"
+}
+win32*|linux* {
+ QT *= network
+}
+
+SOURCES += \
+ ../../testing/testingmain.cpp \
+ downloader_test.cpp \
diff --git a/platform/platform_tests/platform_tests.pro b/platform/platform_tests/platform_tests.pro
index effd0844fe..405d130bcc 100644
--- a/platform/platform_tests/platform_tests.pro
+++ b/platform/platform_tests/platform_tests.pro
@@ -26,7 +26,6 @@ SOURCES += \
../../testing/testingmain.cpp \
apk_test.cpp \
country_file_tests.cpp \
- downloader_test.cpp \
get_text_by_id_tests.cpp \
jansson_test.cpp \
language_test.cpp \
diff --git a/tools/run_desktop_tests.py b/tools/run_desktop_tests.py
index 61d052d92d..1391d498d2 100755
--- a/tools/run_desktop_tests.py
+++ b/tools/run_desktop_tests.py
@@ -20,11 +20,10 @@ from __future__ import print_function
from optparse import OptionParser
from os import listdir, remove
-from os.path import isfile, join
from random import shuffle
+import random
import socket
import subprocess
-import sys
import testserver
import urllib2
@@ -35,10 +34,11 @@ SKIP = "skip"
NOT_FOUND = "not_found"
FAILED = "failed"
PASSED = "passed"
+WITH_SERVER = "with_server"
PORT = 34568
-TESTS_REQUIRING_SERVER = ["platform_tests", "storage_tests"]
+TESTS_REQUIRING_SERVER = ["downloader_tests", "storage_tests"]
class TestRunner:
@@ -97,9 +97,9 @@ class TestRunner:
def categorize_tests(self):
- tests_to_run = []
- local_skiplist = []
- not_found = []
+ tests_to_run = list()
+ local_skiplist = list()
+ not_found = list()
test_files_in_dir = filter(lambda x: x.endswith("_tests"), listdir(self.workspace_path))
@@ -116,21 +116,27 @@ class TestRunner:
not_found = filter(not_on_disk, self.runlist)
- return {TO_RUN:tests_to_run, SKIP:local_skiplist, NOT_FOUND:not_found}
+
+ # now let's move the tests that need a server either to the beginning or the end of the tests_to_run list
+
+ tests_with_server = TESTS_REQUIRING_SERVER
+ for test in tests_with_server:
+ if test in tests_to_run:
+ tests_to_run.remove(test)
+ else:
+ tests_with_server.remove(test)
+
+ return {TO_RUN:tests_to_run, SKIP:local_skiplist, NOT_FOUND:not_found, WITH_SERVER:tests_with_server}
def run_tests(self, tests_to_run):
- failed = []
- passed = []
- self.start_server()
+ failed = list()
+ passed = list()
for test_file in tests_to_run:
self.log_exec_file(test_file)
- # if test_file in TESTS_REQUIRING_SERVER:
- # self.start_server()
-
test_file_with_keys = "{test_file}{data}{resources}".format(test_file=test_file, data=self.data_path, resources=self.user_resource_path)
logging.info(test_file_with_keys)
@@ -141,9 +147,6 @@ class TestRunner:
process.wait()
- # if test_file in TESTS_REQUIRING_SERVER:
- # self.stop_server()
-
if process.returncode > 0:
failed.append(test_file)
else:
@@ -151,7 +154,6 @@ class TestRunner:
self.log_exec_file(test_file, result=process.returncode)
- self.stop_server()
return {FAILED: failed, PASSED: passed}
@@ -174,10 +176,39 @@ class TestRunner:
self.rm_log_file()
+ def merge_dicts_of_lists(self, one, two):
+ if not one:
+ return two
+ if not two:
+ return one
+
+ ret = one.copy()
+
+ for key, value in two.iteritems():
+ if key in one:
+ ret[key] = ret[key].append(two[key])
+ else:
+ ret[key] = two[key]
+
+ return ret
+
+
def execute(self):
+
categorized_tests = self.categorize_tests()
- results = self.run_tests(categorized_tests[TO_RUN])
+
+ to_run_and_with_server_keys = [TO_RUN, WITH_SERVER]
+ random.shuffle(to_run_and_with_server_keys)
+
+ results = dict()
+
+ for key in to_run_and_with_server_keys:
+ if key == WITH_SERVER:
+ self.start_server()
+ results = self.merge_dicts_of_lists(results, self.run_tests(categorized_tests[key]))
+ if key == WITH_SERVER:
+ self.stop_server()
self.print_pretty("failed", results[FAILED])
self.print_pretty("skipped", categorized_tests[SKIP])
diff --git a/tools/testserver.py b/tools/testserver.py
index d39edb029e..34736ffbf1 100644
--- a/tools/testserver.py
+++ b/tools/testserver.py
@@ -53,7 +53,7 @@ except:
USE_TORNADO = False
-logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
+logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
PORT = 34568
LIFESPAN = 180.0 # timeout for the self destruction timer - how much time