Skip to content

Commit

Permalink
Add a textreview check (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Apr 21, 2024
1 parent f75edc9 commit cb57433
Show file tree
Hide file tree
Showing 24 changed files with 269 additions and 82 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# All files are assumed to be reviewed in a printed form by default.
* textreview
# Binary files are not reviewed in printed form.
*.pdf -textreview
*.png -textreview
*.wasm -textreview
# Submodules are not reviewed in printed form.
/third_party/** -textreview
3 changes: 3 additions & 0 deletions .github/actions/ci-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ runs:
- if: ${{ contains(fromJSON(inputs.checks), 'changelog') }}
run: ./scripts/ci-changelog.sh
shell: bash
- if: ${{ contains(fromJSON(inputs.checks), 'textreview') }}
run: cargo xtask textreview
shell: bash
- if: ${{ contains(fromJSON(inputs.checks), 'sync') }}
run: ./scripts/sync.sh
shell: bash
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ jobs:
done
true
}
x copyright pull_request
x changelog pull_request
x sync pull_request push schedule
x publish pull_request push schedule
x taplo pull_request push schedule
x applets pull_request push schedule
x runners pull_request push schedule
x tests-0 pull_request push schedule
x tests-1 pull_request push schedule
x tests-2 pull_request push schedule
x hw-host pull_request push schedule
x book pull_request push schedule
x footprint pull_request push
x copyright pull_request
x changelog pull_request
x textreview pull_request
x sync pull_request push schedule
x publish pull_request push schedule
x taplo pull_request push schedule
x applets pull_request push schedule
x runners pull_request push schedule
x tests-0 pull_request push schedule
x tests-1 pull_request push schedule
x tests-2 pull_request push schedule
x hw-host pull_request push schedule
x book pull_request push schedule
x footprint pull_request push
echo "checks=[$CHECKS]" >> $GITHUB_OUTPUT
outputs:
checks: ${{ steps.checks.outputs.checks }}
Expand Down
4 changes: 2 additions & 2 deletions book/src/applet/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ After a bunch of compilation steps, you should see something that ends like:

```plaintext
".../wrapper.sh" "probe-rs" "run" "--chip=nRF52840_xxAA" "target/.../runner-nordic"
Erasing sectors [00:00:05] [################################]
Programming pages [00:00:04] [################################]
Erasing sectors [00:00:05] [################################]
Programming pages [00:00:04] [################################]
0.090527: hello world
```

Expand Down
1 change: 1 addition & 0 deletions crates/board/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Patch

- Update dependencies
- Document all public API

## 0.6.0
Expand Down
2 changes: 1 addition & 1 deletion crates/board/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/board/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ usbd-serial = { version = "0.2.0", default-features = false }
wasefire-applet-api = { version = "0.6.0", path = "../api", features = ["host"] }
wasefire-error = { version = "0.1.0", path = "../error" }
wasefire-logger = { version = "0.1.4", path = "../logger" }
wasefire-store = { version = "0.2.3", path = "../store", optional = true }
wasefire-store = { version = "0.2.4-git", path = "../store", optional = true }

[features]
std = ["wasefire-store?/std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/runner-host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/runner-nordic/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/scheduler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@

## 0.1.0

<!-- Increment to skip CHANGELOG.md test: 31 -->
<!-- Increment to skip CHANGELOG.md test: 32 -->
2 changes: 1 addition & 1 deletion crates/scheduler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ wasefire-applet-api = { version = "0.6.0", path = "../api", features = ["host"]
wasefire-board-api = { version = "0.6.1-git", path = "../board" }
wasefire-error = { version = "0.1.0", path = "../error" }
wasefire-logger = { version = "0.1.4", path = "../logger" }
wasefire-store = { version = "0.2.3", path = "../store", optional = true }
wasefire-store = { version = "0.2.4-git", path = "../store", optional = true }
wasefire-sync = { version = "0.1.0", path = "../sync" }

[dependencies.wasefire-interpreter]
Expand Down
6 changes: 6 additions & 0 deletions crates/store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.2.4-git

### Patch

- Use pure ASCII instead of UTF-8 in documentation

## 0.2.3

### Minor
Expand Down
2 changes: 1 addition & 1 deletion crates/store/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasefire-store"
version = "0.2.3"
version = "0.2.4-git"
authors = ["Julien Cretin <[email protected]>"]
license = "Apache-2.0"
publish = true
Expand Down
2 changes: 1 addition & 1 deletion crates/store/fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions crates/store/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Format {

/// The number of pages in the storage, denoted by N.
///
/// We have [`MIN_NUM_PAGES`] N [`MAX_PAGE_INDEX`] + 1.
/// We have [`MIN_NUM_PAGES`] <= N <= [`MAX_PAGE_INDEX`] + 1.
pub fn num_pages(&self) -> Nat {
self.num_pages
}
Expand All @@ -222,7 +222,7 @@ impl Format {

/// The maximum number of times a page can be erased, denoted by E.
///
/// We have E [`MAX_ERASE_CYCLE`].
/// We have E <= [`MAX_ERASE_CYCLE`].
pub fn max_page_erases(&self) -> Nat {
self.max_page_erases
}
Expand All @@ -241,7 +241,7 @@ impl Format {
///
/// A virtual page is stored in a physical page after the page header.
///
/// We have [`MIN_PAGE_SIZE`] - 2 Q [`MAX_VIRT_PAGE_SIZE`].
/// We have [`MIN_PAGE_SIZE`] - 2 <= Q <= [`MAX_VIRT_PAGE_SIZE`].
pub fn virt_page_size(&self) -> Nat {
self.page_size() / self.word_size() - CONTENT_WORD
}
Expand All @@ -258,7 +258,7 @@ impl Format {
/// A prefix is the first words of a virtual page that belong to the last entry of the previous
/// virtual page. This happens because entries may overlap up to 2 virtual pages.
///
/// We have [`MIN_PAGE_SIZE`] - 3 M < Q.
/// We have [`MIN_PAGE_SIZE`] - 3 <= M < Q.
pub fn max_prefix_len(&self) -> Nat {
self.bytes_to_words(self.max_value_len())
}
Expand All @@ -268,7 +268,7 @@ impl Format {
/// This is the span of virtual storage that is accessible. In particular, all store content
/// fits within this window.
///
/// We have W = (N - 1) × Q - M.
/// We have W = (N - 1) * Q - M.
pub fn window_size(&self) -> Nat {
(self.num_pages() - 1) * self.virt_page_size() - self.max_prefix_len()
}
Expand All @@ -279,19 +279,19 @@ impl Format {
/// than the virtual window because compaction may transiently overflow out of this virtual
/// capacity.
///
/// We have V = W - (N - 1) = (N - 1) × (Q - 1) - M.
/// We have V = W - (N - 1) = (N - 1) * (Q - 1) - M.
pub fn virt_size(&self) -> Nat {
(self.num_pages() - 1) * (self.virt_page_size() - 1) - self.max_prefix_len()
}

/// The total user capacity in words, denoted by C.
///
/// We have C = V - N = (N - 1) × (Q - 2) - M - 1.
/// We have C = V - N = (N - 1) * (Q - 2) - M - 1.
///
/// We can show C (N - 2) × (Q - 2) - 2 with the following steps:
/// - M Q - 1 from M < Q from [M](Format::max_prefix_len)'s definition
/// - C (N - 1) × (Q - 2) - (Q - 1) - 1 from C's definition
/// - C (N - 2) × (Q - 2) - 2 by calculus
/// We can show C >= (N - 2) * (Q - 2) - 2 with the following steps:
/// - M <= Q - 1 from M < Q from [M](Format::max_prefix_len)'s definition
/// - C >= (N - 1) * (Q - 2) - (Q - 1) - 1 from C's definition
/// - C >= (N - 2) * (Q - 2) - 2 by calculus
pub fn total_capacity(&self) -> Nat {
// From the virtual capacity, we reserve N - 1 words for `Erase` entries and 1 word for a
// `Clear` entry.
Expand All @@ -300,7 +300,7 @@ impl Format {

/// The total virtual lifetime in words, denoted by L.
///
/// We have L = (E × N + N - 1) × Q.
/// We have L = (E * N + N - 1) * Q.
pub fn total_lifetime(&self) -> Position {
Position::new(self, self.max_page_erases(), self.num_pages() - 1, 0)
}
Expand Down Expand Up @@ -705,7 +705,7 @@ bitfield! {
/// - p denote a page offset, thus between 0 and N - 1
/// - c denote the number of times a page was erased, thus between 0 and E
///
/// The position of a word is (c × N + p) × Q + w. This position monotonically increases and
/// The position of a word is (c * N + p) * Q + w. This position monotonically increases and
/// represents the consumed lifetime of the storage.
///
/// This type is kept abstract to avoid possible confusion with [`Nat`] and [`Word`] if they happen
Expand Down
Loading

0 comments on commit cb57433

Please sign in to comment.