diff options
Diffstat (limited to 'test/ios/ios_test_runner.cpp')
-rw-r--r-- | test/ios/ios_test_runner.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/ios/ios_test_runner.cpp b/test/ios/ios_test_runner.cpp new file mode 100644 index 0000000000..293a2955b5 --- /dev/null +++ b/test/ios/ios_test_runner.cpp @@ -0,0 +1,31 @@ +#include "ios_test_runner.hpp" + +#include <mbgl/test.hpp> + +#include <mbgl/util/logging.hpp> + +#include <unistd.h> +#include <vector> + +#define EXPORT __attribute__((visibility("default"))) + +EXPORT +bool TestRunner::startTest(const std::string& basePath) { + std::vector<std::string> arguments = {"mbgl-test-runner", "--gtest_output=xml:" + basePath + "/test/results.xml"}; + std::vector<char*> argv; + for (const auto& arg : arguments) { + argv.push_back(const_cast<char*>(arg.data())); + } + argv.push_back(nullptr); + + if (chdir(basePath.c_str())) { + mbgl::Log::Error(mbgl::Event::General, "Failed to change the directory to " + basePath); + return false; + } + + mbgl::Log::Info(mbgl::Event::General, "Start TestRunner"); + int status = mbgl::runTests(static_cast<uint32_t>(argv.size()), argv.data()); + mbgl::Log::Info(mbgl::Event::General, "TestRunner finished with status: '%d'", status); + + return status == 0; +} |