summaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src
Commit message (Collapse)AuthorAgeFilesLines
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-282-2/+3
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* Match previous backtrace formattingRobin Leander Schröder2024-08-081-1/+1
| | | | | std::backtrace::Backtrace's Display looks the same as backtrace_rs::Backtrace's Debug
* Use std::backtrace instead of backtrace crateRobin Leander Schröder2024-08-011-33/+8
| | | | | Removes resolve_backtraces from rtmock since it is no longer needed as stdlib's backtraces automatically lazily resolve without needing a &mut.
* tor-rtmock docs: Add some more discussion of the simulated timeIan Jackson2024-07-301-1/+17
|
* tor-rtmock docs: We have CoarseTimeProvider nowIan Jackson2024-07-301-2/+3
| | | | Improve/replace some out-of-date notes in the docs.
* tls: Support export keying material (RFC 5705)David Goulet2024-06-182-0/+15
| | | | | | | | | | | | | Add a function to get the keying material as detailed by RFC 5705. Because native-tls doesn't have such support, there is a place holder panic!() for now. This means that for the forseable future, relay would only work with rustls until we figure out a solution for native-tls. Closes #1432 Signed-off-by: David Goulet <[email protected]>
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-172-2/+2
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Suppress a spurious dead code lintIan Jackson2024-04-251-0/+1
|
* tor-rtmock: Remove a todo commentIan Jackson2024-04-031-5/+0
| | | | derive-deftly 0.10.x rejects unrecognised `#[deftly]` attributes.
* Switch to derive-deftlyIan Jackson2024-04-035-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* tor-rtmock: Change word in commentIan Jackson2024-04-021-1/+1
| | | | | This was incorrect usage, as pointed out in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2052#note_3012727
* tor-rtmock: Use MockTimeCore in time.rs too (fmt)Ian Jackson2024-03-251-6/+12
|
* tor-rtmock: Use MockTimeCore in time.rs tooIan Jackson2024-03-251-23/+18
|
* tor-rtmock: Introduce MockTimeCoreIan Jackson2024-03-252-25/+82
| | | | | | | | | | | | | It bothered me that when I added a `MockCoarseTimeProvider` to the mock time providers, I had to manually grep to check that there weren't places the time was updated where I ought to also update the coarse time. Prove that the code is right by hiding all the times together in a struct that prevents un-synchronised updates. This is part 1, where we move the fields from simple_time::State to the new struct.
* tor-rtmock: time_core: rename from coarse_time (fmt)Ian Jackson2024-03-251-1/+1
|
* tor-rtmock: time_core: rename from coarse_timeIan Jackson2024-03-254-3/+3
| | | | | | We're going to put more in here. (Yes, I know we just invented this...)
* tor-rtmock: Rename coarsetime module to coarse_timeIan Jackson2024-03-254-3/+3
| | | | | Modules with the same name as external crates don't work well with our MSRV.
* tor-rtcompat: Make Runtime imply CoarseTimeProvider, etc. (fmt)Ian Jackson2024-03-251-2/+2
|
* tor-rtcompat: Make Runtime imply CoarseTimeProvider, etc.Ian Jackson2024-03-251-0/+8
| | | | We must also impl CoarseTimeProvider for mocked runtimes.
* tor-rtmock: impl CoarseTimeProvider for mocked time providersIan Jackson2024-03-254-1/+70
|
* tor-rtmock: Implement from_real in terms of from_wallclockIan Jackson2024-03-251-1/+1
| | | | This reduces duplication a little.
* Run maint/add_warning.Nick Mathewson2024-03-136-0/+6
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* clippy: Use Result::cloned in several placesIan Jackson2024-01-311-1/+1
|
* Fix typosDimitris Apostolou2024-01-081-1/+1
|
* rtmock: Remove now-needless to_string calls.Nick Mathewson2023-11-301-4/+0
|
* tor-rtmock: get rid of unwrap()Saksham Mittal2023-11-211-1/+1
|
* tor-rtmock: handle Receiver result inside spawn_join()Saksham Mittal2023-11-212-3/+3
|
* tor-rtmock: use expect() insteadSaksham Mittal2023-11-211-1/+2
|
* tor-rtmock: change return types to be less concreteSaksham Mittal2023-11-212-2/+2
|
* tor-rtmock: change return type of spawn_join()Saksham Mittal2023-11-212-6/+6
| | | | | This makes it synchronous. The trait bounds on the return type have also been relaxed to not require Clone
* tor-rtmock: introduce spawn_join() for MockRuntime & MockExecutorSaksham Mittal2023-11-212-0/+30
| | | | | | | This helps abstract away the need to create a oneshot channel in order to get the return value out of an async function when using MockRuntime. ref: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1727#note_2965352
* tor-rtmock: MockRuntimeBuilder: new sleep_provider() setterIan Jackson2023-11-011-1/+10
|
* tor-rtmock: simplify/reorganise MockRuntimeBuilder::buildIan Jackson2023-11-011-4/+3
| | | | | Always reify a default SimpleMockTimeProvider, and then apply the starting_wallclock to it. This will make the next change fit.
* tor-rtmock: MockRuntime::test_with_various: Print what we're doingIan Jackson2023-10-161-1/+6
| | | | | | | | Without this, it can be a bit confusing since you just get the output (if any) of all the test runs, concatenated. It seems sensible to put the framing centrally. And, this would be helpful if the test fails for any reason.
* tor-rtmock: MockExecutor: Provide n_tasks accessorIan Jackson2023-10-161-0/+15
|
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-111-1/+1
| | | | cargo fmt, precisely.
* oneshot: Use veneer in tor-rtmockIan Jackson2023-10-111-1/+1
|
* tor-rtmock: simple_time: Don't export StateIan Jackson2023-10-051-1/+1
| | | | This was a slip.
* tor-rtmock: MockSleepProvider docs: Move example (fmt)Ian Jackson2023-10-051-12/+12
| | | | | Adding "/// " to every line causes rustfmt to have conniptions about the trailing whitespace.
* tor-rtmock: MockSleepProvider docs: Move exampleIan Jackson2023-10-051-0/+73
| | | | | | | | | | | This example demonstrates MockSleepRuntime, which we don't want to use in new tests. It's probably worth keeping it, though, to help with comprehension of existing tests. So move it. This does rather highlight the lack of good overall example/instructions for MockRuntime.
* tor-rtmock: simple_time: Rename `wakers` to `futures` (fmt)Ian Jackson2023-10-051-1/+4
|
* tor-rtmock: simple_time: Rename `wakers` to `futures`Ian Jackson2023-10-051-11/+11
| | | | This is clearer, I think.
* tor-rtmock: simple_time: Rename `pq` to `unready`Ian Jackson2023-10-051-13/+13
| | | | This is clearer, I think.
* tor-rtmock: simple_time: Expand on advance and task orderingIan Jackson2023-10-051-2/+8
|
* tor-rtmock: simple_time: Clarify/correct comments about invariantIan Jackson2023-10-051-2/+2
|
* tor-rtmock: Add deprecation warning to MockSleepRuntimeIan Jackson2023-10-051-1/+7
|
* tor-rtmock: MockSleepProvider docs: Move deprecation discussionIan Jackson2023-10-051-32/+38
| | | | | The module-level docs here are less visible and also not where most of the other stuff was.
* tor-rtmock: MockSleepProvider docs: Compare with SimpleMockTimeProviderIan Jackson2023-10-051-0/+22
|