Add Fuchsia filesystem specific handling

This unlocks many tests, at least locally.

Bug: b/232740856
Change-Id: Icd8d099aabf6f81906d7c6b3b40f47b501496c6b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284141
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Christoffer Jansson <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38695}
This commit is contained in:
Christoffer Jansson
2022-11-18 16:50:35 +01:00
committed by WebRTC LUCI CQ
parent 538fa81328
commit 987ebe6b49

View File

@ -69,7 +69,10 @@ const absl::string_view kPathDelimiter = "/";
const absl::string_view kAndroidChromiumTestsRoot =
"/sdcard/chromium_tests_root/";
#endif
#if defined(WEBRTC_FUCHSIA)
const absl::string_view kFuchsiaTestRoot = "/pkg/";
const absl::string_view kFuchsiaTempWritableDir = "/tmp/";
#endif
#if !defined(WEBRTC_IOS)
const absl::string_view kResourcesDirName = "resources";
#endif
@ -91,6 +94,11 @@ absl::optional<std::string> ProjectRootPath() {
// the test is bundled (which our tests are not), in which case it's 5 levels.
return DirName(DirName(exe_dir)) + std::string(kPathDelimiter);
#elif defined(WEBRTC_POSIX)
// Fuchsia uses POSIX defines as well but does not have full POSIX
// functionality.
#if defined(WEBRTC_FUCHSIA)
return std::string(kFuchsiaTestRoot);
#else
char buf[PATH_MAX];
ssize_t count = ::readlink("/proc/self/exe", buf, arraysize(buf));
if (count <= 0) {
@ -100,6 +108,7 @@ absl::optional<std::string> ProjectRootPath() {
// On POSIX, tests execute in out/Whatever, so src is two levels up.
std::string exe_dir = DirName(absl::string_view(buf, count));
return DirName(DirName(exe_dir)) + std::string(kPathDelimiter);
#endif
#elif defined(WEBRTC_WIN)
wchar_t buf[MAX_PATH];
buf[0] = 0;
@ -117,6 +126,8 @@ std::string OutputPath() {
return IOSOutputPath();
#elif defined(WEBRTC_ANDROID)
return std::string(kAndroidChromiumTestsRoot);
#elif defined(WEBRTC_FUCHSIA)
return std::string(kFuchsiaTempWritableDir);
#else
absl::optional<std::string> path_opt = ProjectRootPath();
RTC_DCHECK(path_opt);