-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
299: Update `CommandReturn` in preparation for the Command implementation. r=jrvanwhy a=jrvanwhy This makes the following change to `CommandReturn`, which are needed by my implementation of the Command system call and its tests: 1. Implements `Debug`. This is not a replacement for `ufmt`-based debugging, but rather to support unit tests (e.g. `assert_eq!`). 2. Changes the register values from `usize` to `u32`, as `RawSyscalls` no longer returns its registers as `usize`s. I discovered that code that interacts with `CommandReturn` is cleaner if we store `u32`s in `CommandReturn` rather than `Register`s. 3. `new` is now `pub` rather than `pub(crate)`, as `libtock_unittest` needs to create `CommandReturn` values. 4. I added `CommandReturn::raw_values`, which will be used by `libtock_unittest` to transform `CommandReturn`s from fake drivers and expected syscalls into register values for `RawSyscalls`. 5. I added safe `CommandReturn` constructors to `libtock_unittest`. `libtock_platform` intentionally does not expose safe constructors, as a process binary should only create a `CommandReturn` by calling the Command system call. However, `libtock_unittest` and unit tests based on it need to create `CommandReturn` values as well, so I added safe constructors. The combination of 1 and 5 required me to add `Debug` to `ErrorCode` and `ReturnVariant`, so I did that as well. Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
- Loading branch information
Showing
6 changed files
with
229 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.