summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-02-03 16:18:37 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 11:54:01 +0100
commit73f7db9af2f76593856d64349a376412d292cd15 (patch)
treedb311e489246d41e6386f4c8bcc14da17e634c66 /test
parentf007c420ed4e2eadaedbbdd1c29912c6c8142fa1 (diff)
downloadqtlocation-mapboxgl-73f7db9af2f76593856d64349a376412d292cd15.tar.gz
cleanup makefiles
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/main.cpp27
-rw-r--r--test/fixtures/util.hpp1
-rw-r--r--test/headless/headless.cpp5
-rw-r--r--test/storage/storage.cpp4
-rw-r--r--test/test.gyp2
5 files changed, 7 insertions, 32 deletions
diff --git a/test/fixtures/main.cpp b/test/fixtures/main.cpp
index 303a0b9ab5..f7b2a6e92f 100644
--- a/test/fixtures/main.cpp
+++ b/test/fixtures/main.cpp
@@ -1,33 +1,6 @@
#include "util.hpp"
-#include <libgen.h>
-
-std::string baseDirectory;
-
-namespace mbgl {
-namespace test {
-
-const std::string &getBaseDirectory() {
- return baseDirectory;
-}
-
-}
-}
-
GTEST_API_ int main(int argc, char *argv[]) {
- // Note: glibc's dirname() **modifies** the argument and can't handle static strings.
- std::string file { __FILE__ };
- file = dirname(const_cast<char *>(file.c_str()));
- if (file[0] == '/') {
- // If __FILE__ is an absolute path, we don't have to guess from the argv 0.
- baseDirectory = file + "/..";
- } else {
- std::string argv0 { argv[0] }; argv0 = dirname(const_cast<char *>(argv0.c_str()));
- baseDirectory = argv0 + "/" + file + "/..";
- }
-
- fprintf(stderr, "basedir: %s\n", mbgl::test::getBaseDirectory().c_str());
-
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/test/fixtures/util.hpp b/test/fixtures/util.hpp
index f1201d34e7..dd8539c846 100644
--- a/test/fixtures/util.hpp
+++ b/test/fixtures/util.hpp
@@ -14,7 +14,6 @@
namespace mbgl {
namespace test {
-const std::string &getBaseDirectory();
pid_t startServer(const char *executable);
void stopServer(pid_t pid);
diff --git a/test/headless/headless.cpp b/test/headless/headless.cpp
index 20f5b5b3ae..e7e1153923 100644
--- a/test/headless/headless.cpp
+++ b/test/headless/headless.cpp
@@ -10,6 +10,7 @@
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
+#include <mbgl/platform/platform.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -29,7 +30,7 @@ void rewriteLocalScheme(rapidjson::Value &value, rapidjson::Document::AllocatorT
class HeadlessTest : public ::testing::TestWithParam<std::string> {
public:
static void SetUpTestCase() {
- const auto server = mbgl::test::getBaseDirectory() + "/headless/server.js";
+ const auto server = mbgl::platform::applicationRoot() + "/TEST_DATA/headless/server.js";
pid = mbgl::test::startServer(server.c_str());
display = std::make_shared<mbgl::HeadlessDisplay>();
}
@@ -165,7 +166,7 @@ TEST_P(HeadlessTest, render) {
INSTANTIATE_TEST_CASE_P(Headless, HeadlessTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
- const auto tests = mbgl::test::getBaseDirectory() + "/suite/tests";
+ const auto tests = mbgl::platform::applicationRoot() + "/TEST_DATA/suite/tests";
DIR *dir = opendir(tests.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
diff --git a/test/storage/storage.cpp b/test/storage/storage.cpp
index 99386a02ce..ddc6fef5fb 100644
--- a/test/storage/storage.cpp
+++ b/test/storage/storage.cpp
@@ -1,9 +1,11 @@
#include "storage.hpp"
+#include <mbgl/platform/platform.hpp>
+
pid_t Storage::pid = 0;
void Storage::SetUpTestCase() {
- const auto server = mbgl::test::getBaseDirectory() + "/storage/server.js";
+ const auto server = mbgl::platform::applicationRoot() + "/TEST_DATA/storage/server.js";
pid = mbgl::test::startServer(server.c_str());
}
diff --git a/test/test.gyp b/test/test.gyp
index 547a2d099b..1d80a4f830 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -73,7 +73,7 @@
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
- '-I<(boost_root)/include',
+ '<@(boost_cflags)',
],
'ldflags': [
'<@(uv_ldflags)',