diff --git a/.github/workflows/ci_test_freebsd.yml b/.github/workflows/ci_test_freebsd.yml index 55259b3f..1474a291 100644 --- a/.github/workflows/ci_test_freebsd.yml +++ b/.github/workflows/ci_test_freebsd.yml @@ -12,9 +12,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true -env: - RUST_BACKTRACE: 1 - jobs: test: runs-on: ubuntu-latest @@ -46,4 +43,4 @@ jobs: ARGS="$ARGS --features nightly" fi - cargo +${{ matrix.toolchain }} test --workspace $ARGS + RUST_BACKTRACE=1 cargo +${{ matrix.toolchain }} test --workspace $ARGS diff --git a/.github/workflows/ci_test_illumos.yml b/.github/workflows/ci_test_illumos.yml new file mode 100644 index 00000000..a996fac1 --- /dev/null +++ b/.github/workflows/ci_test_illumos.yml @@ -0,0 +1,46 @@ +name: TestIllumos + +on: + push: + branches: + - master + pull_request: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: ["nightly", "beta", "stable"] + steps: + - uses: actions/checkout@v4 + - name: Test in Illumos + id: test + uses: vmactions/omnios-vm@v1 + with: + usesh: true + sync: rsync + copyback: false + prepare: | + pkg install gcc14 curl pkg-config glib2 + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf > install.sh + chmod +x install.sh + ./install.sh -y --default-toolchain ${{ matrix.toolchain }} --profile minimal + run: | + . "$HOME/.cargo/env" + set -ex + + ARGS="--features all" + + # Add feature "nightly" if toolchain is nightly + if [ "${{ matrix.toolchain }}" = "nightly" ]; then + ARGS="$ARGS --features nightly" + fi + + RUST_BACKTRACE=1 cargo +${{ matrix.toolchain }} test --workspace $ARGS diff --git a/compio-quic/Cargo.toml b/compio-quic/Cargo.toml index bceb11ce..ce860372 100644 --- a/compio-quic/Cargo.toml +++ b/compio-quic/Cargo.toml @@ -51,13 +51,15 @@ compio-runtime = { workspace = true, features = ["criterion"] } criterion = { workspace = true, features = ["async_tokio"] } http = "1.1.0" -quinn = "0.11.5" rand = { workspace = true } rcgen = "0.13.1" socket2 = { workspace = true, features = ["all"] } tokio = { workspace = true, features = ["rt", "macros"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } +[target.'cfg(not(any(target_os = "illumos", target_os = "solaris")))'.dev-dependencies] +quinn = "0.11.5" + [features] default = [] io-compat = ["futures-util/io"] diff --git a/compio-quic/benches/quic.rs b/compio-quic/benches/quic.rs index 106d27e2..24c7681c 100644 --- a/compio-quic/benches/quic.rs +++ b/compio-quic/benches/quic.rs @@ -1,7 +1,8 @@ +use std::time::Instant; +#[cfg(not(any(target_os = "illumos", target_os = "solaris")))] use std::{ net::{IpAddr, Ipv4Addr, SocketAddr}, sync::Arc, - time::Instant, }; use compio_buf::bytes::Bytes; @@ -104,6 +105,7 @@ fn echo_compio_quic(b: &mut Bencher, content: &[u8], streams: usize) { }) } +#[cfg(not(any(target_os = "illumos", target_os = "solaris")))] fn echo_quinn(b: &mut Bencher, content: &[u8], streams: usize) { use quinn::{ClientConfig, Endpoint, ServerConfig}; @@ -182,6 +184,7 @@ fn echo(c: &mut Criterion) { &(), |b, _| echo_compio_quic(b, data, streams), ); + #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] group.bench_with_input( BenchmarkId::new("quinn", format!("{}-streams-{}-bytes", streams, size)), &(), diff --git a/compio-quic/src/socket.rs b/compio-quic/src/socket.rs index 163923d8..1537d104 100644 --- a/compio-quic/src/socket.rs +++ b/compio-quic/src/socket.rs @@ -196,7 +196,15 @@ impl Socket { // ECN if is_ipv4 { - #[cfg(all(unix, not(any(target_os = "openbsd", target_os = "netbsd"))))] + #[cfg(all( + unix, + not(any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "illumos", + target_os = "solaris" + )) + ))] set_socket_option!(socket, libc::IPPROTO_IP, libc::IP_RECVTOS, &1); #[cfg(windows)] set_socket_option!(socket, WinSock::IPPROTO_IP, WinSock::IP_ECN, &1); @@ -216,6 +224,8 @@ impl Socket { target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", + target_os = "illumos", + target_os = "solaris", target_os = "macos", target_os = "ios" ))] @@ -364,7 +374,15 @@ impl Socket { // ECN #[cfg(unix)] (libc::IPPROTO_IP, libc::IP_TOS) => ecn_bits = *cmsg.data::(), - #[cfg(all(unix, not(any(target_os = "openbsd", target_os = "netbsd"))))] + #[cfg(all( + unix, + not(any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "illumos", + target_os = "solaris" + )) + ))] (libc::IPPROTO_IP, libc::IP_RECVTOS) => ecn_bits = *cmsg.data::(), #[cfg(unix)] (libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => { @@ -387,6 +405,8 @@ impl Socket { target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", + target_os = "illumos", + target_os = "solaris", target_os = "macos", target_os = "ios", ))] @@ -474,6 +494,8 @@ impl Socket { target_os = "netbsd", target_os = "macos", target_os = "ios", + target_os = "illumos", + target_os = "solaris", ))] { #[cfg(target_os = "freebsd")] @@ -483,6 +505,8 @@ impl Socket { target_os = "netbsd", target_os = "macos", target_os = "ios", + target_os = "illumos", + target_os = "solaris", ))] let encode_src_ip_v4 = true; @@ -678,7 +702,15 @@ mod tests { } #[compio_macros::test] - #[cfg_attr(any(target_os = "openbsd", target_os = "netbsd"), ignore)] + #[cfg_attr( + any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "illumos", + target_os = "solaris" + ), + ignore + )] async fn ecn_v4() { let passive = Socket::new(UdpSocket::bind("127.0.0.1:0").await.unwrap()).unwrap(); let active = Socket::new(UdpSocket::bind("127.0.0.1:0").await.unwrap()).unwrap(); @@ -740,7 +772,15 @@ mod tests { } #[compio_macros::test] - #[cfg_attr(any(target_os = "openbsd", target_os = "netbsd"), ignore)] + #[cfg_attr( + any( + target_os = "openbsd", + target_os = "netbsd", + target_os = "illumos", + target_os = "solaris" + ), + ignore + )] async fn ecn_v4_mapped_v6() { let passive = Socket::new(UdpSocket::bind("127.0.0.1:0").await.unwrap()).unwrap(); let active = Socket::new(bind_udp_dualstack().unwrap()).unwrap(); diff --git a/compio-quic/tests/echo.rs b/compio-quic/tests/echo.rs index f3a90835..fccc6a16 100644 --- a/compio-quic/tests/echo.rs +++ b/compio-quic/tests/echo.rs @@ -140,6 +140,8 @@ async fn echo_v4() { target_os = "openbsd", target_os = "netbsd", target_os = "freebsd", + target_os = "illumos", + target_os = "solaris", windows ), ignore