Commit 90f3c584 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

[fuchsia] Fix net tests by deploying configs to new "/test-shared" dir.

Net tests broke because test process' /data directories are now isolated
and can't be used for sharing data out-of-process. The net test launcher
depends on the old behavior for deploying configuration files to test
code.

This CL designates a special path "/data/shared" into which shared
files will be placed. The shared directory will be mounted at
"/test-shared" in the test process' namespace.

The net test launcher & test code are modified to use the new paths.

TBR=mmenke@chromium.org

Bug: 891732
Change-Id: Id94bffe05a3b140ed60e42507cdc8d238677f202
Reviewed-on: https://chromium-review.googlesource.com/c/1259829
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597193}
parent ad61fb27
......@@ -364,6 +364,21 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
base::File::FLAG_DELETE_ON_CLOSE))
.release()});
// The test launcher can use a shared data directory for providing tests with
// files deployed at runtime. The files are located under the directory
// "/data/shared". They will be mounted at "/test-shared" under the child
// process' namespace.
const base::FilePath kSharedDataSourcePath("/data/shared");
const base::FilePath kSharedDataTargetPath("/test-shared");
if (base::PathExists(kSharedDataSourcePath)) {
zx::handle shared_directory_handle = base::fuchsia::GetHandleFromFile(
base::File(kSharedDataSourcePath,
base::File::FLAG_OPEN | base::File::FLAG_READ |
base::File::FLAG_DELETE_ON_CLOSE));
new_options.paths_to_transfer.push_back(
{kSharedDataTargetPath, shared_directory_handle.release()});
}
#endif // defined(OS_FUCHSIA)
#if defined(OS_LINUX)
......
......@@ -130,6 +130,7 @@ def SetupTestServer(target, test_concurrency):
}))
config_file.flush()
target.PutFile(config_file.name, '/data/net-test-server-config')
target.RunCommand(['mkdir /data/shared'])
target.PutFile(config_file.name, '/data/shared/net-test-server-config')
return spawning_server
......@@ -29,7 +29,7 @@ base::FilePath GetTestServerConfigFilePath() {
#if defined(OS_ANDROID)
base::PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &dir);
#elif defined(OS_FUCHSIA)
dir = base::FilePath("/data");
dir = base::FilePath("/test-shared");
#else
base::PathService::Get(base::DIR_TEMP, &dir);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment