aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src/time.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-1/+0
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-rtcompat+misc: add `NetStreamProvider::ConnectOptions`Steven Engler2026-06-081-1/+1
| | | | | | | | | This adds the trait type `ConnectOptions` to `NetStreamProvider` and adds this `ConnectOptions` as an argument to `NetStreamProvider::connect()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* tor-rtcompat+misc: add `NetStreamProvider::ListenOptions`Steven Engler2026-05-071-1/+1
| | | | | | | | | This adds the trait type `ListenOptions` to `NetStreamProvider` and adds this `ListenOptions` as an argument to `NetStreamProvider::listen()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* rtcompat, rtmock: Port to web-time-compat.Nick Mathewson2026-03-261-6/+7
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-7/+3
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-rtmock: Add since= to deprecatedsIan Jackson2025-03-061-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2843#note_3169975
* tor-rtmock: Actually apply deprecated attr to deprecated time.rsIan Jackson2025-03-061-5/+4
|
* tor-rtmock: miri: disable tests that use wallclock timeIan Jackson2024-10-081-1/+2
|
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-241-1/+1
| | | | | | Stop referring to TCP streams in its documentation; update other documentation to refer to NetStreamProvider rather than TcpProvider.
* rtcompat: Remove accept() from TcpListenerNick Mathewson2024-09-241-2/+5
| | | | | | | | | | It's redundant with the incoming() method (which turns the TcpListener into a Stream of connections), and nothing actually used it outside of tests. Removing this method allows us to simplify our TcpListener code a good deal, as can be seen by some of the implementations we removed from our example and testing code.
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | 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.
* 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: time_core: rename from coarse_timeIan Jackson2024-03-251-1/+1
| | | | | | 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-251-1/+1
| | | | | Modules with the same name as external crates don't work well with our MSRV.
* tor-rtmock: impl CoarseTimeProvider for mocked time providersIan Jackson2024-03-251-1/+13
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* 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: 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: 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
|
* tor-rtmock: Add a deprecation warning to MockSleepProviderIan Jackson2023-10-031-0/+13
|
* Add cognitive-complexity exceptions for clippy.Nick Mathewson2023-09-051-0/+1
| | | | I have no idea why these became necessary.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* tor-rtmock: impl Default for MockSleepProviderIan Jackson2023-07-061-0/+7
| | | | | Pick an arbitrary start time roughly now. This will do for many tests.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-0/+8
| | | | | | | | | | | | | | - arti#445 highlighted the lack of good documentation around Arti's multiple runtime support, as well as it being difficult to determine what runtime was actually in use. - Improve the documentation to solve the first problem. - To solve the second problem, make Runtime require Debug (which is arguably a good idea anyway, since it makes them easier to embed in things), and print out the current runtime's Debug information when arti is invoked with `--version`. - (It also prints out other Cargo features, too!) fixes arti#445
* Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-2/+0
|
* use wallclock where possible in teststrinity-1686a2022-02-261-0/+2
|
* Make test_with_all_runtimes cover _all_ the runtimes.Nick Mathewson2022-01-261-2/+2
| | | | | | | | | | | This took some refactoring, so that I wouldn't need to define 9 different versions of the function. It also required that we change the behavior of test_with_all_runtimes slightly, so that it asserts on _any_ failure rather than asserting on most but returning Err() for others. That in turn required changes to a few of its callers. There's probably a better way to do all of this macro business, but this is the best I could find.
* Replace all println/eprintln calls outside of arti CLI with trace.Nick Mathewson2021-11-041-17/+22
|
* Fix some clippy-nightly warnings.Nick Mathewson2021-10-261-6/+8
| | | | These are my fault; I merged the wrong version of !102. :p
* Overhaul the way WaitFor and the MockSleepProvider worketa2021-10-261-1/+200
| | | | | | | | | | | | | | | | | | | | | Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor). The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required. (In some cases, code needed to be hacked up a bit in order to be made properly testable using these APIs; the `MockablePlan` trait included in here is somewhat unfortunate.) This should fix arti#149.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-9/+10
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+312
This will cause some pain for now, but now is really the best time to do this kind of thing.