diff --git a/.github/workflows/build-rust.yml b/.github/workflows/build-rust.yml index 7955d62..f56e26b 100644 --- a/.github/workflows/build-rust.yml +++ b/.github/workflows/build-rust.yml @@ -17,21 +17,24 @@ jobs: platform: Linux packages: - gcc-aarch64-linux-gnu - targets: + test-targets: - x86_64-unknown-linux-gnu + targets: - aarch64-unknown-linux-gnu - os: macos-12 platform: macOS - targets: + test-targets: - x86_64-apple-darwin + targets: - aarch64-apple-darwin - aarch64-apple-ios - aarch64-apple-ios-sim - x86_64-apple-ios - os: windows-2022 platform: Windows - targets: + test-targets: - x86_64-pc-windows-msvc + targets: - aarch64-pc-windows-msvc runs-on: ${{ matrix.os }} env: @@ -59,7 +62,7 @@ jobs: targets: ${{ join(matrix.targets, ', ') }} - name: Build shell: bash - run: cargo build --verbose --workspace --all-features --target ${{ join(matrix.targets, ' --target ') }} - - name: Post-Build Tests + run: cargo build --verbose --workspace --all-features --target ${{ join(matrix.targets, ' --target ') }} --target ${{ join(matrix.test-targets, ' --target ') }} + - name: Test shell: bash - run: cargo test + run: cargo test --verbose --workspace --all-features --target ${{ join(matrix.test-targets, ' --target ') }} diff --git a/tun/tests/configure.rs b/tun/tests/configure.rs index 1d762d7..35f9726 100644 --- a/tun/tests/configure.rs +++ b/tun/tests/configure.rs @@ -1,6 +1,6 @@ use fehler::throws; use std::io::Error; -use std::net::{Ipv4Addr}; +use std::net::Ipv4Addr; use tun::TunInterface; #[test] @@ -26,6 +26,8 @@ fn test_set_get_ipv4() { #[throws] #[cfg(not(any(target_os = "windows", target_vendor = "apple")))] fn test_set_get_ipv6() { + use std::net::Ipv6Addr; + let tun = TunInterface::new()?; let addr = Ipv6Addr::new(1, 1, 1, 1, 1, 1, 1, 1); diff --git a/tun/tests/packets.rs b/tun/tests/packets.rs index 836ac30..69f9226 100644 --- a/tun/tests/packets.rs +++ b/tun/tests/packets.rs @@ -18,7 +18,7 @@ fn tst_read() { println!("tun ip: {:?}", tun.ipv4_addr()?); println!("Waiting for a packet..."); let buf = &mut [0u8; 1500]; - let res = tun.read(buf); + let res = tun.recv(buf); println!("Received!"); assert!(res.is_ok()); } @@ -28,9 +28,9 @@ fn tst_read() { #[ignore = "requires interactivity"] #[cfg(not(target_os = "windows"))] fn write_packets() { - let mut tun = TunInterface::new()?; + let tun = TunInterface::new()?; let mut buf = [0u8; 1500]; buf[0] = 6 << 4; - let bytes_written = tun.write(&buf)?; + let bytes_written = tun.send(&buf)?; assert_eq!(bytes_written, 1504); }