[build] switch to CMake

This is very much a work in progress.
This commit is contained in:
Konstantin Käfer
2016-06-03 18:05:04 +02:00
parent e3ee55b28d
commit 692fe1f3ff
83 changed files with 2009 additions and 2767 deletions

View File

@@ -1,5 +1,20 @@
#include <mbgl/test.hpp>
#include <unistd.h>
#include <cstring>
#include <cerrno>
#include <cstdio>
#define xstr(s) str(s)
#define str(s) #s
int main(int argc, char *argv[]) {
#ifdef WORK_DIRECTORY
const int result = chdir(xstr(WORK_DIRECTORY));
if (result != 0) {
fprintf(stderr, "failed to change directory: %s\n", strerror(errno));
return errno;
}
#endif
return mbgl::runTests(argc, argv);
}

View File

@@ -14,10 +14,17 @@
#include <unistd.h>
#ifndef NODE_EXECUTABLE
#define NODE_EXECUTABLE node
#endif
#define xstr(s) str(s)
#define str(s) #s
namespace mbgl {
namespace test {
Server::Server(const char* executable) {
Server::Server(const char* script) {
int input[2];
int output[2];
@@ -48,14 +55,18 @@ Server::Server(const char* executable) {
close(output[1]);
close(output[0]);
const char* executable = xstr(NODE_EXECUTABLE);
fprintf(stderr, "executable: %s\n", executable);
// Launch the actual server process.
int ret = execl(executable, executable, nullptr);
int ret = execl(executable, executable, script, nullptr);
// This call should not return. In case execl failed, we exit anyway.
if (ret < 0) {
Log::Error(Event::Setup, "Failed to start server: %s", strerror(errno));
}
exit(0);
abort();
} else {
// This is the parent process.

View File

@@ -59,7 +59,7 @@ namespace test {
class Server {
public:
Server(const char* executable);
Server(const char* script);
~Server();
private: