Files
MapLibreParticleLab/benchmark/ios/ios_test_runner.cpp
Bart Louwers 550f64be22 core: rename mbgl namespace to mln (#4487)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-14 23:25:20 +02:00

35 lines
1.1 KiB
C++

#include <ios_test_runner.hpp>
#include <mbgl/benchmark.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-benchmark-runner",
"--benchmark_repetitions=10",
"--benchmark_format=json",
"--benchmark_out=" + basePath + "/benchmark/results.json"};
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())) {
mln::Log::Error(mln::Event::General, "Failed to change the directory to " + basePath);
return false;
}
mln::Log::Info(mln::Event::General, "Start BenchmarkRunner");
int status = mln::runBenchmark(static_cast<uint32_t>(argv.size()), argv.data());
mln::Log::Info(mln::Event::General, "BenchmarkRunner finished with status: '%d'", status);
return status == 0;
}