mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Without this change
when the test returns a `Result`, `cargo test` does not show
the line number.
To make the tests as easy to debug as the panicking tests,
enable `backtrace` feature on `anyhow` and add debug information
to add source line numbers to backtraces.
Now running `RUST_BACKTRACE=1 cargo test` produces backtraces
with the line numbers. For example:
Error: near ",": syntax error in SELECT COUNT(,,*) FROM msgs_status_updates; at offset 13
Caused by:
Error code 1: SQL error or missing database
Stack backtrace:
0: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1962:27
1: deltachat::sql::Sql::query_row::{{closure}}::{{closure}}
at ./src/sql.rs:466:23
2: deltachat::sql::Sql::call::{{closure}}::{{closure}}
at ./src/sql.rs:379:55
3: tokio::runtime::context::runtime_mt::exit_runtime
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/context/runtime_mt.rs:35:5
4: tokio::runtime::scheduler::multi_thread::worker::block_in_place
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/scheduler/multi_thread/worker.rs:438:9
5: tokio::runtime::scheduler::block_in_place::block_in_place
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/scheduler/block_in_place.rs:20:5
6: tokio::task::blocking::block_in_place
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/task/blocking.rs:78:9
7: deltachat::sql::Sql::call::{{closure}}
at ./src/sql.rs:379:19
8: deltachat::sql::Sql::query_row::{{closure}}
at ./src/sql.rs:469:10
9: deltachat::sql::Sql::count::{{closure}}
at ./src/sql.rs:443:76
10: deltachat::webxdc::tests::change_logging_webxdc::{{closure}}
at ./src/webxdc.rs:2644:18
11: <core::pin::Pin<P> as core::future::future::Future>::poll
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/future/future.rs:125:9
12: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/park.rs:282:63
13: tokio::runtime::coop::with_budget
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/coop.rs:107:5
tokio::runtime::coop::budget
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/coop.rs:73:5
tokio::runtime::park::CachedParkThread::block_on
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/park.rs:282:31
14: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/context/blocking.rs:66:9
...
Line 10 of the backtrace contains the line number in the test (2644).
164 lines
4.3 KiB
TOML
164 lines
4.3 KiB
TOML
[package]
|
|
name = "deltachat"
|
|
version = "1.131.8"
|
|
edition = "2021"
|
|
license = "MPL-2.0"
|
|
rust-version = "1.70"
|
|
|
|
[profile.dev]
|
|
debug = 0
|
|
panic = 'abort'
|
|
opt-level = 1
|
|
|
|
[profile.test]
|
|
# Make anyhow `backtrace` feature useful.
|
|
# With `debug = 0` there are no line numbers in the backtrace
|
|
# produced with RUST_BACKTRACE=1.
|
|
debug = 1
|
|
opt-level = 0
|
|
|
|
# Always optimize dependencies.
|
|
# This does not apply to crates in the workspace.
|
|
# <https://doc.rust-lang.org/cargo/reference/profiles.html#overrides>
|
|
[profile.dev.package."*"]
|
|
opt-level = "z"
|
|
|
|
[profile.release]
|
|
lto = true
|
|
panic = 'abort'
|
|
opt-level = "z"
|
|
codegen-units = 1
|
|
strip = true
|
|
|
|
[patch.crates-io]
|
|
imap-proto = { git = "https://github.com/djc/tokio-imap.git", rev = "01ff256a7e42a9f7d2732706f8b71a16ce93427e" }
|
|
|
|
[dependencies]
|
|
deltachat_derive = { path = "./deltachat_derive" }
|
|
format-flowed = { path = "./format-flowed" }
|
|
ratelimit = { path = "./deltachat-ratelimit" }
|
|
|
|
anyhow = "1"
|
|
async-channel = "2.0.0"
|
|
async-imap = { version = "0.9.1", default-features = false, features = ["runtime-tokio"] }
|
|
async-native-tls = { version = "0.5", default-features = false, features = ["runtime-tokio"] }
|
|
async-smtp = { version = "0.9", default-features = false, features = ["runtime-tokio"] }
|
|
async_zip = { version = "0.0.12", default-features = false, features = ["deflate", "fs"] }
|
|
backtrace = "0.3"
|
|
base64 = "0.21"
|
|
brotli = { version = "3.4", default-features=false, features = ["std"] }
|
|
chrono = { version = "0.4", default-features=false, features = ["clock", "std"] }
|
|
email = { git = "https://github.com/deltachat/rust-email", branch = "master" }
|
|
encoded-words = { git = "https://github.com/async-email/encoded-words", branch = "master" }
|
|
escaper = "0.1"
|
|
fast-socks5 = "0.8"
|
|
fd-lock = "3.0.11"
|
|
futures = "0.3"
|
|
futures-lite = "2.0.0"
|
|
hex = "0.4.0"
|
|
hickory-resolver = "0.24"
|
|
humansize = "2"
|
|
image = { version = "0.24.7", default-features=false, features = ["gif", "jpeg", "ico", "png", "pnm", "webp", "bmp"] }
|
|
iroh = { git = "https://github.com/n0-computer/iroh", branch = "maint-0.4", default-features = false }
|
|
kamadak-exif = "0.5"
|
|
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" }
|
|
libc = "0.2"
|
|
mailparse = "0.14"
|
|
mime = "0.3.17"
|
|
num_cpus = "1.16"
|
|
num-derive = "0.4"
|
|
num-traits = "0.2"
|
|
once_cell = "1.18.0"
|
|
percent-encoding = "2.3"
|
|
parking_lot = "0.12"
|
|
pgp = { version = "0.10", default-features = false }
|
|
pin-project = "1"
|
|
pretty_env_logger = { version = "0.5", optional = true }
|
|
qrcodegen = "1.7.0"
|
|
quick-xml = "0.31"
|
|
rand = "0.8"
|
|
regex = "1.9"
|
|
reqwest = { version = "0.11.20", features = ["json"] }
|
|
rusqlite = { version = "0.30", features = ["sqlcipher"] }
|
|
rust-hsluv = "0.1"
|
|
sanitize-filename = "0.5"
|
|
serde_json = "1.0"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
sha-1 = "0.10"
|
|
sha2 = "0.10"
|
|
smallvec = "1"
|
|
strum = "0.25"
|
|
strum_macros = "0.25"
|
|
tagger = "4.3.4"
|
|
textwrap = "0.16.0"
|
|
thiserror = "1"
|
|
tokio = { version = "1", features = ["fs", "rt-multi-thread", "macros"] }
|
|
tokio-io-timeout = "1.2.0"
|
|
tokio-stream = { version = "0.1.14", features = ["fs"] }
|
|
tokio-tar = { version = "0.3" } # TODO: integrate tokio into async-tar
|
|
tokio-util = "0.7.9"
|
|
toml = "0.8"
|
|
url = "2"
|
|
uuid = { version = "1", features = ["serde", "v4"] }
|
|
|
|
[dev-dependencies]
|
|
ansi_term = "0.12.0"
|
|
anyhow = { version = "1", features = ["backtrace"] } # Enable `backtrace` feature in tests.
|
|
criterion = { version = "0.5.1", features = ["async_tokio"] }
|
|
futures-lite = "2.0.0"
|
|
log = "0.4"
|
|
pretty_env_logger = "0.5"
|
|
proptest = { version = "1", default-features = false, features = ["std"] }
|
|
tempfile = "3"
|
|
testdir = "0.8.0"
|
|
tokio = { version = "1", features = ["parking_lot", "rt-multi-thread", "macros"] }
|
|
pretty_assertions = "1.3.0"
|
|
|
|
[workspace]
|
|
members = [
|
|
"deltachat-ffi",
|
|
"deltachat_derive",
|
|
"deltachat-jsonrpc",
|
|
"deltachat-rpc-server",
|
|
"deltachat-ratelimit",
|
|
"deltachat-repl",
|
|
"format-flowed",
|
|
]
|
|
|
|
[[bench]]
|
|
name = "create_account"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "contacts"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "search_msgs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "receive_emails"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "get_chat_msgs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "get_chatlist"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "send_events"
|
|
harness = false
|
|
|
|
[features]
|
|
default = ["vendored"]
|
|
internals = []
|
|
vendored = [
|
|
"async-native-tls/vendored",
|
|
"rusqlite/bundled-sqlcipher-vendored-openssl",
|
|
"reqwest/native-tls-vendored"
|
|
]
|