You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add tests that can run in CI, and split up the CI workflows - #67
Closes#66. Adds a device backed test suite that runs on VB-Cable installed on the
runner, plus a set of device free tests, and splits the single workflow into three.
ci.yml for the device free checks, device-tests.yml for the suite that needs a
device, publish.yml for releases. A flaky device job can no longer block the lint
and unit test signal.
30 device tests behind a new device-tests feature, so a plain cargo test neither
builds nor runs them. Playback and capture in both sharing modes and both timing
modes, the exclusive mode capability probe cross checked against what initialize_client really accepts, the declared data ranges, enumeration, and the
buffer length and direction guards.
6 device free tests for the arithmetic the crate does itself, which had none:
periods, buffer flags, hardware support bits and channel masks.
The doctests now run in CI, which they never did, since --all-targets excludes
them. cargo doc runs with -D warnings too.
VB-Cable is installed through SetupAPI, no devcon and no reboot, ported from the
CamillaDSP e2e suite. The download is pinned and its hash checked.
Fixed a stale claim in the process loopback docs that the tests caught: get_sharemode does work in that mode.
The list of methods that do not work in process loopback mode claimed that
`get_sharemode` always returns `None`. It returns the right value, since
`initialize_client` records the sharing mode on the Rust side rather than asking
the client for it. Removed that entry, and noted that `is_aec_supported` needs an
initialised client, which is not obvious and is not written down anywhere else.
The example is now `no_run`. It activates a process loopback client, so it needs a
running audio service, which a build machine may not have. That also lets the
doctests run in CI, which they previously did not.
Replaces windows-ci.yml with ci.yml for the device free checks and publish.yml for
releases. Keeping them apart means the publish job no longer needs an event guard,
and a device job can be added without a flaky device blocking the lint and unit test
signal.
- Run the doctests. `cargo test --all-targets` excludes them, so none of the three
had ever run.
- Run `cargo doc` with `-D warnings`, which nothing checked before.
- Pass `--all-features` to check and clippy, so everything is linted.
- Add dependency caching, a concurrency group, a permissions block, timeouts and
workflow_dispatch.
- Drop `cargo check --examples`, which `--all-targets` already covers.
Six tests in tests/public_api.rs, covering the arithmetic the crate does itself and
which had no tests at all: `calculate_period_100ns`, `BufferFlags`, `HardwareSupport`,
`make_channelmasks` beyond the three channel case its doctest covers, and the option
accumulation in `AudioClientProperties`.
Also covers the enumerator on a machine with no audio device, which only a bare CI
runner can exercise. That part is behind WASAPI_EXPECT_NO_DEVICES, so the test is
harmless on a machine that has devices, and ci.yml sets it.
Thirty tests in tests/device/, behind the new `device-tests` feature so a plain
`cargo test` neither builds nor runs them. The CI job installs VB-Cable on the runner
through SetupAPI, with no devcon and no reboot, ported from the CamillaDSP e2e suite.
- Playback and capture in both sharing modes and both timing modes. The assertion is
that the library asks for and delivers data at the rate the format declares, so the
data written is silence and nothing looks at content.
- The exclusive mode capability probe and `is_supported` cross checked against what
`initialize_client` really accepts, over a matrix of formats, rates and channel
counts.
- The data ranges a driver declares, which until now had only its reply parsing
tested, not the topology walk or the IOCTL.
- Enumeration, the buffer length checks, and the direction guards.
The tests look for the cable by its interface name, which is the same whether it was
installed by the vendor setup or by the driver alone. A missing cable prints a note
and passes, unless WASAPI_REQUIRE_DEVICE is set, which the CI job does so a failed
install cannot look green.
The licence in the archive readme allows copying the package as is, so the earlier
note claiming redistribution needs an agreement was wrong. Replaced it with the
origin and donationware credit the licence asks for on distribution, and with the
clause that does apply here: integrating the package into another installation
procedure needs the author's agreement, and this script installs the driver itself
rather than running the vendor setup.
Four real defects and two stale comments.
- The fixture held the device lock in its first field, so it was released before the
devices it covers, since fields drop in declaration order. Moved it last, which is
the whole point of the lock: the endpoint is not free until the devices are dropped.
- `probe_matches_is_supported` keyed formats on the two bit depths only, so S32 and
F32 both collapsed to (32, 32). If the probe reported one and dropped the other,
the check for formats it left out skipped both and the regression passed. The key
now includes the sample type.
- WASAPI_TEST_LOG was read by nothing, so the log level input in the device workflow
did nothing at all. The fixture now initialises simplelog from it.
- `multichannel_endpoint_declares_more_channels` never compared the two endpoints,
and could not have: both render endpoints of the cable declare 16 channels and both
accept up to 16, so the premise in its name was wrong. Replaced with a test of what
is actually worth checking, that a 16 channel format negotiates a mask from
`make_channelmasks`, where above 8 channels only the simple mask is left. That also
made the 16 channel endpoint lookup unused, so it is gone.
- Corrected the feature comment, which pointed at tests/device.rs rather than the
directory, and a comment in `init_com` that referred to a COM lifecycle test which
no longer exists.
Comparison omits sample type and conflates S32 with F32
tests/device/capability.rs:421
This comparison drops the sample type, so S32 and F32 both become the same (channels, 32, 32) entry. A bounded scan returning one while the staged scan returns the other would therefore pass; include get_subformat() (or an orderable encoding of it) in the comparison key.
Test does not verify documented post-initialization limitations
tests/device/errors.rs:360
The documented limitations are not actually verified after initialization: get_available_space_in_frames is currently called only before initialization, when any normal client returns ClientNotInit, and the render-client, session-control, and clock failures are never checked. Assert these calls here after initialization so the test can detect a stale process-loopback limitation.
Assertion fails to verify option accumulation
tests/public_api.rs:187
This assertion does not prove that options accumulate: if set_option were changed to assign its argument, raw would still differ from both (which would contain only MatchFormat) and the test would pass. Compare both with each single-option value so replacement of the first option is detected.
workflow_dispatch let anyone with write access publish any branch or tag to
crates.io with the registry token, which the old single workflow did not allow: it
gated publishing on a published release. A crates.io release cannot be taken back,
so the gate is worth keeping tight.
Nothing is lost. A release whose publish failed can be retried with "Re-run jobs",
which replays the run with the same release event. The CI and device workflows keep
their manual trigger, where it is useful and harmless.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #66. Adds a device backed test suite that runs on VB-Cable installed on the
runner, plus a set of device free tests, and splits the single workflow into three.
ci.ymlfor the device free checks,device-tests.ymlfor the suite that needs adevice,
publish.ymlfor releases. A flaky device job can no longer block the lintand unit test signal.
device-testsfeature, so a plaincargo testneitherbuilds nor runs them. Playback and capture in both sharing modes and both timing
modes, the exclusive mode capability probe cross checked against what
initialize_clientreally accepts, the declared data ranges, enumeration, and thebuffer length and direction guards.
periods, buffer flags, hardware support bits and channel masks.
--all-targetsexcludesthem.
cargo docruns with-D warningstoo.CamillaDSP e2e suite. The download is pinned and its hash checked.
get_sharemodedoes work in that mode.