summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-11-16 14:30:55 +0100
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-11-17 01:04:17 +0100
commit329118809bd4530125d04efd41f4dfdd978b4fae (patch)
treedf6589374eeb0255cea3f6a0e97c5ab8dab70bed
parent76d54780a70c2d2fbd95b3411d016b2111fccdc6 (diff)
downloadqtlocation-mapboxgl-329118809bd4530125d04efd41f4dfdd978b4fae.tar.gz
enable http server on tests
-rw-r--r--cmake/test-files.cmake2
-rw-r--r--platform/android/config.cmake5
-rw-r--r--test/src/mbgl/test/test.cpp15
3 files changed, 11 insertions, 11 deletions
diff --git a/cmake/test-files.cmake b/cmake/test-files.cmake
index 7b972df657..d5c4ca7ee4 100644
--- a/cmake/test-files.cmake
+++ b/cmake/test-files.cmake
@@ -58,6 +58,8 @@ set(MBGL_TEST_FILES
test/src/mbgl/test/test.cpp
test/src/mbgl/test/util.cpp
test/src/mbgl/test/util.hpp
+ test/src/mbgl/test/server.cpp
+ test/src/mbgl/test/server.hpp
# storage
test/storage/asset_file_source.test.cpp
diff --git a/platform/android/config.cmake b/platform/android/config.cmake
index 38cbb564a3..ac7ba54832 100644
--- a/platform/android/config.cmake
+++ b/platform/android/config.cmake
@@ -168,10 +168,6 @@ add_library(mbgl-test SHARED
# Actual tests
${MBGL_TEST_FILES}
- # Utilities
- test/include/mbgl/test.hpp
- test/src/mbgl/test/test.cpp
-
# Main test entry point
platform/android/src/test/main.jni.cpp
@@ -248,6 +244,7 @@ add_custom_target(copy-files
add_custom_target(_all ALL
DEPENDS mapbox-gl
+ DEPENDS mbgl-test
DEPENDS example-custom-layer
DEPENDS copy-files
)
diff --git a/test/src/mbgl/test/test.cpp b/test/src/mbgl/test/test.cpp
index db123ebedf..dfe2c77e1a 100644
--- a/test/src/mbgl/test/test.cpp
+++ b/test/src/mbgl/test/test.cpp
@@ -1,24 +1,25 @@
#include <mbgl/test.hpp>
#include <mbgl/test/util.hpp>
#include <mbgl/test/server.hpp>
+
#include <mbgl/util/thread.hpp>
+#include <mbgl/platform/log.hpp>
+
#include <gtest/gtest.h>
namespace mbgl {
int runTests(int argc, char *argv[]) {
#if TEST_HAS_SERVER
- std::cout << "Starting server\n";
+ Log::Info(Event::General, "Starting server");
util::Thread<test::Server> server({"Webserver"}, true);
server.invokeSync(&test::Server::start);
//Make sure the server is up before continueing
- httplib::Client cli("127.0.0.1", 3000);
- int resCode = cli.get("/test")->status;
- while(resCode !=200) {
- std::cout << "No response yet\n";
- usleep(1000*1000);
- resCode = cli.get("/test")->status;
+ httplib::Client client("127.0.0.1", 3000);
+ while (client.get("/test")->status != 200) {
+ Log::Info(Event::General, "No response yet, waiting for mock webserver");
+ usleep(1000 * 1000);
}
#endif