Commit graph

15 commits

Author SHA1 Message Date
Daniel Verkamp
52b8e42869 Cargo.toml: avoid "*" versions for external crates
Ensure that every Cargo.toml dependency on a third-party crates.io crate
specifies at least a major version, or a minor version for 0.x crates,
to ensure that if a new major version is published, it cannot cause API
breaks.

The versions are selected to match the ones already in Cargo.lock, so
this should have no functional change, but it will help prevent new "*"
versions from being introduced via copy-and-paste.

For rationale, see the Cargo FAQ:
<https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies>

`minijail`, `audio_streams`, and `cras` are left as "*" for now, since
they have unusual situations (imported from a submodule and/or replaced
at build time with ebuild magic).

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=verify Cargo.lock is unchanged

Change-Id: Ifa18199f812f01d2d10bfb4146b3353c1a76527c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5555656
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-05-22 01:01:42 +00:00
Pattara Teerapong
e4f6374761 devices: snd: Use PCM device client_type and stream_type for CRAS
Read PCM device parameters and set CRAS client's client type and stream
type. Fallback to the virtio snd device's client type and
CRAS_STREAM_TYPE_DEFAULT if not set.

Resize the PCM device config of the provided parameters to match the
number of PCM devices.

Also add unit test for the virtio-snd::new function which checks the
PCM device config resizing and the data that are derived from the
parameters.

BUG=b:269984052
TEST=cargo test --features audio,audio_cras
TEST=FEATURES=test emerge-amd64-generic crosvm
TEST=Setting client_type and stream_type on ARCVM

Change-Id: I692881a1e4117f8c67b162d2966acfab9282011a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4275361
Commit-Queue: Pattara Teerapong <pteerapong@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
2023-03-02 06:22:40 +00:00
Pattara Teerapong
575d9bf02c devices: snd: Add parsing PCMDeviceParameters to Parameters
Add new parameters to snd device: output_device_config,
input_device_config for configuring each PCM device.

Add PCMDeviceParameters to describe the parameters for the PCM device.
For all platforms, it supported setting stream effects. For ChromeOS
with CRAS, it also supported setting different client type and
stream type when connecting stream to CRAS.

This CL only implement the parsing parameters from command line part
and does not actually use the value yet.

This CL depends on libcras StreamType implementation CL:4273509

BUG=b:269984052
TEST=cargo test --features=audio,audio_cras
TEST=FEATURES=test emerge-amd64-generic crosvm

Change-Id: I1d64af5edf2eb4391c439edf3ce90f5426fdf57c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4274044
Reviewed-by: Judy Hsiao <judyhsiao@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Pattara Teerapong <pteerapong@chromium.org>
2023-03-01 10:03:19 +00:00
Daniel Verkamp
ac0fc378a3 Fix remaining Chrome/Chromium OS instances
These should be written as ChromeOS and ChromiumOS (without the space)
to match the updated branding. The copyright headers were already
migrated to the new style (https://crrev.com/c/3894243), but there were
some more instances left over.

BUG=None
TEST=tools/cargo-doc

Change-Id: I8c76aea2eb33b2e370ab71ee9b5cc0a4cfd00585
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4129934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-01-03 22:14:30 +00:00
Daniel Verkamp
10990c89af Rust 1.65: Fix clippy derive_partial_eq_without_eq lints
BUG=b:260784028
TEST=tools/clippy

Change-Id: Ib2b595385ed04b9480b22549334ce798d980d347
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4064717
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-01 01:32:30 +00:00
Daniel Verkamp
f29a992754 tree-wide: apply cargo fmt --nightly
Fix a few recently introduced formatting mismatches.

Change-Id: I1617683532d3cc45f67ec15408fbd4ec4c9d6bb2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3928132
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-10-03 21:39:26 +00:00
Vineeth Pillai
aea39132e8 libcras_stub: Stub implementation
Stub the required parts of libcras so that upstream builds with
audio_cras feature

BUG=b:244618503
TEST=cargo build --features audio_cras

Change-Id: I21eb3bcb9a61990740b1419f124401878619481e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911099
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
2022-09-21 23:36:06 +00:00
Daniel Verkamp
7c6d8bec3f health-check: enforce blank line after copyright
While we are tweaking all of the copyright headers, let's take the
opportunity to ensure there is always a blank line after the copyright
header for consistency. (Almost all files already follow this style.)

This includes a slightly ugly regex to allow the end of a C-style
comment block after the end of the copyright:

/*
 * Example comment block
 */   <-- this line

Change-Id: Idfd0855861e5ecb3d33afae942fdba908af0dcff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892521
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-09-13 22:24:35 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00
Dennis Kempin
78f62a44e7 Update copyright header check to cover all files
generated files and a list of excluded files are skipped.
Others are fixed to include the missing header.

BUG=b:246579983
TEST=./tools/health-check --all copyright_header

Change-Id: I13e9bf79df18789f1ed4b83fc47c0c2e080d70a8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894240
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-13 18:41:29 +00:00
Anton Romanov
bed40ad547 crosvm: migrate to Rust 2021 edition
BUG=none
TEST=cq

Change-Id: I0059c970879b78bfd40b6ce58b10debcf154b50f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508322
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-03-09 01:16:03 +00:00
Vikram Auradkar
ae5118f5c7 Enable windows tests for a few crates
Run tests for sys_util_core, poll_token_derive and balloon_control on
windows.

Using dotfiles to disable/serialize test runs of a subset of crates does
not work well with third party crates as it forces us to commit the dot
file to the crate.

The patch modifies and uses the script that runs linux tests.
This patch also allows us to
- build/test child crate even if parent crate has disabled build/test.
- avoid building crosvm if it is not explicitly specified.

RIP short lived .windows_build_test_skip. You allowed us to run noop
kokoro tests.

Test: py .\tools\impl\test_runner.py --arch x86_64
Bug: b:215610772
Change-Id: Icc6d04ffd7c0c33d4f60aeac16fc7d23881c387d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3459809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-18 03:18:58 +00:00
Vikram Auradkar
0108238474 Upstream windows build/test script
The patch also adds files to skip building and testing crates on
windows. When we run
```
tools/windows/build_test.py --skip_file_name .windows_build_test_skip
```

the build/test succeeds without actually doing anything as build/test
for all crates is skipped by creating '.windows_build_test_skip'.

Bug: 213170957
Test: Ran script on downstream repo
Change-Id: Iebd2cea463ee722be4feaed88229e1fb5e9fd6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3417918
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-01-28 00:55:08 +00:00
Dennis Kempin
6b06f405ff docs: Use mdformat to format markdown files
The tool is added to ./tools/fmt which will be called during
./tools/presubmit as well as by Kokoro during testing.

This requires a new dev container version to bundle the mdformat
tool in the container.

Note: mdformat does not have any IDE integrations, but the prettier
plugin with prose-wrap enabled and a line length of 100 provides
almost identical results.

BUG=None
TEST=./tools/fmt --check

Change-Id: I0ae5659eff8555df7c85c70e62095a1e116b98da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3416098
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-01-27 21:29:11 +00:00
Dennis Kempin
50a58f9372 Integrate audio_streams into crosvm, add stub libcras implementation
The `# ignored by ebuild` tag will remove the path to libcras_stub and
allows crosvm to be built with the actual libcras implementation.

This allows all other platforms to build without depending on
`third_party/adhd/cras/client/libcras`, which is a prerequisite for
externalizing crosvm.

An empty libcras_stub crate is provided to keep cargo happy in external
builds.

To build with cargo against libcras, the setup_cros_cargo.sh script
can be used.

BUG=b:191511078
TEST=Tests in crosvm and cros_sdk both pass:
  $ ./test_all
  $ cros_run_unit_tests --package=crosvm

Cq-Depend: chromium:2993483
Change-Id: I86aad23a86c78e580c1724fb311f870b25d6b09e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2988154
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
2021-07-29 05:59:42 +00:00