Skip to content
Snippets Groups Projects
Commit e9efffe0 authored by Ambre Williams's avatar Ambre Williams Committed by CQ bot account: commit-bot@chromium.org
Browse files

[cloud_provider_memory_diff] run validation tests

This enables the cloud provider validation tests for the rust cloud
provider.

TEST=cloud_provider_memory_diff_tests runs on CQ

Change-Id: Ia1e0e6f5e79f1a4e18de69412a7848af442fddcd
parent e603c4cb
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,8 @@ group("ledger") {
"//src/ledger/bin:ledger_fuzzers",
"//src/ledger/bin/testing/ledger_test_instance_provider:ledger_test_instance_provider",
"//src/ledger/cloud_provider_in_memory/bin",
"//src/ledger/cloud_provider_memory_diff",
"//src/ledger/cloud_provider_memory_diff:cloud_provider_memory_diff_tests",
]
}
......
......@@ -34,3 +34,25 @@ package("cloud_provider_memory_diff") {
},
]
}
package("cloud_provider_memory_diff_tests") {
testonly = true
deps = [
"validation",
]
meta = [
{
path = rebase_path("validation/validation_memory_diff.cmx")
dest = "validation_memory_diff.cmx"
},
]
tests = [
{
name = "launch_validation_tests_memory_diff"
environments = basic_envs
},
]
}
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
visibility = [ "//src/ledger/cloud_provider_memory_diff/*" ]
executable("validation") {
output_name = "launch_validation_tests_memory_diff"
testonly = true
sources = [
"launch.cc",
]
deps = [
"//sdk/fidl/fuchsia.ledger.cloud",
"//src/ledger/bin/tests/cloud_provider/launcher",
"//src/lib/fxl",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/async-loop-cpp",
]
}
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <fuchsia/ledger/cloud/cpp/fidl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/async/cpp/task.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/sys/cpp/service_directory.h>
#include <iostream>
#include "src/ledger/bin/tests/cloud_provider/launcher/validation_tests_launcher.h"
#include "src/lib/fxl/logging.h"
#include "src/lib/fxl/strings/string_view.h"
namespace {
constexpr fxl::StringView kCloudProviderUrl =
"fuchsia-pkg://fuchsia.com/cloud_provider_memory_diff#meta/"
"cloud_provider_memory_diff.cmx";
} // namespace
int main(int argc, char** argv) {
async::Loop loop(&kAsyncLoopConfigAttachToThread);
std::unique_ptr<sys::ComponentContext> component_context =
sys::ComponentContext::Create();
fuchsia::sys::LauncherPtr component_launcher;
component_context->svc()->Connect(component_launcher.NewRequest());
cloud_provider::ValidationTestsLauncher launcher(
component_context.get(),
[component_launcher = std::move(component_launcher),
&loop](auto request) {
fuchsia::sys::LaunchInfo launch_info;
launch_info.url = kCloudProviderUrl.ToString();
auto cloud_provider_services = sys::ServiceDirectory::CreateWithRequest(
&launch_info.directory_request);
fuchsia::sys::ComponentControllerPtr cloud_instance;
component_launcher->CreateComponent(std::move(launch_info),
cloud_instance.NewRequest());
cloud_provider_services->Connect(
std::move(request), fuchsia::ledger::cloud::CloudProvider::Name_);
return cloud_instance;
});
int32_t return_code = -1;
async::PostTask(loop.dispatcher(), [&launcher, &return_code, &loop] {
launcher.Run({}, [&return_code, &loop](int32_t result) {
return_code = result;
loop.Quit();
});
});
loop.Run();
return return_code;
}
{
"program": {
"binary": "test/launch_validation_tests_memory_diff"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment