[PATCH v1 0/2] Add Delta::to_jiffies_timeout() with tests

FUJITA Tomonori <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
From: FUJITA Tomonori <[email protected]>

The first patch is new. It adds an example and a KUnit test for
Delta::as_millis_ceil(), which Miguel asked for [1].

The second patch was previously posted as patch 4 of [2]; patches 1-3
of that series have been applied. It has been reworked to fix the bug
Miguel reported [1]: on 32 bit with HZ=1000, to_jiffies_timeout()
could return a value larger than MAX_JIFFY_OFFSET.

Both patches follow the format agreed in [3]: the examples show the
behaviour, while the boundary inputs live in `#[test]` KUnit tests, with the
magic numbers as named constants local to the test module rather than part
of the exported API. 

[1] https://lore.kernel.org/rust-for-linux/CANiq72kHP1s7bGr4=xfJGR8KY=aUpjOB4OwLEG5E=TKULXg5Rg@mail.gmail.com/
[2] https://lore.kernel.org/rust-for-linux/[email protected]/
[3] https://lore.kernel.org/rust-for-linux/[email protected]/

FUJITA Tomonori (2):
  rust: time: add example and KUnit test for Delta::as_millis_ceil()
  rust: time: add Delta::to_jiffies_timeout() for timeout conversion

 rust/kernel/Kconfig.test |  10 ++++
 rust/kernel/time.rs      | 108 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+)


base-commit: 8fe5e5f62bdb9660999449a4b5eaebcc37d7f842
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.