Replace platform-specific code with std::filesystem in MBTiles test (#2634)
This commit is contained in:
@@ -45,9 +45,17 @@ To run the instrumentation tests, choose the "Instrumentation Tests" run configu
|
||||
|
||||
Your device needs remain unlocked for the duration of the tests.
|
||||
|
||||
## C++ Unit Tests
|
||||
|
||||
There is a separate Gradle project that contains a test app which runs the C++ Unit Tests. It does not depend on the Android platform implementations.
|
||||
|
||||
You can find the project in `test/android.` You can open this project in Android Studio and run the C++ Tests on an Android device or Simulator.
|
||||
|
||||
To run a particular set of tests you can modify the `--gtest_filter` flag in `platform/android/src/test/test_runner.cpp`. See the [GoogleTest documentation](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) for details how to use this flag.
|
||||
|
||||
### AWS Device Farm
|
||||
|
||||
The instrumentation tests are running on AWS Device Farm. To see the results and the logs, go to:
|
||||
The instrumentation tests and C++ unit tests are running on AWS Device Farm. To see the results and the logs, go to:
|
||||
|
||||
https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-east-1#/mobile/projects/20687d72-0e46-403e-8f03-0941850665bc/runs
|
||||
|
||||
|
||||
@@ -4,30 +4,16 @@
|
||||
#include <mbgl/util/platform.hpp>
|
||||
#include <mbgl/util/run_loop.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include <climits>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <Windows.h>
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX MAX_PATH
|
||||
#endif /* PATH_MAX */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
std::string toAbsoluteURL(const std::string &fileName) {
|
||||
char buff[PATH_MAX + 1];
|
||||
#ifdef _MSC_VER
|
||||
char *cwd = _getcwd(buff, PATH_MAX + 1);
|
||||
#else
|
||||
char *cwd = getcwd(buff, PATH_MAX + 1);
|
||||
#endif
|
||||
std::string url = {"mbtiles://" + std::string(cwd) + "/test/fixtures/storage/mbtiles/" + fileName};
|
||||
assert(url.size() <= PATH_MAX);
|
||||
return url;
|
||||
auto path = std::filesystem::current_path() / "test/fixtures/storage/mbtiles" / fileName;
|
||||
return "mbtiles://" + std::string(path);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user