Skip to content

Commit

Permalink
try debug aarch64 musl hw error
Browse files Browse the repository at this point in the history
  • Loading branch information
Taowyoo committed Nov 8, 2022
1 parent c05b3f9 commit 410eb29
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mbedtls/tests/hyper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ mod tests {
#[test_case(1, test_name="test_simple_request_tls1_3")]
fn test_simple_request(ver_int : u32) {
// use mutex to avoid too much request at same time
support::TEST_MUTEX.clear_poison();
let _guard = support::TEST_MUTEX.lock().unwrap();

let mut config = Config::new(Endpoint::Client, Transport::Stream, Preset::Default);
Expand All @@ -205,6 +206,12 @@ mod tests {
config.set_min_version(Version::from(ver_int)).unwrap();
config.set_ca_list(Arc::new(Certificate::from_pem_multiple(GOOGLE_ROOT_CA_CERT).unwrap()), None);

// This is mostly as an example - how to debug mbedtls
let dbg_callback = |level: i32, file: Cow<'_, str>, line: i32, message: Cow<'_, str>| {
println!("{} {}:{} {}", level, file, line, message);
};
config.set_dbg_callback(dbg_callback);

let ssl = MbedSSLClient::new(Arc::new(config), true);
let connector = HttpsConnector::new(ssl);
let client = hyper::Client::with_connector(Pool::with_connector(Default::default(), connector));
Expand All @@ -219,6 +226,7 @@ mod tests {
#[test_case(1, test_name="test_multiple_request_tls1_3")]
fn test_multiple_request(ver_int : u32) {
// use mutex to avoid too much request at same time
support::TEST_MUTEX.clear_poison();
let _guard = support::TEST_MUTEX.lock().unwrap();

let mut config = Config::new(Endpoint::Client, Transport::Stream, Preset::Default);
Expand All @@ -228,6 +236,12 @@ mod tests {
config.set_min_version(Version::from(ver_int)).unwrap();
config.set_ca_list(Arc::new(Certificate::from_pem_multiple(GOOGLE_ROOT_CA_CERT).unwrap()), None);

// This is mostly as an example - how to debug mbedtls
let dbg_callback = |level: i32, file: Cow<'_, str>, line: i32, message: Cow<'_, str>| {
println!("{} {}:{} {}", level, file, line, message);
};
config.set_dbg_callback(dbg_callback);

// Immutable from this point on
let ssl = MbedSSLClient::new(Arc::new(config), true);

Expand All @@ -248,6 +262,7 @@ mod tests {
#[test_case(1, test_name="test_hyper_multithread_tls1_3")]
fn test_hyper_multithread(ver_int: u32) {
// use mutex to avoid too much request at same time
support::TEST_MUTEX.clear_poison();
let _guard = support::TEST_MUTEX.lock().unwrap();

let mut config = Config::new(Endpoint::Client, Transport::Stream, Preset::Default);
Expand All @@ -257,6 +272,12 @@ mod tests {
config.set_min_version(Version::from(ver_int)).unwrap();
config.set_ca_list(Arc::new(Certificate::from_pem_multiple(GOOGLE_ROOT_CA_CERT).unwrap()), None);

// This is mostly as an example - how to debug mbedtls
let dbg_callback = |level: i32, file: Cow<'_, str>, line: i32, message: Cow<'_, str>| {
println!("{} {}:{} {}", level, file, line, message);
};
config.set_dbg_callback(dbg_callback);

let ssl = MbedSSLClient::new(Arc::new(config), true);
let client = Arc::new(hyper::Client::with_connector(Pool::with_connector(Default::default(), HttpsConnector::new(ssl.clone()))));

Expand Down

0 comments on commit 410eb29

Please sign in to comment.