Remove the fileutils hack for good.

Or, well, to be fair it still kind of does the same thing, but
the thing it's (void)ing in is a lot more related to what it
actually happening. I could not find another way to solve this
since fileutils is fundamentally optional to unit tests, but the
flag isn't.

Bug: webrtc:9792
Change-Id: I6ebf012246bc259883bc0aaf73ac7fea5525dd1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157101
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29501}
This commit is contained in:
Patrik Höglund 2019-10-16 10:24:35 +02:00 committed by Commit Bot
parent 64444bc865
commit 2bc1ea0b36
4 changed files with 4 additions and 33 deletions

View File

@ -264,12 +264,6 @@ if (rtc_include_tests) {
"//testing/gtest",
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
# TODO(bugs.webrtc.org/9792): This is needed for downstream projects on
# Android, where it's replaced by an internal version of fileutils that
# has a certain flag. Remove this once the internal fileutils has been
# eliminated.
"../test:fileutils",
]
}

View File

@ -27,8 +27,6 @@
#include "test/field_trial.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
#include "test/testsupport/file_utils_override.h"
#include "test/testsupport/perf_test.h"
#include "test/testsupport/resources_dir_flag.h"
@ -108,9 +106,10 @@ class TestMainImpl : public TestMain {
::testing::InitGoogleMock(argc, argv);
absl::ParseCommandLine(*argc, argv);
std::string resources_dir = absl::GetFlag(FLAGS_resources_dir);
if (!resources_dir.empty())
test::internal::OverrideResourcesDir(resources_dir);
// Make sure we always pull in the --resources_dir flag, even if the test
// binary doesn't link with fileutils (downstream expects all test mains to
// have this flag).
(void)absl::GetFlag(FLAGS_resources_dir);
// Default to LS_INFO, even for release builds to provide better test
// logging.
@ -130,13 +129,6 @@ class TestMainImpl : public TestMain {
rtc::tracing::StartInternalCapture(trace_event_path.c_str());
}
// TODO(bugs.webrtc.org/9792): we need to reference something from
// fileutils.h so that our downstream hack where we replace fileutils.cc
// works. Otherwise the downstream flag implementation will take over and
// botch the flag introduced by the hack. Remove this awful thing once the
// downstream implementation has been eliminated.
(void)webrtc::test::JoinFilename("horrible", "hack");
// InitFieldTrialsFromString stores the char*, so the char array must
// outlive the application.
field_trials_ = absl::GetFlag(FLAGS_force_fieldtrials);

View File

@ -150,12 +150,6 @@ std::string ResourcePath(const std::string& name,
#endif
}
void OverrideResourcesDir(const std::string& resources_dir) {
RTC_CHECK(false)
<< "Setting the resource dir is not supported in open-source "
"tests.";
}
} // namespace internal
} // namespace test
} // namespace webrtc

View File

@ -48,15 +48,6 @@ 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