Nick Mathewson
7168feefdd
tor-error: Add optional tracing support
...
The main contribution here is a set of convenience macros for
logging error `Report`s. Notably, this macros always logs
`Internal` and `BadAspiUsage` errors at `WARN`, unless they
are already at `ERROR` or more.
This is a little tricky because `tracing::event!()` requires
its Level argument to be a constant.
2023-07-07 09:00:31 -04:00
Ian Jackson
80f397fb0b
Merge branch 'allow_missing_panics' into 'main'
...
add_warning: Tolerate clippy::missing_panics_doc
Closes #950
See merge request tpo/core/arti!1380
2023-07-07 12:53:46 +00:00
Saksham Mittal
9de4f38b38
Make CompoundFactory private for external code
2023-07-07 18:18:44 +05:30
Nick Mathewson
2b3d4150e3
Merge branch 'clippy-nightly-20230703' into 'main'
...
Fix various warnings from clippy nightly
Closes #943
See merge request tpo/core/arti!1369
2023-07-07 12:26:45 +00:00
Ian Jackson
4c0935e13a
arti: Build with HS client support by default
...
Fixes #948
2023-07-07 12:54:08 +01:00
Ian Jackson
61344f68a5
arti Cargo.tomL: wrap default features list
2023-07-07 12:52:05 +01:00
Ian Jackson
6e495d8400
tor-rtmock: Use derive-adhoc for composite runtimes
2023-07-07 10:26:44 +01:00
Nick Mathewson
4caf86349c
Remove explicit allows for missing_panics_docs.
...
These are no longer needed.
2023-07-06 14:36:13 -04:00
Nick Mathewson
03f9f9987a
Run add_warning to remove `missing_panics_doc` deny.
...
Closes #950 .
2023-07-06 14:32:23 -04:00
Nick Mathewson
7e2fa11065
add_warning: Tolerate clippy::missing_panics_doc
...
As of current nightly, this lint now includes expect()s,
which makes it trigger way more than we'd like.
See discussion on #950 .
2023-07-06 14:29:40 -04:00
Nick Mathewson
07b4b11d7a
Avoid matches!(x, None), matches!(x, Ok(_))
...
This appeases clippy-nightly.
2023-07-06 14:26:48 -04:00
Nick Mathewson
486b6b8c82
tor-rtcompat: Simplify trivial all() expressions.
...
Clippy nightly doesn't like `#[cfg(all(...))]` with only a single
expression inside the `all(...)`.
This requires an adjustment in check_doc_features.
2023-07-06 14:26:43 -04:00
gabi-250
34b7699fff
Merge branch 'task5' into 'main'
...
tor-rtmock: Minor followups for impl_runtime
See merge request tpo/core/arti!1378
2023-07-06 16:05:30 +00:00
Ian Jackson
de97288c53
tor-rtmock: statically assert that the macro makes a Runtime impl
2023-07-06 15:58:42 +01:00
Ian Jackson
f0168b5220
tor-rtmock: Use the same specified field for BlockOn and Spawn
...
These are always the same and probably always will be.
2023-07-06 15:58:42 +01:00
Ian Jackson
1ec339daf4
Merge branch 'task4' into 'main'
...
Introduce a MockExecutor for fully-isolated test cases
See merge request tpo/core/arti!1375
2023-07-06 14:41:04 +00:00
Nick Mathewson
36a92e44d9
Merge branch 'log_precision' into 'main'
...
arti: Add a `logging.time_granularity` option with 1s default.
Closes #551
See merge request tpo/core/arti!1376
2023-07-06 14:37:49 +00:00
Saksham Mittal
c238434194
Mark builder() as experimental
2023-07-06 19:49:37 +05:30
Saksham Mittal
175b2911da
Import ChannelFactory instead of CompoundFactory
2023-07-06 19:48:28 +05:30
Saksham Mittal
008a9b7bc5
Rename get_channelbuilder() to builder()
2023-07-06 19:46:39 +05:30
Saksham Mittal
be6b72f946
Conditionally make CompoundFactory public
2023-07-06 19:45:34 +05:30
Ian Jackson
0b8b965cf7
tor-rtmock: Add semver.md
2023-07-06 15:14:41 +01:00
Ian Jackson
6ed8e0b669
tor-rtmock: task: Fix a typo
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919976
2023-07-06 15:14:41 +01:00
Ian Jackson
7e7428611e
tor-rtmock: task: clarify progress_until_stalled a little
2023-07-06 15:14:41 +01:00
Ian Jackson
6aff623c08
tor-rtmock: Runtime: Expand on "allowed" documentation
2023-07-06 15:14:41 +01:00
Ian Jackson
02293bd42d
tor-rtmock: task: Remove a () assignment
...
Discussion:
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919928
2023-07-06 15:14:41 +01:00
Ian Jackson
89994142d3
tor-rtmock: task: Abolish TaskFutureInfo alias (fmt)
2023-07-06 15:14:41 +01:00
Ian Jackson
78071c30ef
tor-rtmock: task: Abolish TaskFutureInfo alias
...
Requested by:
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919926
2023-07-06 15:14:41 +01:00
Ian Jackson
55329fe85b
tor-rtmock: Net: Make UDP sockets un-constructable
...
This will hopefully mean anyone trying to use this will notice that
it's not implemented.
Prompted by:
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919925
2023-07-06 15:14:41 +01:00
Ian Jackson
5a05960958
tor-rtmock: Add a cross-reference from MockSleepRuntime::wait_for
2023-07-06 15:14:41 +01:00
Ian Jackson
1f41281cfd
tor-dirmgr: bridge descriptor tests: Add a missing #[traced_test]
...
This seems to have been overlooked.
2023-07-06 15:14:41 +01:00
Ian Jackson
a4bb2a8b57
tor-dirmgr: bridge descriptor tests: Use MockRuntime (drop Tokio dep)
...
This isn't used any more.
2023-07-06 15:14:40 +01:00
Ian Jackson
25e51f212a
tor-dirmgr: bridge descriptor tests: Use MockRuntime (fmt)
...
Run rustfmt.
2023-07-06 15:14:40 +01:00
Ian Jackson
5eb066acf9
tor-dirmgr: bridge descriptor tests: Use MockRuntime
...
This abolishes a bodge sleep. It should make the tests deterministic.
2023-07-06 15:14:40 +01:00
Ian Jackson
473fd23f8b
tor-dirmgr: bridge descriptor tests: Fix a v. low prob. race
...
Drain a number of events, not just one. The stream might yield many
events, as explained in this new comment.
This fails every time with MockExecutor::try_test_with_various().
I think it might fail with the tokio exeuctor too, but evidently not
with high probability or we would have noticed.
2023-07-06 15:14:40 +01:00
Ian Jackson
bc63fdb34c
tor-hsclient: Abolish ad-hoc real-world-time sleeps
...
Now we can reliably wait precisely for the tasks to be all waiting.
This test case no longer involves any real executor.
2023-07-06 15:14:40 +01:00
Ian Jackson
dc28b320f4
tor-rtmock: MockRuntime: provide test_with_various
...
In both fallible and infallible variants, for convenience.
2023-07-06 15:14:40 +01:00
Ian Jackson
e23b1e00b5
tor-rtmock: MockExecutor: Configurable scheduling policy
2023-07-06 15:14:40 +01:00
Ian Jackson
be632ba0f9
tor-rtmock: Provide MockRuntime
2023-07-06 15:14:40 +01:00
Ian Jackson
67941488ab
tor-rtmock: Unit tests for MockExecutor
2023-07-06 15:14:40 +01:00
Ian Jackson
d82ed8d793
tor-rtmock: Provide MockExecutor
2023-07-06 15:14:40 +01:00
Ian Jackson
70fdd92030
tor-rtmock: impl Default for MockNetProvider
2023-07-06 15:14:40 +01:00
Ian Jackson
24da490ef5
tor-rtmock: impl Default for MockNetProvider (prep)
...
We want MockNetProvider to be Default.
In this commit: impl Default for MockNetwork and use it in new().
2023-07-06 15:14:40 +01:00
Ian Jackson
29cc83b35e
tor-rtmock: impl Default for MockSleepProvider
...
Pick an arbitrary start time roughly now. This will do for many
tests.
2023-07-06 15:14:40 +01:00
Ian Jackson
395a616c9f
tor-rtmock: net: "Provide" a UDP "implementation" which doesn't work
...
Nothing in our tree actually *uses* the UDP in tests.
We want a mock UDP provider that isn't part of a real runtime, so that
we can make a totally-mock runtime for properly controlled testing.
It seems best to make this part of MockNetProvider rather than a
separate type.
2023-07-06 15:14:40 +01:00
Ian Jackson
070a934451
tor-rtmock: Introduce impl_runtime_prelude (fmt)
2023-07-06 15:14:40 +01:00
Ian Jackson
492699d522
tor-rtmock: Introduce impl_runtime_prelude
...
This deduplicates some imports, which would otherwise be about to
become triplicated.
2023-07-06 15:14:40 +01:00
Ian Jackson
97e817b330
tor-rtmock: Introduce impl_runtime! macro
...
This deduplicates some trait delegation.
We want this now because we're about to introduce a third mock
runtime, so this would become triplication otherwise.
2023-07-06 15:14:40 +01:00
Nick Mathewson
5a46dfef8f
arti: comments about catch_unwind
2023-07-06 09:44:51 -04:00
Nick Mathewson
6b6b3d9e53
time_granularity: Make sure formatter can't panic
...
I was unable to assure myself that tracing_subscriber could
withstand a panicking Timer, so instead I'm trying to make sure
our own LogTimer can't panic.
2023-07-06 09:44:50 -04:00