From 987ebe6b49aee5ab5f05db044b964928f3de5c84 Mon Sep 17 00:00:00 2001 From: Christoffer Jansson Date: Fri, 18 Nov 2022 16:50:35 +0100 Subject: [PATCH] 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 Commit-Queue: Christoffer Jansson Cr-Commit-Position: refs/heads/main@{#38695} --- test/testsupport/file_utils_override.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/testsupport/file_utils_override.cc b/test/testsupport/file_utils_override.cc index ac44e91b8a..7d0a3e3312 100644 --- a/test/testsupport/file_utils_override.cc +++ b/test/testsupport/file_utils_override.cc @@ -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 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 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 path_opt = ProjectRootPath(); RTC_DCHECK(path_opt);