mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-05-17 20:20:34 +00:00
cargo fmt
This commit is contained in:
+8
-16
@@ -4,12 +4,9 @@ use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::amfi::AmfiClient};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"amfi: connect",
|
||||
success,
|
||||
failure,
|
||||
async { AmfiClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("amfi: connect", success, failure, async {
|
||||
AmfiClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match AmfiClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -20,14 +17,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"amfi: get_developer_mode_status",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let enabled = client.get_developer_mode_status().await?;
|
||||
println!("(developer_mode={enabled})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("amfi: get_developer_mode_status", success, failure, async {
|
||||
let enabled = client.get_developer_mode_status().await?;
|
||||
println!("(developer_mode={enabled})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,19 +7,15 @@ use std::time::Duration;
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider,
|
||||
services::bt_packet_logger::BtPacketLoggerClient,
|
||||
IdeviceService, provider::IdeviceProvider, services::bt_packet_logger::BtPacketLoggerClient,
|
||||
};
|
||||
|
||||
const RECV_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"bt_packet_logger: connect",
|
||||
success,
|
||||
failure,
|
||||
async { BtPacketLoggerClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("bt_packet_logger: connect", success, failure, async {
|
||||
BtPacketLoggerClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match BtPacketLoggerClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
|
||||
@@ -4,17 +4,13 @@
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider,
|
||||
services::companion_proxy::CompanionProxy,
|
||||
IdeviceService, provider::IdeviceProvider, services::companion_proxy::CompanionProxy,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"companion_proxy: connect",
|
||||
success,
|
||||
failure,
|
||||
async { CompanionProxy::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("companion_proxy: connect", success, failure, async {
|
||||
CompanionProxy::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match CompanionProxy::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
|
||||
+22
-35
@@ -7,12 +7,11 @@ use idevice::{
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"crash_reports: connect",
|
||||
success,
|
||||
failure,
|
||||
async { CrashReportCopyMobileClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("crash_reports: connect", success, failure, async {
|
||||
CrashReportCopyMobileClient::connect(provider)
|
||||
.await
|
||||
.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match CrashReportCopyMobileClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -23,36 +22,24 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"crash_reports: ls root",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let entries = client.ls(None).await?;
|
||||
println!("({} entries)", entries.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("crash_reports: ls root", success, failure, async {
|
||||
let entries = client.ls(None).await?;
|
||||
println!("({} entries)", entries.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"crash_reports: ls /Diagnostics",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
match client.ls(Some("/Diagnostics")).await {
|
||||
Ok(entries) => {
|
||||
println!("({} entries)", entries.len());
|
||||
Ok(())
|
||||
}
|
||||
// Directory may not exist on all devices — treat as soft pass
|
||||
Err(idevice::IdeviceError::Afc(e))
|
||||
if e.to_string().contains("Object not found") =>
|
||||
{
|
||||
println!("(not present on this device)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
run_test!("crash_reports: ls /Diagnostics", success, failure, async {
|
||||
match client.ls(Some("/Diagnostics")).await {
|
||||
Ok(entries) => {
|
||||
println!("({} entries)", entries.len());
|
||||
Ok(())
|
||||
}
|
||||
// Directory may not exist on all devices — treat as soft pass
|
||||
Err(idevice::IdeviceError::Afc(e)) if e.to_string().contains("Object not found") => {
|
||||
println!("(not present on this device)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
// Jackson Coxson
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::diagnostics_relay::DiagnosticsRelayClient};
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider, services::diagnostics_relay::DiagnosticsRelayClient,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"diagnostics_relay: connect",
|
||||
success,
|
||||
failure,
|
||||
async { DiagnosticsRelayClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("diagnostics_relay: connect", success, failure, async {
|
||||
DiagnosticsRelayClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match DiagnosticsRelayClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -32,19 +31,13 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
);
|
||||
|
||||
run_test!(
|
||||
"diagnostics_relay: gasguage",
|
||||
success,
|
||||
failure,
|
||||
async { client.gasguage().await.map(|_| ()) }
|
||||
);
|
||||
run_test!("diagnostics_relay: gasguage", success, failure, async {
|
||||
client.gasguage().await.map(|_| ())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"diagnostics_relay: wifi",
|
||||
success,
|
||||
failure,
|
||||
async { client.wifi().await.map(|_| ()) }
|
||||
);
|
||||
run_test!("diagnostics_relay: wifi", success, failure, async {
|
||||
client.wifi().await.map(|_| ())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"diagnostics_relay: ioregistry (IOPMPowerSource)",
|
||||
|
||||
+15
-32
@@ -30,9 +30,7 @@ use idevice::{
|
||||
const STREAM_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
|
||||
/// Try to connect via CoreDeviceProxy + RSD (iOS 17+); fall back to Lockdown.
|
||||
async fn connect(
|
||||
provider: &dyn IdeviceProvider,
|
||||
) -> Option<RemoteServerClient<Box<dyn ReadWrite>>> {
|
||||
async fn connect(provider: &dyn IdeviceProvider) -> Option<RemoteServerClient<Box<dyn ReadWrite>>> {
|
||||
match CoreDeviceProxy::connect(provider).await {
|
||||
Ok(proxy) => {
|
||||
let rsd_port = proxy.tunnel_info().server_rsd_port;
|
||||
@@ -98,7 +96,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
Err(_) => {
|
||||
return Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for network event".into(),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
nm.stop_monitoring().await
|
||||
@@ -127,7 +125,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
let mut remote = match connect(provider).await {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
println!(" dvt: cannot establish RemoteServer connection, skipping remaining DVT tests");
|
||||
println!(
|
||||
" dvt: cannot establish RemoteServer connection, skipping remaining DVT tests"
|
||||
);
|
||||
*failure += 1;
|
||||
return;
|
||||
}
|
||||
@@ -135,12 +135,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
println!(" dvt: RemoteServer connected [ OK ]");
|
||||
|
||||
// ── DeviceInfo ────────────────────────────────────────────────────────────
|
||||
run_test!(
|
||||
"dvt: DeviceInfo::new",
|
||||
success,
|
||||
failure,
|
||||
async { DeviceInfoClient::new(&mut remote).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("dvt: DeviceInfo::new", success, failure, async {
|
||||
DeviceInfoClient::new(&mut remote).await.map(|_| ())
|
||||
});
|
||||
{
|
||||
let mut di = match DeviceInfoClient::new(&mut remote).await {
|
||||
Ok(c) => c,
|
||||
@@ -303,13 +300,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
failure,
|
||||
async {
|
||||
let pid = pc
|
||||
.launch_app(
|
||||
"com.apple.Preferences",
|
||||
None,
|
||||
None,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
.launch_app("com.apple.Preferences", None, None, false, true)
|
||||
.await?;
|
||||
println!("(pid={pid})");
|
||||
pc.kill_app(pid).await?;
|
||||
@@ -366,7 +357,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
Err(_) => {
|
||||
return Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for sysmontap sample".into(),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
sm.stop().await
|
||||
@@ -420,12 +411,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
async { ls.set(37.3318, -122.0312).await }
|
||||
);
|
||||
|
||||
run_test!(
|
||||
"dvt: LocationSimulation clear",
|
||||
success,
|
||||
failure,
|
||||
async { ls.clear().await }
|
||||
);
|
||||
run_test!("dvt: LocationSimulation clear", success, failure, async {
|
||||
ls.clear().await
|
||||
});
|
||||
}
|
||||
|
||||
// ── EnergyMonitor ─────────────────────────────────────────────────────────
|
||||
@@ -475,7 +463,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
Err(_) => {
|
||||
return Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for graphics sample".into(),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
gfx.stop_sampling().await
|
||||
@@ -502,12 +490,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
notif.start_notifications().await?;
|
||||
// This may time out on a quiet device — treat timeout as pass
|
||||
// since we at least verified start_notifications works.
|
||||
match tokio::time::timeout(
|
||||
Duration::from_secs(5),
|
||||
notif.get_notification(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
match tokio::time::timeout(Duration::from_secs(5), notif.get_notification()).await {
|
||||
Ok(Ok(_)) | Err(_) => {
|
||||
notif.stop_notifications().await?;
|
||||
Ok(())
|
||||
|
||||
@@ -4,12 +4,9 @@ use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::heartbeat::HeartbeatClient};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"heartbeat: connect",
|
||||
success,
|
||||
failure,
|
||||
async { HeartbeatClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("heartbeat: connect", success, failure, async {
|
||||
HeartbeatClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match HeartbeatClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
// Jackson Coxson
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::house_arrest::HouseArrestClient};
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider, services::house_arrest::HouseArrestClient,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"house_arrest: connect",
|
||||
success,
|
||||
failure,
|
||||
async { HouseArrestClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("house_arrest: connect", success, failure, async {
|
||||
HouseArrestClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
// vend_container consumes the client, requiring a fresh connect each time.
|
||||
// System apps typically reject house_arrest; treat PermDenied/ObjectNotFound as a
|
||||
|
||||
@@ -7,12 +7,9 @@ use idevice::{
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"instproxy: connect",
|
||||
success,
|
||||
failure,
|
||||
async { InstallationProxyClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("instproxy: connect", success, failure, async {
|
||||
InstallationProxyClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match InstallationProxyClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -23,40 +20,25 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"instproxy: get_apps (User)",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let apps = client.get_apps(Some("User"), None).await?;
|
||||
println!("({} apps)", apps.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("instproxy: get_apps (User)", success, failure, async {
|
||||
let apps = client.get_apps(Some("User"), None).await?;
|
||||
println!("({} apps)", apps.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"instproxy: get_apps (System)",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
client
|
||||
.get_apps(Some("System"), None)
|
||||
.await
|
||||
.map(|apps| println!("({} apps)", apps.len()))
|
||||
}
|
||||
);
|
||||
run_test!("instproxy: get_apps (System)", success, failure, async {
|
||||
client
|
||||
.get_apps(Some("System"), None)
|
||||
.await
|
||||
.map(|apps| println!("({} apps)", apps.len()))
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"instproxy: get_apps (Any)",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
client
|
||||
.get_apps(Some("Any"), None)
|
||||
.await
|
||||
.map(|apps| println!("({} apps)", apps.len()))
|
||||
}
|
||||
);
|
||||
run_test!("instproxy: get_apps (Any)", success, failure, async {
|
||||
client
|
||||
.get_apps(Some("Any"), None)
|
||||
.await
|
||||
.map(|apps| println!("({} apps)", apps.len()))
|
||||
});
|
||||
|
||||
// Filter by a well-known bundle ID to exercise the filter path
|
||||
run_test!(
|
||||
|
||||
@@ -7,24 +7,17 @@ use idevice::{
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"location_simulation: connect",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
match LocationSimulationService::connect(provider).await {
|
||||
Ok(_) => Ok(()),
|
||||
// iOS 17+ removed this lockdown service; use DVT location simulation instead
|
||||
Err(idevice::IdeviceError::UnknownErrorType(ref s))
|
||||
if s.contains("InvalidService") =>
|
||||
{
|
||||
println!("(not available on iOS 17+, DVT location simulation used instead)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
run_test!("location_simulation: connect", success, failure, async {
|
||||
match LocationSimulationService::connect(provider).await {
|
||||
Ok(_) => Ok(()),
|
||||
// iOS 17+ removed this lockdown service; use DVT location simulation instead
|
||||
Err(idevice::IdeviceError::UnknownErrorType(ref s)) if s.contains("InvalidService") => {
|
||||
println!("(not available on iOS 17+, DVT location simulation used instead)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
let mut client = match LocationSimulationService::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -33,9 +26,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
println!(
|
||||
" location_simulation: cannot connect ({e}), skipping remaining tests"
|
||||
);
|
||||
println!(" location_simulation: cannot connect ({e}), skipping remaining tests");
|
||||
*failure += 1;
|
||||
return;
|
||||
}
|
||||
@@ -50,10 +41,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
);
|
||||
|
||||
// Clear the simulated location
|
||||
run_test!(
|
||||
"location_simulation: clear",
|
||||
success,
|
||||
failure,
|
||||
async { client.clear().await }
|
||||
);
|
||||
run_test!("location_simulation: clear", success, failure, async {
|
||||
client.clear().await
|
||||
});
|
||||
}
|
||||
|
||||
+8
-16
@@ -4,12 +4,9 @@ use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::misagent::MisagentClient};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"misagent: connect",
|
||||
success,
|
||||
failure,
|
||||
async { MisagentClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("misagent: connect", success, failure, async {
|
||||
MisagentClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match MisagentClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -20,14 +17,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"misagent: copy_all profiles",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let profiles = client.copy_all().await?;
|
||||
println!("({} profiles)", profiles.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("misagent: copy_all profiles", success, failure, async {
|
||||
let profiles = client.copy_all().await?;
|
||||
println!("({} profiles)", profiles.len());
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,24 +2,18 @@
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider,
|
||||
services::mobile_image_mounter::ImageMounter,
|
||||
IdeviceService, provider::IdeviceProvider, services::mobile_image_mounter::ImageMounter,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"mobile_image_mounter: connect",
|
||||
success,
|
||||
failure,
|
||||
async { ImageMounter::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("mobile_image_mounter: connect", success, failure, async {
|
||||
ImageMounter::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match ImageMounter::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
println!(
|
||||
" mobile_image_mounter: cannot connect ({e}), skipping remaining tests"
|
||||
);
|
||||
println!(" mobile_image_mounter: cannot connect ({e}), skipping remaining tests");
|
||||
*failure += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,32 +3,20 @@
|
||||
// so MobileActivationdClient takes a provider reference rather than a single session.
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{
|
||||
provider::IdeviceProvider, services::mobileactivationd::MobileActivationdClient,
|
||||
};
|
||||
use idevice::{provider::IdeviceProvider, services::mobileactivationd::MobileActivationdClient};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
let client = MobileActivationdClient::new(provider);
|
||||
|
||||
run_test!(
|
||||
"mobileactivationd: state",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let state = client.state().await?;
|
||||
println!("({state})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("mobileactivationd: state", success, failure, async {
|
||||
let state = client.state().await?;
|
||||
println!("({state})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"mobileactivationd: activated",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let is_activated = client.activated().await?;
|
||||
println!("({is_activated})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("mobileactivationd: activated", success, failure, async {
|
||||
let is_activated = client.activated().await?;
|
||||
println!("({is_activated})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
// fire-and-receive pattern against a real device.
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::mobilebackup2::MobileBackup2Client};
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider, services::mobilebackup2::MobileBackup2Client,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
|
||||
@@ -7,19 +7,14 @@ use idevice::{
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"notification_proxy: connect",
|
||||
success,
|
||||
failure,
|
||||
async { NotificationProxyClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("notification_proxy: connect", success, failure, async {
|
||||
NotificationProxyClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match NotificationProxyClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
println!(
|
||||
" notification_proxy: cannot connect ({e}), skipping remaining tests"
|
||||
);
|
||||
println!(" notification_proxy: cannot connect ({e}), skipping remaining tests");
|
||||
*failure += 1;
|
||||
return;
|
||||
}
|
||||
@@ -34,9 +29,7 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
failure,
|
||||
async {
|
||||
// post_notification is fire-and-forget; success means no error
|
||||
client
|
||||
.post_notification("com.apple.language.changed")
|
||||
.await
|
||||
client.post_notification("com.apple.language.changed").await
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
+13
-21
@@ -10,12 +10,9 @@ use idevice::{
|
||||
const RECV_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"os_trace_relay: connect",
|
||||
success,
|
||||
failure,
|
||||
async { OsTraceRelayClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("os_trace_relay: connect", success, failure, async {
|
||||
OsTraceRelayClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match OsTraceRelayClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -26,22 +23,17 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
}
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"os_trace_relay: get_pid_list",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let pids = client.get_pid_list().await?;
|
||||
if pids.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"pid list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} pids)", pids.len());
|
||||
Ok(())
|
||||
}
|
||||
run_test!("os_trace_relay: get_pid_list", success, failure, async {
|
||||
let pids = client.get_pid_list().await?;
|
||||
if pids.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"pid list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} pids)", pids.len());
|
||||
Ok(())
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// start_trace consumes the client; use a fresh connection so the PidList
|
||||
// exchange above doesn't leave the socket in an unexpected state.
|
||||
|
||||
+13
-21
@@ -10,12 +10,9 @@ use idevice::{IdeviceService, provider::IdeviceProvider, services::pcapd::PcapdC
|
||||
const RECV_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"pcapd: connect",
|
||||
success,
|
||||
failure,
|
||||
async { PcapdClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("pcapd: connect", success, failure, async {
|
||||
PcapdClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match PcapdClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -28,21 +25,16 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
|
||||
// next_packet blocks until a network packet arrives. A real device always
|
||||
// has at least some background traffic, so this should complete quickly.
|
||||
run_test!(
|
||||
"pcapd: next_packet",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
match tokio::time::timeout(RECV_TIMEOUT, client.next_packet()).await {
|
||||
Ok(Ok(pkt)) => {
|
||||
println!("(iface={}, {} bytes)", pkt.interface_name, pkt.data.len());
|
||||
Ok(())
|
||||
}
|
||||
Ok(Err(e)) => Err(e),
|
||||
Err(_) => Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for pcap packet".into(),
|
||||
)),
|
||||
run_test!("pcapd: next_packet", success, failure, async {
|
||||
match tokio::time::timeout(RECV_TIMEOUT, client.next_packet()).await {
|
||||
Ok(Ok(pkt)) => {
|
||||
println!("(iface={}, {} bytes)", pkt.interface_name, pkt.data.len());
|
||||
Ok(())
|
||||
}
|
||||
Ok(Err(e)) => Err(e),
|
||||
Err(_) => Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for pcap packet".into(),
|
||||
)),
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,15 +5,11 @@
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider,
|
||||
services::preboard_service::PreboardServiceClient,
|
||||
IdeviceService, provider::IdeviceProvider, services::preboard_service::PreboardServiceClient,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"preboard_service: connect",
|
||||
success,
|
||||
failure,
|
||||
async { PreboardServiceClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("preboard_service: connect", success, failure, async {
|
||||
PreboardServiceClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
}
|
||||
|
||||
+31
-46
@@ -85,24 +85,19 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
return;
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"rsd: AppService list_apps",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let mut svc: AppServiceClient<Box<dyn ReadWrite>> =
|
||||
AppServiceClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let apps = svc.list_apps(false, true, false, false, true).await?;
|
||||
if apps.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"app list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} apps)", apps.len());
|
||||
Ok(())
|
||||
}
|
||||
run_test!("rsd: AppService list_apps", success, failure, async {
|
||||
let mut svc: AppServiceClient<Box<dyn ReadWrite>> =
|
||||
AppServiceClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let apps = svc.list_apps(false, true, false, false, true).await?;
|
||||
if apps.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"app list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} apps)", apps.len());
|
||||
Ok(())
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// ── InstallcoordinationProxy ──────────────────────────────────────────────
|
||||
@@ -133,18 +128,13 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
return;
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"rsd: OpenStdioSocket read_uuid",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let mut svc: OpenStdioSocketClient =
|
||||
OpenStdioSocketClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let uuid = svc.read_uuid().await?;
|
||||
println!("({uuid})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
}
|
||||
);
|
||||
run_test!("rsd: OpenStdioSocket read_uuid", success, failure, async {
|
||||
let mut svc: OpenStdioSocketClient =
|
||||
OpenStdioSocketClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let uuid = svc.read_uuid().await?;
|
||||
println!("({uuid})");
|
||||
Ok::<(), idevice::IdeviceError>(())
|
||||
});
|
||||
}
|
||||
|
||||
// ── DebugProxy ────────────────────────────────────────────────────────────
|
||||
@@ -177,24 +167,19 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
return;
|
||||
};
|
||||
|
||||
run_test!(
|
||||
"rsd: AppService list_processes",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
let mut svc: AppServiceClient<Box<dyn ReadWrite>> =
|
||||
AppServiceClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let procs = svc.list_processes().await?;
|
||||
if procs.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"process list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} processes)", procs.len());
|
||||
Ok(())
|
||||
}
|
||||
run_test!("rsd: AppService list_processes", success, failure, async {
|
||||
let mut svc: AppServiceClient<Box<dyn ReadWrite>> =
|
||||
AppServiceClient::connect_rsd(&mut adapter, &mut handshake).await?;
|
||||
let procs = svc.list_processes().await?;
|
||||
if procs.is_empty() {
|
||||
Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"process list was empty".into(),
|
||||
))
|
||||
} else {
|
||||
println!("({} processes)", procs.len());
|
||||
Ok(())
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Launch Settings, verify PID, then send SIGTERM to clean up.
|
||||
|
||||
+12
-17
@@ -1,27 +1,22 @@
|
||||
// Jackson Coxson
|
||||
|
||||
use crate::run_test;
|
||||
use idevice::{IdeviceService, provider::IdeviceProvider, services::screenshotr::ScreenshotService};
|
||||
use idevice::{
|
||||
IdeviceService, provider::IdeviceProvider, services::screenshotr::ScreenshotService,
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"screenshotr: connect",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
match ScreenshotService::connect(provider).await {
|
||||
Ok(_) => Ok(()),
|
||||
// iOS 17+ removed this service in favour of DVT screenshot
|
||||
Err(idevice::IdeviceError::UnknownErrorType(ref s))
|
||||
if s.contains("InvalidService") =>
|
||||
{
|
||||
println!("(not available on iOS 17+, DVT screenshot used instead)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
run_test!("screenshotr: connect", success, failure, async {
|
||||
match ScreenshotService::connect(provider).await {
|
||||
Ok(_) => Ok(()),
|
||||
// iOS 17+ removed this service in favour of DVT screenshot
|
||||
Err(idevice::IdeviceError::UnknownErrorType(ref s)) if s.contains("InvalidService") => {
|
||||
println!("(not available on iOS 17+, DVT screenshot used instead)");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
let mut client = match ScreenshotService::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
|
||||
@@ -7,12 +7,11 @@ use idevice::{
|
||||
};
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"springboard: connect",
|
||||
success,
|
||||
failure,
|
||||
async { SpringBoardServicesClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("springboard: connect", success, failure, async {
|
||||
SpringBoardServicesClient::connect(provider)
|
||||
.await
|
||||
.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match SpringBoardServicesClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -42,12 +41,9 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
async { client.get_homescreen_icon_metrics().await.map(|_| ()) }
|
||||
);
|
||||
|
||||
run_test!(
|
||||
"springboard: get_icon_state",
|
||||
success,
|
||||
failure,
|
||||
async { client.get_icon_state(Some("2")).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("springboard: get_icon_state", success, failure, async {
|
||||
client.get_icon_state(Some("2")).await.map(|_| ())
|
||||
});
|
||||
|
||||
run_test!(
|
||||
"springboard: get_icon_pngdata (com.apple.Preferences)",
|
||||
|
||||
+17
-25
@@ -10,12 +10,9 @@ use idevice::{
|
||||
const RECV_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failure: &mut u32) {
|
||||
run_test!(
|
||||
"syslog_relay: connect",
|
||||
success,
|
||||
failure,
|
||||
async { SyslogRelayClient::connect(provider).await.map(|_| ()) }
|
||||
);
|
||||
run_test!("syslog_relay: connect", success, failure, async {
|
||||
SyslogRelayClient::connect(provider).await.map(|_| ())
|
||||
});
|
||||
|
||||
let mut client = match SyslogRelayClient::connect(provider).await {
|
||||
Ok(c) => c,
|
||||
@@ -27,27 +24,22 @@ pub async fn run_tests(provider: &dyn IdeviceProvider, success: &mut u32, failur
|
||||
};
|
||||
|
||||
// Read the first 3 syslog lines (device is always logging something)
|
||||
run_test!(
|
||||
"syslog_relay: read 3 log lines",
|
||||
success,
|
||||
failure,
|
||||
async {
|
||||
for i in 0..3 {
|
||||
match tokio::time::timeout(RECV_TIMEOUT, client.next()).await {
|
||||
Ok(Ok(line)) => {
|
||||
if i == 0 {
|
||||
print!("(first={:?}...) ", line.get(..40).unwrap_or(&line));
|
||||
}
|
||||
}
|
||||
Ok(Err(e)) => return Err(e),
|
||||
Err(_) => {
|
||||
return Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for syslog line".into(),
|
||||
))
|
||||
run_test!("syslog_relay: read 3 log lines", success, failure, async {
|
||||
for i in 0..3 {
|
||||
match tokio::time::timeout(RECV_TIMEOUT, client.next()).await {
|
||||
Ok(Ok(line)) => {
|
||||
if i == 0 {
|
||||
print!("(first={:?}...) ", line.get(..40).unwrap_or(&line));
|
||||
}
|
||||
}
|
||||
Ok(Err(e)) => return Err(e),
|
||||
Err(_) => {
|
||||
return Err(idevice::IdeviceError::UnexpectedResponse(
|
||||
"timed out waiting for syslog line".into(),
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user