From 45c360f2339a6df6e2aeb572add5444d3b4e70e9 Mon Sep 17 00:00:00 2001 From: ComplexSpaces Date: Thu, 17 Oct 2024 12:04:16 -0700 Subject: [PATCH] Run tests on iOS using Mac Catalyst --- .github/workflows/ci.yml | 10 +++++++++- .../src/tests/verification_mock/mod.rs | 14 +++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3620a46..acb4fd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,7 +184,15 @@ jobs: ./android/emulator.log /Users/runner/work/rustls-platform-verifier/rustls-platform-verifier/android/rustls-platform-verifier/build/outputs/androidTest-results/connected/test-result.pb - # TODO: Test iOS in CI too. + test_ios: + name: "Test (iOS Catalyst)" + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Run iOS tests + run: | + rustup target add aarch64-apple-ios-macabi + cargo test --target aarch64-apple-ios-macabi test-freebsd: name: Test (FreeBSD) diff --git a/rustls-platform-verifier/src/tests/verification_mock/mod.rs b/rustls-platform-verifier/src/tests/verification_mock/mod.rs index 72f1f3e..f767be1 100644 --- a/rustls-platform-verifier/src/tests/verification_mock/mod.rs +++ b/rustls-platform-verifier/src/tests/verification_mock/mod.rs @@ -13,11 +13,7 @@ //! any parts of the system outside of these tests. See the `#![cfg(...)]` //! immediately below to see which platforms run these tests. -#![cfg(all( - any(windows, unix, target_os = "android"), - not(target_os = "ios"), - not(target_os = "tvos") -))] +#![cfg(all(any(windows, unix, target_os = "android"), not(target_os = "tvos"),))] use super::TestCase; use crate::tests::{assert_cert_error_eq, ensure_global_state, verification_time}; @@ -209,7 +205,7 @@ mock_root_test_cases! { // Check that self-signed certificates, which may or may not be revokved, do not return any // kind of revocation error. It is expected that non-public certificates without revocation information // have no revocation checking performed across platforms. - revoked_dns [ any(windows, target_os = "android", target_os = "macos") ] => TestCase { + revoked_dns [ any(windows, target_os = "android", target_os = "macos", target_os = "ios") ] => TestCase { reference_id: EXAMPLE_COM, chain: &[include_bytes!("root1-int1-ee_example.com-revoked.crt"), ROOT1_INT1], stapled_ocsp: None, @@ -217,7 +213,7 @@ mock_root_test_cases! { expected_result: Ok(()), other_error: no_error!(), }, - stapled_revoked_dns [ any(windows, target_os = "android", target_os = "macos") ] => TestCase { + stapled_revoked_dns [ any(windows, target_os = "android", target_os = "macos", target_os = "ios") ] => TestCase { reference_id: EXAMPLE_COM, chain: &[include_bytes!("root1-int1-ee_example.com-revoked.crt"), ROOT1_INT1], stapled_ocsp: Some(include_bytes!("root1-int1-ee_example.com-revoked.ocsp")), @@ -225,7 +221,7 @@ mock_root_test_cases! { expected_result: Err(TlsError::InvalidCertificate(CertificateError::Revoked)), other_error: no_error!(), }, - stapled_revoked_ipv4 [ any(windows, target_os = "android", target_os = "macos") ] => TestCase { + stapled_revoked_ipv4 [ any(windows, target_os = "android", target_os = "macos", target_os = "ios") ] => TestCase { reference_id: LOCALHOST_IPV4, chain: &[include_bytes!("root1-int1-ee_127.0.0.1-revoked.crt"), ROOT1_INT1], stapled_ocsp: Some(include_bytes!("root1-int1-ee_127.0.0.1-revoked.ocsp")), @@ -233,7 +229,7 @@ mock_root_test_cases! { expected_result: Err(TlsError::InvalidCertificate(CertificateError::Revoked)), other_error: no_error!(), }, - stapled_revoked_ipv6 [ any(windows, target_os = "android", target_os = "macos") ] => TestCase { + stapled_revoked_ipv6 [ any(windows, target_os = "android", target_os = "macos", target_os = "ios") ] => TestCase { reference_id: LOCALHOST_IPV6, chain: &[include_bytes!("root1-int1-ee_1-revoked.crt"), ROOT1_INT1], stapled_ocsp: Some(include_bytes!("root1-int1-ee_1-revoked.ocsp")),