Skip to content

Commit

Permalink
Merge pull request #327 from Berrysoft/ci/illumos
Browse files Browse the repository at this point in the history
ci: add illumos one
  • Loading branch information
Berrysoft authored Nov 19, 2024
2 parents 8fcbc9a + 53258bf commit a918ab0
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci_test_freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
46 changes: 46 additions & 0 deletions .github/workflows/ci_test_illumos.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion compio-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
5 changes: 4 additions & 1 deletion compio-quic/benches/quic.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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};

Expand Down Expand Up @@ -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)),
&(),
Expand Down
48 changes: 44 additions & 4 deletions compio-quic/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"
))]
Expand Down Expand Up @@ -364,7 +374,15 @@ impl Socket {
// ECN
#[cfg(unix)]
(libc::IPPROTO_IP, libc::IP_TOS) => ecn_bits = *cmsg.data::<u8>(),
#[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::<u8>(),
#[cfg(unix)]
(libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => {
Expand All @@ -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",
))]
Expand Down Expand Up @@ -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")]
Expand All @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions compio-quic/tests/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a918ab0

Please sign in to comment.