Move --resources_dir to its right place.

We needed a hack in test_main_lib.cc to ensure fileutils were always
linked with test binaries downstream. When I removed the hack, it
broke the binaries that were _not_ using fileutils because a certain
bazel rule expects to be able to pass the flag to all test binaries.

The solution is to move the flag to test_main_lib.cc. This is the
right place for it since it's apparently in the contract of a WebRTC
test binary to support this flag. We then have to pass the value
down to the override, which is why I add a new function for that.
I leave the flag unimplemented in OSS because no one is using it
here anyway. It will be implemented downstream.

Bug: webrtc:9792
Change-Id: I21b3deb43bf0cd56d6aa2622dc5519370a0307a9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156568
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29474}
This commit is contained in:
Patrik Höglund
2019-10-14 10:12:18 +02:00
committed by Commit Bot
parent 3f0d8e46a8
commit 2f28370e65
4 changed files with 30 additions and 2 deletions

View File

@ -38,8 +38,7 @@ std::string OutputPath();
// directory.
std::string WorkingDir();
// Returns a path to a resource file in [project-root]/resources/ dir.
// Returns an absolute path
// Returns a full path to a resource file in the resources_dir dir.
//
// Arguments:
// name - Name of the resource file. If a plain filename (no directory path)
@ -49,6 +48,15 @@ std::string WorkingDir();
// extension - File extension, without the dot, i.e. "bmp" or "yuv".
std::string ResourcePath(const std::string& name, const std::string& extension);
// Overrides the root resource dir. See ResourcePath for more information.
//
// This is not necessary in most cases, but it can be if we're running on
// phones and copy over resources to some custom location.
//
// Arguments:
// resources_dir - Where resources are located.
void OverrideResourcesDir(const std::string& resources_dir);
} // namespace internal
} // namespace test
} // namespace webrtc