Commit Graph

7591 Commits

Author SHA1 Message Date
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
Nick Mathewson 512064cc19 arti: Add a `logging.time_granularity` option with 1s default.
This lets us provide less information in our logs: in particular, it
lets us avoid logging with microsecond precision.

Closes #551.
2023-07-06 09:44:09 -04:00
Nick Mathewson 5f896aa504 Merge branch 'tracing-panic' into 'main'
arti: Install a panic hook that sends messages to `tracing`

Closes #921

See merge request tpo/core/arti!1377
2023-07-06 13:09:54 +00:00
Nick Mathewson d2b6fee3f9 arti: Note possibility for future use of other tracing panic provider 2023-07-06 08:50:53 -04:00
Nick Mathewson 01f1192b20 arti: On panic, avoid allocation even more.
The original version of our panic handler would allocate a string
for the panic `Location`.  But if we're panicking we'd like to keep
allocations to a minimum: so instead format the `Location`
conditionally.

This also drops a useless `std::borrow::Cow`.  (The possibility of a
"Don't have a `Cow`" commit message was considered and rejected.)
2023-07-06 08:45:34 -04:00
gabi-250 e3189857c4 Merge branch 'keymgr-enc-key-todo' into 'main'
keymgr: Explain why the TODO regarding EncodableKey can't be addressed.

See merge request tpo/core/arti!1372
2023-07-05 22:32:20 +00:00