dinghy
dinghy copied to clipboard
Can't determine where tests panicked on iOS.
I have tests that access file system and network interfaces, and the code tested panics when runs on my iPhone. Here's the output:
(lldb) command source -s 1 '/var/folders/nt/ycrcdlzj7t90hdmzpyt6jqj40000gn/T/mobiledevice-rs-lldb.59rBGgfsFD4l/lldb-script'
running 1 test
test data_files ... FAILED
failures:
---- data_files stdout ----
thread 'data_files' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }', libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
data_files
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
ERROR cargo_dinghy > Error: LLDB returned error code Some(101)
stack backtrace:
0: 0x10db543fe - backtrace::backtrace::trace::hc8118fbba0127c20
1: 0x10db551cc - <backtrace::capture::Backtrace as core::default::Default>::default::h8fba7e19f94a2479
2: 0x10db5524d - backtrace::capture::Backtrace::new::h1b88bb7cfb77806c
3: 0x10d685177 - error_chain::make_backtrace::h69a0b27a79a617a4
4: 0x10d685208 - <error_chain::State as core::default::Default>::default::hb857561dc1f50632
5: 0x10d649c85 - dinghy_lib::device::ios::run_remote::hb4ec3da983800656
6: 0x10d63c57a - <dinghy_lib::device::ios::IosDevice as dinghy_lib::Device>::run_app::h4e1b394ec9bd9859
7: 0x10d56ab6c - cargo_dinghy::prepare_and_run::h8f17db4f72955880
8: 0x10d56929d - cargo_dinghy::main::h80243af41f4e7bf2
9: 0x10d571505 - std::rt::lang_start::{{closure}}::hca1d6f3fa4a4acce
10: 0x10dbd5be7 - std::panicking::try::do_call::hcfe6ac53944e0624
11: 0x10dbe532e - ___rust_maybe_catch_panic
12: 0x10dbcba4c - std::rt::lang_start_internal::hb972e1f76be57958
13: 0x10d56b98b - _main
The error message points to the core lib, which is not very helpful, and the backtrace doesn't seem to show where the panic was.
How can I see more detailed error logs?
It seems that even a very simple panicking test like this doesn't show backtrace:
#[test]
fn my_test() {
let a: Option<u64> = None;
a.unwrap();
}
I thought that to show the backtrace from the device I can run:
cargo dinghy -d iphone test --env RUST_BACKTRACE=1
but it seems that the "--env" parameter is ignored for iOS. Could you please implement that or at least allow users to pass RUST_BACKTRACE=1 env var to the device?
Hey @mfronczyk, thank for your interest :)
Unfortunately, I'm afraid what you're asking might not possible. The very fragile and convoluted way we have to go to launch the app on the iPhone (through the lldb debugger) prevent us to do many things (like changing cwd) and as far as i remember environment is part of it.
Thanks for a quick response. This page says that it should be possible to change env vars using lldb - https://lldb.llvm.org/lldb-gdb.html
Are you say saying that it wouldn’t work on iPhone?
Yeah... the remote launch process through LLDB is very convoluted and not greatly documented. As soon as you venture in something that is not a strict requirement from XCode, it breaks. As far as I can remember, env is like that.