Skip to content

Commit

Permalink
*: update dependency and tools (#648)
Browse files Browse the repository at this point in the history
- update bindgen to 0.69 to keep compatible with latest llvm
- update rand to 0.8
- update clap to 4
- update prost to 0.12
- fix clippy warnings (1.78.0)

Signed-off-by: Jay Lee <[email protected]>
  • Loading branch information
BusyJay authored May 6, 2024
1 parent 5442991 commit 2057a21
Show file tree
Hide file tree
Showing 39 changed files with 603 additions and 1,636 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ futures-executor = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] }
protobuf = { version = "2.0", optional = true }
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
prost = { version = "0.11", optional = true }
prost = { version = "0.12", optional = true }
bytes = { version = "1.0", optional = true }
log = "0.4"
parking_lot = "0.12"
Expand Down
8 changes: 4 additions & 4 deletions benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ futures-executor = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] }
libc = "0.2"
grpcio-sys = { path = "../grpc-sys" }
rand = "0.7"
rand_distr = "0.2"
rand_xorshift = "0.2"
rand = "0.8"
rand_distr = "0.4"
rand_xorshift = "0.3"
futures-timer = "3.0"
clap = "2.23"
clap = "4.5"
log = "0.4"
slog = "2.0"
slog-async = "2.1"
Expand Down
24 changes: 13 additions & 11 deletions benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@ use std::env;
use std::sync::Arc;

use benchmark::{init_log, Worker};
use clap::{App, Arg};
use clap::Parser;
use futures_channel::oneshot;
use grpc::{Environment, ServerBuilder, ServerCredentials};
use grpc_proto::testing::services_grpc::create_worker_service;
use rand::Rng;

const LOG_FILE: &str = "GRPCIO_BENCHMARK_LOG_FILE";

/// Benchmark QpsWorker
///
/// ref http://www.grpc.io/docs/guides/benchmarking.html.
#[derive(Parser)]
struct WorkerCli {
/// The port the worker should listen on. For example, 8080
#[arg(long)]
driver_port: Option<u16>,
}

fn main() {
let matches = App::new("Benchmark QpsWorker")
.about("ref http://www.grpc.io/docs/guides/benchmarking.html")
.arg(
Arg::with_name("port")
.long("driver_port")
.help("The port the worker should listen on. For example, \"8080\"")
.takes_value(true),
)
.get_matches();
let port: u16 = matches.value_of("port").unwrap_or("8080").parse().unwrap();
let cli = WorkerCli::parse();
let port = cli.driver_port.unwrap_or(8080);

let _log_guard = init_log(
env::var(LOG_FILE)
Expand Down
8 changes: 4 additions & 4 deletions compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ prost-codec = ["prost-build", "prost-types", "prost", "derive-new", "tempfile"]

[dependencies]
protobuf = { version = "2", optional = true }
prost = { version = "0.11", optional = true }
prost-build = { version = "0.11", optional = true }
prost-types = { version = "0.11", optional = true }
derive-new = { version = "0.5", optional = true }
prost = { version = "0.12", optional = true }
prost-build = { version = "0.12", optional = true }
prost-types = { version = "0.12", optional = true }
derive-new = { version = "0.6", optional = true }
tempfile = { version = "3.0", optional = true }

[[bin]]
Expand Down
4 changes: 2 additions & 2 deletions grpc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ _gen-bindings = ["bindgen"]
_list-package = []

[target.'cfg(not(all(any(target_os = "linux", target_os = "macos"), any(target_arch = "x86_64", target_arch = "aarch64"))))'.build-dependencies]
bindgen = "0.59.0"
bindgen = { version = "0.69.0", default-features = false, features = ["runtime"] }

[build-dependencies]
cc = "1.0"
cmake = "0.1"
pkg-config = "0.3"
walkdir = "2.2.9"
# Because of rust-lang/cargo#5237, bindgen should not be upgraded util a minor or major release.
bindgen = { version = "0.59.0", default-features = false, optional = true, features = ["runtime"] }
bindgen = { version = "0.69.0", default-features = false, optional = true, features = ["runtime"] }
boringssl-src = { version = "0.6.0", optional = true }
1,811 changes: 377 additions & 1,434 deletions grpc-sys/bindings/bindings.rs

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions grpc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ fn build_grpc(cc: &mut cc::Build, library: &str) {

fn figure_systemd_path(build_dir: &str) {
let path = format!("{build_dir}/CMakeCache.txt");
let f = BufReader::new(std::fs::File::open(&path).unwrap());
let f = BufReader::new(std::fs::File::open(path).unwrap());
let mut libdir: Option<String> = None;
let mut libname: Option<String> = None;
for l in f.lines() {
Expand Down Expand Up @@ -444,7 +444,6 @@ fn bindgen_grpc(file_path: &Path) {
.clang_arg("-xc++")
.clang_arg("-I./grpc/include")
.clang_arg("-std=c++11")
.rustfmt_bindings(true)
.impl_debug(true)
.size_t_is_usize(true)
.disable_header_comment()
Expand Down
1 change: 0 additions & 1 deletion grpc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ mod bindings {
mod grpc_wrap;

pub use bindings::*;
pub use grpc_wrap::*;
2 changes: 1 addition & 1 deletion health/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ prost-codec = ["grpcio/prost-codec", "prost"]
futures-executor = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std"] }
grpcio = { path = "..", version = "0.13.0", default-features = false }
prost = { version = "0.11", optional = true }
prost = { version = "0.12", optional = true }
protobuf = { version = "2", optional = true }
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
log = "0.4"
3 changes: 2 additions & 1 deletion health/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ mod protobuf_v3 {
#[cfg(feature = "protobuf-codec")]
mod reexports {
pub use super::protobuf::health::*;
pub use super::protobuf::health_grpc::*;
// Following is included in health import above.
// pub use super::protobuf::health_grpc::*;
}
#[cfg(feature = "protobufv3-codec")]
mod reexports {
Expand Down
1 change: 1 addition & 0 deletions health/src/proto/prost/grpc.health.v1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HealthCheckRequest {
Expand Down
18 changes: 14 additions & 4 deletions health/src/proto/protobuf_v3/health.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 3.2.0. Do not edit
// This file is generated by rust-protobuf 3.4.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -22,10 +22,10 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0;
const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_4_0;

#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct HealthCheckRequest {
// message fields
// @@protoc_insertion_point(field:grpc.health.v1.HealthCheckRequest.service)
Expand Down Expand Up @@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for HealthCheckRequest {
type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage<Self>;
}

#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckResponse)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct HealthCheckResponse {
// message fields
// @@protoc_insertion_point(field:grpc.health.v1.HealthCheckResponse.status)
Expand Down Expand Up @@ -300,6 +300,16 @@ pub mod health_check_response {
}
}

fn from_str(str: &str) -> ::std::option::Option<ServingStatus> {
match str {
"Unknown" => ::std::option::Option::Some(ServingStatus::Unknown),
"Serving" => ::std::option::Option::Some(ServingStatus::Serving),
"NotServing" => ::std::option::Option::Some(ServingStatus::NotServing),
"ServiceUnknown" => ::std::option::Option::Some(ServingStatus::ServiceUnknown),
_ => ::std::option::Option::None
}
}

const VALUES: &'static [ServingStatus] = &[
ServingStatus::Unknown,
ServingStatus::Serving,
Expand Down
2 changes: 1 addition & 1 deletion interop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protobufv3 = { package = "protobuf", version = "3.2", optional = true }
futures-executor = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std"] }
log = "0.4"
clap = "2.23"
clap = { version = "4.5", features = ["derive"] }
futures-timer = "3.0"

[[bin]]
Expand Down
89 changes: 33 additions & 56 deletions interop/src/bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,67 +7,44 @@ extern crate interop;

use crate::grpc::{ChannelBuilder, ChannelCredentialsBuilder, Environment};
use crate::grpc_proto::util;
use clap::{App, Arg};
use clap::Parser;
use std::sync::Arc;

use interop::Client;

/// Interoperability Test Client
///
/// ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md.
#[derive(Parser)]
struct ClientCli {
/// The server host to connect to. For example, "localhost" or "127.0.0.1"
#[arg(long)]
host: Option<String>,
/// The server host client pretend to connect. It's used for testing SSL/TLS to an arbitrary host.
#[arg(long)]
host_override: Option<String>,
/// The server port to connect to. For example, 8080
#[arg(long)]
port: Option<u16>,
/// The name of the test case to execute. For example, "empty_unary"
#[arg(long)]
case: Option<String>,
/// Whether to use a plaintext or encrypted connection
#[arg(long)]
use_tls: Option<bool>,
/// Whether to replace platform root CAs with ca.pem as the CA root
#[arg(long)]
use_test_ca: Option<bool>,
}

fn main() {
let matches = App::new("Interoperability Test Client")
.about("ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md")
.arg(
Arg::with_name("host")
.long("server_host")
.help("The server host to connect to. For example, \"localhost\" or \"127.0.0.1\"")
.takes_value(true),
)
.arg(
Arg::with_name("host_override")
.long("server_host_override")
.help("The server host to connect to. For example, \"localhost\" or \"127.0.0.1\"")
.takes_value(true),
)
.arg(
Arg::with_name("port")
.long("server_port")
.help("The server port to connect to. For example, \"8080\"")
.takes_value(true),
)
.arg(
Arg::with_name("case")
.long("test_case")
.help("The name of the test case to execute. For example, \"empty_unary\"")
.takes_value(true),
)
.arg(
Arg::with_name("use_tls")
.long("use_tls")
.help("Whether to use a plaintext or encrypted connection")
.takes_value(true),
)
.arg(
Arg::with_name("use_test_ca")
.long("use_test_ca")
.help("Whether to replace platform root CAs with ca.pem as the CA root")
.takes_value(true),
)
.get_matches();
let host = matches.value_of("host").unwrap_or("127.0.0.1");
let host_override = matches
.value_of("host_override")
.unwrap_or("foo.test.google.fr");
let port = matches.value_of("port").unwrap_or("8080");
let case = matches.value_of("case");
let use_tls: bool = matches
.value_of("use_tls")
.unwrap_or("false")
.parse()
.unwrap();
let use_test_ca: bool = matches
.value_of("use_test_ca")
.unwrap_or("false")
.parse()
.unwrap();
let cli = ClientCli::parse();
let host = cli.host.as_deref().unwrap_or("127.0.0.1");
let host_override = cli.host_override.as_deref().unwrap_or("foo.test.google.fr");
let port = cli.port.unwrap_or(8080);
let case = cli.case.as_deref();
let use_tls = cli.use_tls.unwrap_or(false);
let use_test_ca = cli.use_test_ca.unwrap_or(false);

let env = Arc::new(Environment::new(1));
let mut builder = ChannelBuilder::new(env).override_ssl_target(host_override.to_owned());
Expand Down
50 changes: 21 additions & 29 deletions interop/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,34 @@ extern crate log;

use std::sync::Arc;

use clap::{App, Arg};
use clap::Parser;
use futures_executor::block_on;
use grpc::{Environment, ServerBuilder, ServerCredentials};
use grpc_proto::testing::test_grpc::create_test_service;
use grpc_proto::util;
use interop::InteropTestService;

/// Interoperability Test Server
///
/// ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md.
#[derive(Parser)]
struct ServerCli {
/// The server host to listen to. For example, "localhost" or "127.0.0.1"
#[arg(long)]
host: Option<String>,
/// The port to listen on. For example, 8080
#[arg(long)]
port: Option<u16>,
/// Whether to use a plaintext or encrypted connection
#[arg(long)]
use_tls: Option<bool>,
}

fn main() {
let matches = App::new("Interoperability Test Server")
.about("ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md")
.arg(
Arg::with_name("host")
.long("host")
.help("The server host to listen to. For example, \"localhost\" or \"127.0.0.1\"")
.takes_value(true),
)
.arg(
Arg::with_name("port")
.long("port")
.help("The port to listen on. For example, \"8080\"")
.takes_value(true),
)
.arg(
Arg::with_name("use_tls")
.long("use_tls")
.help("Whether to use a plaintext or encrypted connection")
.takes_value(true),
)
.get_matches();
let host = matches.value_of("host").unwrap_or("127.0.0.1");
let mut port: u16 = matches.value_of("port").unwrap_or("8080").parse().unwrap();
let use_tls: bool = matches
.value_of("use_tls")
.unwrap_or("false")
.parse()
.unwrap();
let cli = ServerCli::parse();
let host = cli.host.as_deref().unwrap_or("127.0.0.1");
let mut port: u16 = cli.port.unwrap_or(8080);
let use_tls: bool = cli.use_tls.unwrap_or(false);

let env = Arc::new(Environment::new(2));
let service = create_test_service(InteropTestService);
Expand Down
2 changes: 1 addition & 1 deletion interop/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Client {

pub async fn server_streaming(&self) -> grpcio::Result<()> {
print!("testing server streaming ... ");
let sizes = vec![31415, 9, 2653, 58979];
let sizes = [31415, 9, 2653, 58979];
let req = StreamingOutputCallRequest {
response_parameters: sizes
.iter()
Expand Down
2 changes: 1 addition & 1 deletion interop/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl TestService for InteropTestService {
}

let mut resp = StreamingOutputCallResponse::default();
if let Some(param) = req.response_parameters.get(0) {
if let Some(param) = req.response_parameters.first() {
resp.payload = Some(util::new_payload(param.size as usize)).into();
}
// A workaround for timeout_on_sleeping_server test.
Expand Down
8 changes: 4 additions & 4 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ prost-codec = ["prost-build", "prost-derive", "prost-types", "bytes", "lazy_stat
[dependencies]
grpcio = { path = "..", features = ["boringssl"], version = "0.13.0", default-features = false }
bytes = { version = "1.0", optional = true }
prost = { version = "0.11", optional = true }
prost-derive = { version = "0.11", optional = true }
prost-types = { version = "0.11", optional = true }
prost = { version = "0.12", optional = true }
prost-derive = { version = "0.12", optional = true }
prost-types = { version = "0.12", optional = true }
protobuf = { version = "2", optional = true }
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
lazy_static = { version = "1.3", optional = true }

[build-dependencies]
prost-build = { version = "0.11", optional = true }
prost-build = { version = "0.12", optional = true }
walkdir = "2.2"
Loading

0 comments on commit 2057a21

Please sign in to comment.