| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | // Currently the mozdevice API is not safe for multiple requests at the same |
| 6 | // time. It is recommended to run each of the unit tests on its own. Also adb |
| 7 | // specific tests cannot be run in CI yet. To check those locally, also run |
| 8 | // the ignored tests. |
| 9 | // |
| 10 | // Use the following command to accomplish that: |
| 11 | // |
| 12 | // $ cargo test -- --ignored --test-threads=1 |
| 13 | |
| 14 | use craterust-analyzer cargo forensic-adb 0.8.1 crate/::*; |
| 15 | |
| 16 | use futuresrust-analyzer cargo futures 0.3.31 crate/::futurerust-analyzer cargo futures-util 0.3.31 future/::BoxFuturerust-analyzer cargo futures-core 0.3.31 future/BoxFuture#; |
| 17 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#; |
| 18 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std panic/; |
| 19 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#; |
| 20 | use tempfilerust-analyzer cargo tempfile 3.19.1 crate/::{TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, tempdirrust-analyzer cargo tempfile 3.19.1 dir/tempdir().}; |
| 21 | |
| 22 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 23 | async fn read_length_from_valid_stringrust-analyzer cargo forensic-adb 0.8.1 test/read_length_from_valid_string().() { |
| 24 | async fn testrust-analyzer cargo forensic-adb 0.8.1 test/test().(message: &str) -> Resultrust-analyzer cargo forensic-adb 0.8.1 Result#<usize> { |
| 25 | read_lengthrust-analyzer cargo forensic-adb 0.8.1 read_length().(&mut tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufReaderrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/BufReader#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/impl#[`BufReader<R>`]new().(message.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 26 | } |
| 27 | |
| 28 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("0000").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 0); |
| 29 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("0001").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 1); |
| 30 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("000F").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 15); |
| 31 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("00FF").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 255); |
| 32 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("0FFF").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 4095); |
| 33 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("FFFF").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 65535); |
| 34 | |
| 35 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(testrust-analyzer cargo forensic-adb 0.8.1 test/test().("FFFF0").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 65535); |
| 36 | } |
| 37 | |
| 38 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 39 | async fn read_length_from_invalid_stringrust-analyzer cargo forensic-adb 0.8.1 test/read_length_from_invalid_string().() { |
| 40 | async fn testrust-analyzer cargo forensic-adb 0.8.1 test/test().(message: &str) -> Resultrust-analyzer cargo forensic-adb 0.8.1 Result#<usize> { |
| 41 | read_lengthrust-analyzer cargo forensic-adb 0.8.1 read_length().(&mut tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufReaderrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/BufReader#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/impl#[`BufReader<R>`]new().(message.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 42 | } |
| 43 | |
| 44 | testrust-analyzer cargo forensic-adb 0.8.1 test/test().("").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("empty string"); |
| 45 | testrust-analyzer cargo forensic-adb 0.8.1 test/test().("G").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("invalid hex character"); |
| 46 | testrust-analyzer cargo forensic-adb 0.8.1 test/test().("-1").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("negative number"); |
| 47 | testrust-analyzer cargo forensic-adb 0.8.1 test/test().("000").rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("shorter than 4 bytes"); |
| 48 | } |
| 49 | |
| 50 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 51 | fn encode_message_with_valid_stringrust-analyzer cargo forensic-adb 0.8.1 test/encode_message_with_valid_string().() { |
| 52 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().("").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), "0000".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 53 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().("a").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), "0001a".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 54 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 55 | encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().(&"a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(15)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 56 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("000F{}", "a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(15)) |
| 57 | ); |
| 58 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 59 | encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().(&"a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(255)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 60 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("00FF{}", "a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(255)) |
| 61 | ); |
| 62 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 63 | encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().(&"a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(4095)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 64 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("0FFF{}", "a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(4095)) |
| 65 | ); |
| 66 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 67 | encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().(&"a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(65535)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 68 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("FFFF{}", "a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(65535)) |
| 69 | ); |
| 70 | } |
| 71 | |
| 72 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 73 | fn encode_message_with_invalid_stringrust-analyzer cargo forensic-adb 0.8.1 test/encode_message_with_invalid_string().() { |
| 74 | encode_messagerust-analyzer cargo forensic-adb 0.8.1 encode_message().(&"a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(65536)).expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("string lengths exceeds 4 bytes"); |
| 75 | } |
| 76 | |
| 77 | async fn run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().<F>(test: F) |
| 78 | where |
| 79 | F: for<'a> FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&'a Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, &'a TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, &'a UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> BoxFuturerust-analyzer cargo futures-core 0.3.31 future/BoxFuture#<'a, ()> |
| 80 | + panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std panic/::UnwindSaferust-analyzer cargo core https://github.com/rust-lang/rust/library/core panic/unwind_safe/UnwindSafe#, |
| 81 | { |
| 82 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 83 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 84 | }; |
| 85 | let device = host |
| 86 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Autorust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Auto#) |
| 87 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 88 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("device_or_default"); |
| 89 | |
| 90 | let tmp_dir = tempdirrust-analyzer cargo tempfile 3.19.1 dir/tempdir().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("create temp dir"); |
| 91 | let response = device |
| 92 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().("echo $EXTERNAL_STORAGE") |
| 93 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 94 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 95 | let mut test_root = UnixPathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(response.trim_end_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end_matches().('\n')); |
| 96 | test_root.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("mozdevice"); |
| 97 | |
| 98 | let _ = device.removerust-analyzer cargo forensic-adb 0.8.1 impl#[Device]remove().(&test_root).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 99 | |
| 100 | // TODO: we've removed panic::catch_unwind here, if the test crashes the forwarding isn't cleaned up |
| 101 | let _result = test(&device, &tmp_dir, &test_root).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().; |
| 102 | |
| 103 | let _ = device.kill_forward_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_all_ports().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 104 | // let _ = device.kill_reverse_all_ports(); |
| 105 | |
| 106 | // assert!(result.is_ok()) |
| 107 | } |
| 108 | |
| 109 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 110 | #[ignore] |
| 111 | async fn host_featuresrust-analyzer cargo forensic-adb 0.8.1 test/host_features().() { |
| 112 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 113 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 114 | }; |
| 115 | |
| 116 | let set = host |
| 117 | .featuresrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]features().::<BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_>>() |
| 118 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 119 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to query features"); |
| 120 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]contains().("cmd")); |
| 121 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]contains().("shell_v2")); |
| 122 | } |
| 123 | |
| 124 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 125 | #[ignore] |
| 126 | async fn host_devicesrust-analyzer cargo forensic-adb 0.8.1 test/host_devices().() { |
| 127 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 128 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 129 | }; |
| 130 | |
| 131 | let set: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_> = host.devicesrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]devices().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to query devices"); |
| 132 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, set.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]len().()); |
| 133 | } |
| 134 | |
| 135 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 136 | #[ignore] |
| 137 | async fn host_device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default().() { |
| 138 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 139 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 140 | }; |
| 141 | |
| 142 | let devices: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = host.devicesrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]devices().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to query devices"); |
| 143 | let expected_device = devices.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("found a device"); |
| 144 | |
| 145 | let device = host |
| 146 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&expected_device.serialrust-analyzer cargo forensic-adb 0.8.1 DeviceInfo#serial.), AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Apprust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#App#) |
| 147 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 148 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device with serial"); |
| 149 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.run_as_packagerust-analyzer cargo forensic-adb 0.8.1 Device#run_as_package., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 150 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.serialrust-analyzer cargo forensic-adb 0.8.1 Device#serial., expected_device.serialrust-analyzer cargo forensic-adb 0.8.1 DeviceInfo#serial.); |
| 151 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(device.tempfilerust-analyzer cargo forensic-adb 0.8.1 Device#tempfile..starts_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]starts_with().("/data/local/tmp")); |
| 152 | } |
| 153 | |
| 154 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 155 | #[ignore] |
| 156 | async fn host_device_or_default_invalid_serialrust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_invalid_serial().() { |
| 157 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 158 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 159 | }; |
| 160 | |
| 161 | host.device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"foobar".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()), AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Autorust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Auto#) |
| 162 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 163 | .expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("invalid serial"); |
| 164 | } |
| 165 | |
| 166 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 167 | #[ignore] |
| 168 | async fn host_device_or_default_no_serialrust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_no_serial().() { |
| 169 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 170 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 171 | }; |
| 172 | |
| 173 | let devices: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = host.devicesrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]devices().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to query devices"); |
| 174 | let expected_device = devices.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("found a device"); |
| 175 | |
| 176 | let device = host |
| 177 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Autorust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Auto#) |
| 178 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 179 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device with serial"); |
| 180 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.serialrust-analyzer cargo forensic-adb 0.8.1 Device#serial., expected_device.serialrust-analyzer cargo forensic-adb 0.8.1 DeviceInfo#serial.); |
| 181 | } |
| 182 | |
| 183 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 184 | #[ignore] |
| 185 | async fn host_device_or_default_storage_as_apprust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_storage_as_app().() { |
| 186 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 187 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 188 | }; |
| 189 | |
| 190 | let device = host |
| 191 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Apprust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#App#) |
| 192 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 193 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device"); |
| 194 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.storagerust-analyzer cargo forensic-adb 0.8.1 Device#storage., AndroidStoragerust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#::Apprust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#App#); |
| 195 | } |
| 196 | |
| 197 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 198 | #[ignore] |
| 199 | async fn host_device_or_default_storage_as_autorust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_storage_as_auto().() { |
| 200 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 201 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 202 | }; |
| 203 | |
| 204 | let device = host |
| 205 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Autorust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Auto#) |
| 206 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 207 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device"); |
| 208 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.storagerust-analyzer cargo forensic-adb 0.8.1 Device#storage., AndroidStoragerust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#::Sdcardrust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#Sdcard#); |
| 209 | } |
| 210 | |
| 211 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 212 | #[ignore] |
| 213 | async fn host_device_or_default_storage_as_internalrust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_storage_as_internal().() { |
| 214 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 215 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 216 | }; |
| 217 | |
| 218 | let device = host |
| 219 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Internalrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Internal#) |
| 220 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 221 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device"); |
| 222 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.storagerust-analyzer cargo forensic-adb 0.8.1 Device#storage., AndroidStoragerust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#::Internalrust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#Internal#); |
| 223 | } |
| 224 | |
| 225 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 226 | #[ignore] |
| 227 | async fn host_device_or_default_storage_as_sdcardrust-analyzer cargo forensic-adb 0.8.1 test/host_device_or_default_storage_as_sdcard().() { |
| 228 | let host = Hostrust-analyzer cargo forensic-adb 0.8.1 Host# { |
| 229 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host][Default]default().() |
| 230 | }; |
| 231 | |
| 232 | let device = host |
| 233 | .device_or_defaultrust-analyzer cargo forensic-adb 0.8.1 impl#[Host]device_or_default().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, AndroidStorageInputrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#::Sdcardrust-analyzer cargo forensic-adb 0.8.1 AndroidStorageInput#Sdcard#) |
| 234 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 235 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("connected device"); |
| 236 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(device.storagerust-analyzer cargo forensic-adb 0.8.1 Device#storage., AndroidStoragerust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#::Sdcardrust-analyzer cargo forensic-adb 0.8.1 AndroidStorage#Sdcard#); |
| 237 | } |
| 238 | |
| 239 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 240 | #[ignore] |
| 241 | async fn device_shell_commandrust-analyzer cargo forensic-adb 0.8.1 test/device_shell_command().() { |
| 242 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 243 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 244 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 245 | "Linux\n", |
| 246 | device |
| 247 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().("uname") |
| 248 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 249 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to have shell output") |
| 250 | ); |
| 251 | }) |
| 252 | }) |
| 253 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 254 | } |
| 255 | |
| 256 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 257 | #[ignore] |
| 258 | async fn device_forward_port_hardcodedrust-analyzer cargo forensic-adb 0.8.1 test/device_forward_port_hardcoded().() { |
| 259 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 260 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 261 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 262 | 3035, |
| 263 | device |
| 264 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(3035, 3036) |
| 265 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 266 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port") |
| 267 | ); |
| 268 | // TODO: check with forward --list |
| 269 | }) |
| 270 | }) |
| 271 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 272 | } |
| 273 | |
| 274 | // #[test] |
| 275 | // #[ignore] |
| 276 | // TODO: "adb server response to `forward tcp:0 ...` was not a u16: \"000559464\"") |
| 277 | // fn device_forward_port_system_allocated() { |
| 278 | // run_device_test(|device: &Device, _: &TempDir, _: &UnixPath| { |
| 279 | // let local_port = device.forward_port(0, 3037).expect("local_port"); |
| 280 | // assert_ne!(local_port, 0); |
| 281 | // // TODO: check with forward --list |
| 282 | // }); |
| 283 | // } |
| 284 | |
| 285 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 286 | #[ignore] |
| 287 | async fn device_kill_forward_port_no_forwarded_portrust-analyzer cargo forensic-adb 0.8.1 test/device_kill_forward_port_no_forwarded_port().() { |
| 288 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 289 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 290 | device |
| 291 | .kill_forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_port().(3038) |
| 292 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 293 | .expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("adb error: listener 'tcp:3038' "); |
| 294 | }) |
| 295 | }) |
| 296 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 297 | } |
| 298 | |
| 299 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 300 | #[ignore] |
| 301 | async fn device_kill_forward_port_twicerust-analyzer cargo forensic-adb 0.8.1 test/device_kill_forward_port_twice().() { |
| 302 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 303 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 304 | let local_port = device |
| 305 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(3039, 3040) |
| 306 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 307 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port"); |
| 308 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(local_port, 3039); |
| 309 | // TODO: check with forward --list |
| 310 | device |
| 311 | .kill_forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_port().(local_port) |
| 312 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 313 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to remove forwarded port"); |
| 314 | device |
| 315 | .kill_forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_port().(local_port) |
| 316 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 317 | .expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("adb error: listener 'tcp:3039' "); |
| 318 | }) |
| 319 | }) |
| 320 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 321 | } |
| 322 | |
| 323 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 324 | #[ignore] |
| 325 | async fn device_kill_forward_all_ports_no_forwarded_portrust-analyzer cargo forensic-adb 0.8.1 test/device_kill_forward_all_ports_no_forwarded_port().() { |
| 326 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 327 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 328 | device |
| 329 | .kill_forward_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_all_ports().() |
| 330 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 331 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to not fail for no forwarded ports"); |
| 332 | }) |
| 333 | }) |
| 334 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 335 | } |
| 336 | |
| 337 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 338 | #[ignore] |
| 339 | async fn device_kill_forward_all_ports_twicerust-analyzer cargo forensic-adb 0.8.1 test/device_kill_forward_all_ports_twice().() { |
| 340 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 341 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 342 | let local_port1 = device |
| 343 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(3039, 3040) |
| 344 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 345 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port"); |
| 346 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(local_port1, 3039); |
| 347 | let local_port2 = device |
| 348 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(3041, 3042) |
| 349 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 350 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port"); |
| 351 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(local_port2, 3041); |
| 352 | // TODO: check with forward --list |
| 353 | device |
| 354 | .kill_forward_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_all_ports().() |
| 355 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 356 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to remove all forwarded ports"); |
| 357 | device |
| 358 | .kill_forward_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_forward_all_ports().() |
| 359 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 360 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to not fail for no forwarded ports"); |
| 361 | }) |
| 362 | }) |
| 363 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 364 | } |
| 365 | |
| 366 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 367 | #[ignore] |
| 368 | async fn device_reverse_port_hardcodedrust-analyzer cargo forensic-adb 0.8.1 test/device_reverse_port_hardcoded().() { |
| 369 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 370 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 371 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 372 | 4035, |
| 373 | device.reverse_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]reverse_port().(4035, 4036).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("remote_port") |
| 374 | ); |
| 375 | // TODO: check with reverse --list |
| 376 | }) |
| 377 | }) |
| 378 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 379 | } |
| 380 | |
| 381 | // #[test] |
| 382 | // #[ignore] |
| 383 | // TODO: No adb response: ParseInt(ParseIntError { kind: Empty }) |
| 384 | // fn device_reverse_port_system_allocated() { |
| 385 | // run_device_test(|device: &Device, _: &TempDir, _: &UnixPath| { |
| 386 | // let reverse_port = device.reverse_port(0, 4037).expect("remote port"); |
| 387 | // assert_ne!(reverse_port, 0); |
| 388 | // // TODO: check with reverse --list |
| 389 | // }); |
| 390 | // } |
| 391 | |
| 392 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 393 | #[ignore] |
| 394 | async fn device_kill_reverse_port_no_reverse_portrust-analyzer cargo forensic-adb 0.8.1 test/device_kill_reverse_port_no_reverse_port().() { |
| 395 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 396 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 397 | device |
| 398 | .kill_reverse_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_reverse_port().(4038) |
| 399 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 400 | .expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("listener 'tcp:4038' not found"); |
| 401 | }) |
| 402 | }) |
| 403 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 404 | } |
| 405 | |
| 406 | // #[test] |
| 407 | // #[ignore] |
| 408 | // TODO: "adb error: adb server response did not contain expected hexstring length: \"\"" |
| 409 | // fn device_kill_reverse_port_twice() { |
| 410 | // run_device_test(|device: &Device, _: &TempDir, _: &UnixPath| { |
| 411 | // let remote_port = device |
| 412 | // .reverse_port(4039, 4040) |
| 413 | // .expect("reversed local port"); |
| 414 | // assert_eq!(remote_port, 4039); |
| 415 | // // TODO: check with reverse --list |
| 416 | // device |
| 417 | // .kill_reverse_port(remote_port) |
| 418 | // .expect("to remove reverse port"); |
| 419 | // device |
| 420 | // .kill_reverse_port(remote_port) |
| 421 | // .expect_err("listener 'tcp:4039' not found"); |
| 422 | // }); |
| 423 | // } |
| 424 | |
| 425 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 426 | #[ignore] |
| 427 | async fn device_kill_reverse_all_ports_no_reversed_portrust-analyzer cargo forensic-adb 0.8.1 test/device_kill_reverse_all_ports_no_reversed_port().() { |
| 428 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 429 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 430 | device |
| 431 | .kill_reverse_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_reverse_all_ports().() |
| 432 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 433 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to not fail for no reversed ports"); |
| 434 | }) |
| 435 | }) |
| 436 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 437 | } |
| 438 | |
| 439 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 440 | #[ignore] |
| 441 | async fn device_kill_reverse_all_ports_twicerust-analyzer cargo forensic-adb 0.8.1 test/device_kill_reverse_all_ports_twice().() { |
| 442 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().(|device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, _: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 443 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 444 | let local_port1 = device |
| 445 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(4039, 4040) |
| 446 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 447 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port"); |
| 448 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(local_port1, 4039); |
| 449 | let local_port2 = device |
| 450 | .forward_portrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]forward_port().(4041, 4042) |
| 451 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 452 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("forwarded local port"); |
| 453 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(local_port2, 4041); |
| 454 | // TODO: check with reverse --list |
| 455 | device |
| 456 | .kill_reverse_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_reverse_all_ports().() |
| 457 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 458 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to remove all reversed ports"); |
| 459 | device |
| 460 | .kill_reverse_all_portsrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]kill_reverse_all_ports().() |
| 461 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 462 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to not fail for no reversed ports"); |
| 463 | }) |
| 464 | }) |
| 465 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 466 | } |
| 467 | |
| 468 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 469 | #[ignore] |
| 470 | async fn device_push_pull_text_filerust-analyzer cargo forensic-adb 0.8.1 test/device_push_pull_text_file().() { |
| 471 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 472 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 473 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 474 | let content = "test"; |
| 475 | let remote_path = remote_root_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("foo.txt"); |
| 476 | |
| 477 | device |
| 478 | .pushrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push().( |
| 479 | &mut tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufReaderrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/BufReader#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/impl#[`BufReader<R>`]new().(content.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()), |
| 480 | &remote_path, |
| 481 | 0o777, |
| 482 | ) |
| 483 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 484 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("file has been pushed"); |
| 485 | |
| 486 | let file_content = device |
| 487 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("cat {}", remote_path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 488 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 489 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'cat' to succeed"); |
| 490 | |
| 491 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(file_content, content); |
| 492 | |
| 493 | // And as second step pull it off the device. |
| 494 | let mut buffer = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 495 | device |
| 496 | .pullrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]pull().(&remote_path, &mut buffer) |
| 497 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 498 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("file has been pulled"); |
| 499 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, content.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 500 | }) |
| 501 | }, |
| 502 | ) |
| 503 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 504 | } |
| 505 | |
| 506 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 507 | #[ignore] |
| 508 | async fn device_push_pull_large_binary_filerust-analyzer cargo forensic-adb 0.8.1 test/device_push_pull_large_binary_file().() { |
| 509 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 510 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 511 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 512 | let remote_path = remote_root_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("foo.binary"); |
| 513 | |
| 514 | let mut content = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 515 | |
| 516 | // Needs to be larger than 64kB to test multiple chunks. |
| 517 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100000u32 { |
| 518 | content.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b'0' +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). (i %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). 10) as u8); |
| 519 | } |
| 520 | |
| 521 | device |
| 522 | .pushrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push().( |
| 523 | &mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(content.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().()), |
| 524 | &remote_path, |
| 525 | 0o777, |
| 526 | ) |
| 527 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 528 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("large file has been pushed"); |
| 529 | |
| 530 | let output = device |
| 531 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ls -l {}", remote_path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 532 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 533 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'ls' to succeed"); |
| 534 | |
| 535 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(remote_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 536 | |
| 537 | let mut buffer = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 538 | |
| 539 | device |
| 540 | .pullrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]pull().(&remote_path, &mut buffer) |
| 541 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 542 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("large binary file has been pulled"); |
| 543 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, content); |
| 544 | }) |
| 545 | }, |
| 546 | ) |
| 547 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 548 | } |
| 549 | |
| 550 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 551 | #[ignore] |
| 552 | async fn device_push_permissionrust-analyzer cargo forensic-adb 0.8.1 test/device_push_permission().() { |
| 553 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 554 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 555 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 556 | fn adjust_moderust-analyzer cargo forensic-adb 0.8.1 test/adjust_mode().(mode: u32) -> u32 { |
| 557 | // Adjust the mode by copying the user permissions to |
| 558 | // group and other as indicated in |
| 559 | // [send_impl](https://android.googlesource.com/platform/system/core/+/master/adb/daemon/file_sync_service.cpp#516). |
| 560 | // This ensures that group and other can both access a |
| 561 | // file if the user can access it. |
| 562 | let mut m = mode &rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). 0o777; |
| 563 | m |=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign(). (m >>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). 3) &rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). 0o070; |
| 564 | m |=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign(). (m >>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). 3) &rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). 0o007; |
| 565 | m |
| 566 | } |
| 567 | |
| 568 | fn get_permissionsrust-analyzer cargo forensic-adb 0.8.1 test/get_permissions().(mode: u32) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 569 | // Convert the mode integer into the string representation |
| 570 | // of the mode returned by `ls`. This assumes the object is |
| 571 | // a file and not a directory. |
| 572 | let mut perms = ["-", "r", "w", "x", "r", "w", "x", "r", "w", "x"]; |
| 573 | let mut bit_pos = 0; |
| 574 | while bit_pos <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). 9 { |
| 575 | if (1 <<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<usize>`]shl(). bit_pos) &rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). mode ==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). 0 { |
| 576 | perms[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().9 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). bit_pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = "-" |
| 577 | } |
| 578 | bit_pos +=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). 1; |
| 579 | } |
| 580 | perms.concatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]concat().() |
| 581 | } |
| 582 | let content = "test"; |
| 583 | let remote_path = remote_root_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("foo.bar"); |
| 584 | |
| 585 | // First push the file to the device |
| 586 | let modes = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0o421, 0o644, 0o666, 0o777]; |
| 587 | for mode in modes { |
| 588 | let adjusted_mode = adjust_moderust-analyzer cargo forensic-adb 0.8.1 test/adjust_mode().(mode); |
| 589 | let adjusted_perms = get_permissionsrust-analyzer cargo forensic-adb 0.8.1 test/get_permissions().(adjusted_mode); |
| 590 | device |
| 591 | .pushrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push().( |
| 592 | &mut tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufReaderrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/BufReader#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_reader/impl#[`BufReader<R>`]new().(content.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()), |
| 593 | &remote_path, |
| 594 | mode, |
| 595 | ) |
| 596 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 597 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("file has been pushed"); |
| 598 | |
| 599 | let output = device |
| 600 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ls -l {}", remote_path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 601 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 602 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'ls' to succeed"); |
| 603 | |
| 604 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(remote_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 605 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(&adjusted_perms)); |
| 606 | } |
| 607 | |
| 608 | let output = device |
| 609 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ls -ld {}", remote_root_path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 610 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 611 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'ls parent' to succeed"); |
| 612 | |
| 613 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(remote_root_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 614 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("drwxrwxrwx")); |
| 615 | }) |
| 616 | }, |
| 617 | ) |
| 618 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 619 | } |
| 620 | |
| 621 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 622 | #[ignore] |
| 623 | async fn device_pull_fails_for_missing_filerust-analyzer cargo forensic-adb 0.8.1 test/device_pull_fails_for_missing_file().() { |
| 624 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 625 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, _: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 626 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async { |
| 627 | let mut buffer = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 628 | |
| 629 | device |
| 630 | .pullrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]pull().(&remote_root_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("missing"), &mut buffer) |
| 631 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 632 | .expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("missing file should not be pulled"); |
| 633 | }) |
| 634 | }, |
| 635 | ) |
| 636 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 637 | } |
| 638 | |
| 639 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 640 | #[ignore] |
| 641 | async fn device_push_and_list_dirrust-analyzer cargo forensic-adb 0.8.1 test/device_push_and_list_dir().() { |
| 642 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 643 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, tmp_dir: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 644 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 645 | let files = ["foo1.bar", "foo2.bar", "bar/foo3.bar", "bar/more/foo3.bar"]; |
| 646 | |
| 647 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 648 | let path = tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(file)); |
| 649 | let _ = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(path.parentrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]parent().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 650 | |
| 651 | let f = Filerust-analyzer cargo tokio 1.44.1 fs/file/File#::createrust-analyzer cargo tokio 1.44.1 fs/file/impl#[File]create().(path).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to create file"); |
| 652 | let mut f = tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufWriterrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/BufWriter#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/impl#[`BufWriter<W>`]new().(f); |
| 653 | f.write_allrust-analyzer cargo tokio 1.44.1 io/util/async_write_ext/AsyncWriteExt#write_all().(file.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()).rust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll().awaitrust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to write data"); |
| 654 | } |
| 655 | |
| 656 | device |
| 657 | .push_dirrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push_dir().(tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().(), remote_root_path, 0o777) |
| 658 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 659 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to push_dir"); |
| 660 | |
| 661 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 662 | let path = append_componentsrust-analyzer cargo forensic-adb 0.8.1 append_components().(remote_root_path, Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(file)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 663 | let output = device |
| 664 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ls {}", path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 665 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 666 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'ls' to succeed"); |
| 667 | |
| 668 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 669 | } |
| 670 | |
| 671 | let mut listings = device |
| 672 | .list_dirrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]list_dir().(remote_root_path) |
| 673 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 674 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to list_dir"); |
| 675 | listings.sortrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort().(); |
| 676 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 677 | listings, |
| 678 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 679 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 680 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 0, |
| 681 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "foo1.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 682 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 683 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 684 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 8 |
| 685 | }) |
| 686 | }, |
| 687 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 688 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 0, |
| 689 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "foo2.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 690 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 691 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 692 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 8 |
| 693 | }) |
| 694 | }, |
| 695 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 696 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 0, |
| 697 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 698 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteDirrust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteDir# |
| 699 | }, |
| 700 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 701 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 1, |
| 702 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "bar/foo3.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 703 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 704 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 705 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 12 |
| 706 | }) |
| 707 | }, |
| 708 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 709 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 1, |
| 710 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "bar/more".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 711 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteDirrust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteDir# |
| 712 | }, |
| 713 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 714 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 2, |
| 715 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "bar/more/foo3.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 716 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 717 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 718 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 17 |
| 719 | }) |
| 720 | } |
| 721 | ] |
| 722 | ); |
| 723 | }) |
| 724 | }, |
| 725 | ) |
| 726 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 727 | } |
| 728 | |
| 729 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 730 | #[ignore] |
| 731 | async fn device_push_and_pull_dirrust-analyzer cargo forensic-adb 0.8.1 test/device_push_and_pull_dir().() { |
| 732 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 733 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, tmp_dir: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 734 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 735 | let files = ["foo1.bar", "foo2.bar", "bar/foo3.bar", "bar/more/foo3.bar"]; |
| 736 | |
| 737 | let src_dir = tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("src")); |
| 738 | let dest_dir = tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("src")); |
| 739 | |
| 740 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 741 | let path = src_dir.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(file)); |
| 742 | let _ = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(path.parentrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]parent().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 743 | |
| 744 | let f = Filerust-analyzer cargo tokio 1.44.1 fs/file/File#::createrust-analyzer cargo tokio 1.44.1 fs/file/impl#[File]create().(path).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to create file"); |
| 745 | let mut f = tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufWriterrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/BufWriter#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/impl#[`BufWriter<W>`]new().(f); |
| 746 | f.write_allrust-analyzer cargo tokio 1.44.1 io/util/async_write_ext/AsyncWriteExt#write_all().(file.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()).rust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll().awaitrust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to write data"); |
| 747 | } |
| 748 | |
| 749 | device |
| 750 | .push_dirrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push_dir().(&src_dir, remote_root_path, 0o777) |
| 751 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 752 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to push_dir"); |
| 753 | |
| 754 | device |
| 755 | .pull_dirrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]pull_dir().(remote_root_path, &dest_dir) |
| 756 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 757 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to pull_dir"); |
| 758 | |
| 759 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 760 | let path = dest_dir.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(file)); |
| 761 | let mut f = Filerust-analyzer cargo tokio 1.44.1 fs/file/File#::openrust-analyzer cargo tokio 1.44.1 fs/file/impl#[File]open().(path).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to open file"); |
| 762 | let mut buf = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 763 | f.read_to_stringrust-analyzer cargo tokio 1.44.1 io/util/async_read_ext/AsyncReadExt#read_to_string().(&mut buf).rust-analyzer cargo tokio 1.44.1 io/util/read_to_string/impl#[`ReadToString<'_, A>`][Future]poll().awaitrust-analyzer cargo tokio 1.44.1 io/util/read_to_string/impl#[`ReadToString<'_, A>`][Future]poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to read content"); |
| 764 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buf, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().file); |
| 765 | } |
| 766 | }) |
| 767 | }, |
| 768 | ) |
| 769 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 770 | } |
| 771 | |
| 772 | #[tokiorust-analyzer cargo tokio 1.44.1 crate/::testrust-analyzer cargo tokio-macros 2.5.0 test:] |
| 773 | #[ignore] |
| 774 | async fn device_push_and_list_dir_flatrust-analyzer cargo forensic-adb 0.8.1 test/device_push_and_list_dir_flat().() { |
| 775 | run_device_testrust-analyzer cargo forensic-adb 0.8.1 test/run_device_test().( |
| 776 | |device: &Devicerust-analyzer cargo forensic-adb 0.8.1 Device#, tmp_dir: &TempDirrust-analyzer cargo tempfile 3.19.1 dir/TempDir#, remote_root_path: &UnixPathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#| { |
| 777 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 778 | let content = "test"; |
| 779 | |
| 780 | let files = [ |
| 781 | PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("foo1.bar"), |
| 782 | PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("foo2.bar"), |
| 783 | PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("bar").joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("foo3.bar"), |
| 784 | ]; |
| 785 | |
| 786 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 787 | let path = tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(file); |
| 788 | let _ = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(path.parentrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]parent().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 789 | |
| 790 | let f = Filerust-analyzer cargo tokio 1.44.1 fs/file/File#::createrust-analyzer cargo tokio 1.44.1 fs/file/impl#[File]create().(path).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll()..expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to create file"); |
| 791 | let mut f = tokiorust-analyzer cargo tokio 1.44.1 crate/::iorust-analyzer cargo tokio 1.44.1 io/::BufWriterrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/BufWriter#::newrust-analyzer cargo tokio 1.44.1 io/util/buf_writer/impl#[`BufWriter<W>`]new().(f); |
| 792 | f.write_allrust-analyzer cargo tokio 1.44.1 io/util/async_write_ext/AsyncWriteExt#write_all().(content.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()) |
| 793 | .rust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll().awaitrust-analyzer cargo tokio 1.44.1 io/util/write_all/impl#[`WriteAll<'_, W>`][Future]poll(). |
| 794 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to write data"); |
| 795 | } |
| 796 | |
| 797 | device |
| 798 | .push_dirrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]push_dir().(tmp_dir.pathrust-analyzer cargo tempfile 3.19.1 dir/impl#[TempDir]path().(), remote_root_path, 0o777) |
| 799 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 800 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to push_dir"); |
| 801 | |
| 802 | for file in files.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 803 | let path = append_componentsrust-analyzer cargo forensic-adb 0.8.1 append_components().(remote_root_path, file).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 804 | let output = device |
| 805 | .execute_host_shell_commandrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]execute_host_shell_command().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ls {}", path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().())) |
| 806 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 807 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("host shell command for 'ls' to succeed"); |
| 808 | |
| 809 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(output.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())); |
| 810 | } |
| 811 | |
| 812 | let mut listings = device |
| 813 | .list_dir_flatrust-analyzer cargo forensic-adb 0.8.1 impl#[Device]list_dir_flat().(remote_root_path, 7, "prefix".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 814 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll(). |
| 815 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("to list_dir_flat"); |
| 816 | listings.sortrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort().(); |
| 817 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 818 | listings, |
| 819 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 820 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 821 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 7, |
| 822 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 823 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 824 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 4 |
| 825 | }), |
| 826 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "prefix/foo1.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 827 | }, |
| 828 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 829 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 7, |
| 830 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteFilerust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteFile#(RemoteFileMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata# { |
| 831 | moderust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#mode.: 0b110110000, |
| 832 | sizerust-analyzer cargo forensic-adb 0.8.1 RemoteFileMetadata#size.: 4 |
| 833 | }), |
| 834 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "prefix/foo2.bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 835 | }, |
| 836 | RemoteDirEntryrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry# { |
| 837 | depthrust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#depth.: 7, |
| 838 | metadatarust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#metadata.: RemoteMetadatarust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#::RemoteDirrust-analyzer cargo forensic-adb 0.8.1 RemoteMetadata#RemoteDir#, |
| 839 | namerust-analyzer cargo forensic-adb 0.8.1 RemoteDirEntry#name.: "prefix/bar".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 840 | }, |
| 841 | ] |
| 842 | ); |
| 843 | }) |
| 844 | }, |
| 845 | ) |
| 846 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().; |
| 847 | } |
| 848 | |
| 849 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 850 | fn format_own_device_error_typesrust-analyzer cargo forensic-adb 0.8.1 test/format_own_device_error_types().() { |
| 851 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 852 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#::InvalidStoragerust-analyzer cargo forensic-adb 0.8.1 DeviceError#InvalidStorage#), |
| 853 | "Invalid storage".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 854 | ); |
| 855 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 856 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#::MissingPackagerust-analyzer cargo forensic-adb 0.8.1 DeviceError#MissingPackage#), |
| 857 | "Missing package".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 858 | ); |
| 859 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 860 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#::MultipleDevicesrust-analyzer cargo forensic-adb 0.8.1 DeviceError#MultipleDevices#), |
| 861 | "Multiple Android devices online".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 862 | ); |
| 863 | |
| 864 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 865 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", DeviceErrorrust-analyzer cargo forensic-adb 0.8.1 DeviceError#::Adbrust-analyzer cargo forensic-adb 0.8.1 DeviceError#Adb#("foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 866 | "foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 867 | ); |
| 868 | } |