File: main.rs

package info (click to toggle)
rust-interprocess 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 980 kB
  • sloc: makefile: 2
file content (37 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#![cfg(feature = "tokio_support")]
#[path = "../util/mod.rs"]
mod util;
use util::TestResult;

mod no_server;
mod stream;

use {interprocess::local_socket::NameTypeSupport, tokio::try_join};

#[tokio::test]
async fn tokio_local_socket_stream() -> TestResult {
    use stream::*;
    // If only one name type is supported, this one will choose the supported one. If both are
    // supported, this will try paths first.
    let f1 = util::tokio::drive_server_and_multiple_clients(|s, n| server(s, n, false), client);
    if NameTypeSupport::query() == NameTypeSupport::Both {
        // Try the namespace now.
        let f2 = util::tokio::drive_server_and_multiple_clients(|s, n| server(s, n, true), client);
        try_join!(f1, f2)?;
    } else {
        f1.await?;
    }
    Ok(())
}
#[tokio::test]
async fn tokio_local_socket_no_server() -> TestResult {
    // Same as above.
    let f1 = no_server::run_and_verify_error(false);
    if NameTypeSupport::query() == NameTypeSupport::Both {
        let f2 = no_server::run_and_verify_error(true);
        try_join!(f1, f2)?;
    } else {
        f1.await?;
    }
    Ok(())
}