Skip to content

Commit dcc93a9

Browse files
docs: add lots of internal docs (#199)
1 parent 99cd223 commit dcc93a9

9 files changed

Lines changed: 52 additions & 1 deletion

File tree

moz-webgpu-cts/src/file_spec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Contains [`FileSpec`]s: an abstraction for consistently handling file paths and globs from [the CLI](crate::main).
2+
13
use std::{fmt::Display, path::PathBuf};
24

35
use miette::Report;

moz-webgpu-cts/src/process_reports.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Implementation details for [`crate::process_reports()`].
2+
13
use std::{
24
collections::BTreeMap,
35
fmt::{Debug, Display},

moz-webgpu-cts/src/report.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
//! Data representation of WPT test reports. The conceptual entry point of this module is the
2+
//! [`ExecutionReport`] API.
3+
14
use serde::{
25
de::{Deserializer, Error},
36
Deserialize,
47
};
58

69
use crate::metadata::{BuildProfile, Platform, SubtestOutcome, TestOutcome};
710

11+
/// A `wptreport.json` file emitted by `wptrunner` and parsed by `moz-webgpu-cts` (which means it
12+
/// adheres to the strict subset that `moz-webgpu-cts` supports).
813
#[derive(Debug, Deserialize)]
914
pub(crate) struct ExecutionReport {
1015
pub run_info: RunInfo,
1116
#[serde(rename = "results")]
1217
pub entries: Vec<TestExecutionEntry>,
1318
}
1419

20+
/// An [`ExecutionReport::run_info`].
1521
#[derive(Debug)]
1622
pub(crate) struct RunInfo {
1723
pub platform: Platform,
@@ -64,6 +70,7 @@ impl<'de> Deserialize<'de> for RunInfo {
6470
}
6571
}
6672

73+
/// An entry in [`ExecutionReport::entries`].
6774
#[derive(Debug, Deserialize)]
6875
pub(crate) struct TestExecutionEntry {
6976
#[serde(rename = "test")]
@@ -72,6 +79,7 @@ pub(crate) struct TestExecutionEntry {
7279
pub result: TestExecutionResult,
7380
}
7481

82+
/// A [`TestExecutionEntry::result`].
7583
#[derive(Debug, Deserialize)]
7684
#[serde(untagged)]
7785
pub(crate) enum TestExecutionResult {
@@ -86,6 +94,7 @@ pub(crate) enum TestExecutionResult {
8694
},
8795
}
8896

97+
/// A subtest entry in [`TestExecutionResult`].
8998
#[derive(Debug, Deserialize)]
9099
pub(crate) struct SubtestExecutionResult {
91100
#[serde(rename = "name")]

moz-webgpu-cts/src/wpt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
//! Important primitives for working with [Web Platform Test] metadata.
2+
13
pub(crate) mod metadata;
24
pub(crate) mod path;

moz-webgpu-cts/src/wpt/metadata.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! `moz-webgpu-cts`' custom subset of WPT metadata. The conceptual entry point of this module is
2+
//! the [`File`] API.
3+
14
use std::{
25
collections::BTreeMap,
36
fmt::{self, Display, Formatter},
@@ -601,6 +604,10 @@ fn format_file_properties(props: &FileProps) -> impl Display + '_ {
601604
})
602605
}
603606

607+
/// A `implementation-status` property value; see also the `implementation-status` entry in [WPT
608+
/// upstream documentation].
609+
///
610+
/// [WPT upstream]: https://web-platform-tests.org/tools/wptrunner/docs/expectation.html#web-platform-tests-metadata
604611
#[derive(Debug, Default, EnumSetType, Serialize, ValueEnum)]
605612
pub enum ImplementationStatus {
606613
/// Indicates that functionality governing test(s) is implemented or currently being
@@ -906,13 +913,23 @@ where
906913
})
907914
}
908915

916+
/// The subset of WPT run environments can be handled by `moz-webgpu-cts`. Part of
917+
/// [`Applicability`].
918+
///
919+
/// This is essentially the set of OSes, software versions, and hardware that Firefox's WebGPU team
920+
/// uses in CI for WebGPU. When that changes, this changes accordingly.
909921
#[derive(Clone, Copy, Debug, Enum, Exhaust, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
910922
pub enum Platform {
911923
Windows,
912924
Linux,
913925
MacOs,
914926
}
915927

928+
/// The subset of browser build profiles can be handled by `moz-webgpu-cts`. Part of
929+
/// [`Applicability`].
930+
///
931+
/// This is essentially the set of profiles that Firefox's WebGPU team uses in CI for WebGPU. When
932+
/// that changes, this changes accordingly.
916933
#[derive(Clone, Copy, Debug, Enum, Exhaust, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
917934
pub enum BuildProfile {
918935
Debug,
@@ -1020,6 +1037,10 @@ where
10201037
}
10211038
}
10221039

1040+
/// The strict subset of WPT property conditionals that can be handled with `moz-webgpu-cts`.
1041+
///
1042+
/// The entire set of possible values here should be small enough that, when it is a key like in
1043+
/// [`ExpandedPropertyValue`], significant performance gains are possible.
10231044
#[derive(Clone, Debug, Default)]
10241045
pub struct Applicability {
10251046
pub platform: Option<Platform>,

moz-webgpu-cts/src/wpt/metadata/maybe_collapsed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! A module holding the [`MaybeCollapsed`] abstraction.
2+
13
use std::fmt::Debug;
24

35
/// Similar to the ubiquitous `enum Either`, but with the implication that `Collapsed` values are

moz-webgpu-cts/src/wpt/metadata/properties.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! WPT properties' value representation for `moz-webgpu-cts`.
2+
13
use std::{
24
collections::BTreeMap,
35
fmt::{self, Debug, Display, Formatter},
@@ -16,11 +18,16 @@ pub use self::disabled_string::DisabledString;
1618

1719
mod disabled_string;
1820

19-
/// A non-empty set of expected outcomes in a [`Test`] or [`Subtest`].
21+
/// A non-empty set of expected outcomes in a [`Test`] or [`Subtest`]. See also the `expected`
22+
/// entry in [WPT upstream documentation].
23+
///
24+
/// [WPT upstream]: https://web-platform-tests.org/tools/wptrunner/docs/expectation.html#web-platform-tests-metadata
2025
///
2126
/// The default expected test outcome is a "good" outcome, where testing passes. The `Out` type
2227
/// parameter should return this value in its implementation of `Default`.
2328
///
29+
/// Internally, this type is represented as a computationally efficient bitset.
30+
///
2431
/// [`Test`]: crate::metadata::Test
2532
/// [`Subtest`]: crate::metadata::Subtest
2633
#[derive(Clone, Copy, Serialize)]

moz-webgpu-cts/src/wpt/metadata/properties/disabled_string.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use std::{
55

66
use serde::Serialize;
77

8+
/// A `disabled` property value; see also the `disabled` entry in [WPT upstream documentation].
9+
///
10+
/// [WPT upstream]: https://web-platform-tests.org/tools/wptrunner/docs/expectation.html#web-platform-tests-metadata
811
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
912
pub struct DisabledString(Cow<'static, str>);
1013

moz-webgpu-cts/src/wpt/path.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Abstractions for dealing with paths to WebGPU CTS tests. The key offerings of this module are
2+
//! the [`Browser`] and [`SpecPath`] APIs.
3+
14
use std::{
25
borrow::Cow,
36
fmt::{Debug, Display},

0 commit comments

Comments
 (0)