Update Rust toolchain to 1.88

- Change qemu binary names; Remove '-static' postfixes
- Fix clippy errors with using new APIs introduced after 1.81
  - unnecessary_map_or
  - manual_repeat_n
- Fix clippy::needless-as-bytes
- Update cargo-nextest in dev_container and testvm
   - To avoid missing libstd error due to
     https://github.com/rust-lang/rust/pull/131188
   - To fix an error on parsing cargo-metadata.json
- For mingw, specify libslirp and glib's paths when building
  net_util
- Install binutils in testvm

BUG=b:455879436
TEST=CQ

Change-Id: I3add61aac9573f20aa7d1aee2b9cf6cf9dd43493
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/7089911
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2025-10-28 09:47:55 -05:00 committed by crosvm LUCI
parent faa3a06b07
commit ffdfff586f
12 changed files with 28 additions and 22 deletions

View file

@ -1,10 +1,10 @@
# Configure path to linker and emulators to use when running unit tests
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
runner = "qemu-aarch64-static"
runner = "qemu-aarch64"
[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"
runner = "qemu-riscv64-static"
runner = "qemu-riscv64"
[target.x86_64-pc-windows-gnu]
runner = "wine64"

View file

@ -7,7 +7,6 @@
use std::collections::HashSet;
use std::fs;
use std::iter::repeat;
use std::path::PathBuf;
#[cfg(windows)]
@ -273,7 +272,10 @@ impl FwCfgDevice {
raw_file_dir.extend_from_slice(&[0, 0]);
raw_file_dir.extend_from_slice(file.name.as_bytes());
// Padding for c-style char[]
raw_file_dir.extend(repeat(0).take(FW_CFG_FILENAME_SIZE - file.name.len()));
raw_file_dir.extend(std::iter::repeat_n(
0,
FW_CFG_FILENAME_SIZE - file.name.len(),
));
}
self.add_bytes(raw_file_dir, FwCfgItemType::FileDir);

View file

@ -699,7 +699,7 @@ pub fn create_virtio_media_v4l2_proxy_device<P: AsRef<Path>>(
card: Default::default(),
};
let card = &device.caps().card;
let name_slice = &card.as_bytes()[0..std::cmp::min(card.as_bytes().len(), config.card.len())];
let name_slice = &card.as_bytes()[0..std::cmp::min(card.len(), config.card.len())];
config.card.as_mut_slice()[0..name_slice.len()].copy_from_slice(name_slice);
let device_path = PathBuf::from(device_path.as_ref());

View file

@ -25,6 +25,12 @@ fn main() {
libs.push(GLIB_FILENAME);
}
prebuilts::download_prebuilts("libslirp", version, &libs).unwrap();
for path in prebuilts::download_prebuilts("libslirp", version, &libs).unwrap() {
println!(
"cargo::rustc-link-search={}",
path.parent().unwrap().display()
);
}
}
// For unix, libslirp-sys's build script will make the appropriate linking calls to pkg_config.

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.81.0"
channel = "1.88.0"
components = [ "rustfmt", "clippy", "llvm-tools-preview" ]

View file

@ -49,7 +49,7 @@ cargo binstall --no-confirm mdbook --version "0.4.25"
cargo binstall --no-confirm mdbook-linkcheck --version "0.7.7"
# Nextest is an improved test runner for cargo
cargo binstall --no-confirm cargo-nextest --version "0.9.49"
cargo binstall --no-confirm cargo-nextest --version "0.9.96"
Red='\033[0;31m'
Reset='\033[0m'

View file

@ -1 +1 @@
r0054
r0055

View file

@ -23,6 +23,7 @@ preserve_hostname: true
# Runtime dependencies of crosvm binaries.
# Note: Keep in sync with ./install-[aarch64-]deps.sh
packages:
- binutils
- e2fsprogs
- gcc
- libavcodec61
@ -51,11 +52,11 @@ runcmd:
# Install cargo-nextest using prebuilt binaries and validate checksum.
{% if v1.machine == 'aarch64' %}
- curl -LsSf https://get.nexte.st/0.9.43/linux-arm | tar zxf - -C /usr/bin
- echo "59374b208807b5002f96c815a04f6bcc80d16707c2e8046471bb41043324363e /usr/bin/cargo-nextest" | sha256sum -c -
- curl -LsSf https://get.nexte.st/0.9.96/linux-arm | tar zxf - -C /usr/bin
- echo "dcf773f27abaa13d8aba20c0e448c3ab6e09785ca26e1c8ce7ebdb224d10f79d /usr/bin/cargo-nextest" | sha256sum -c -
{% else %}
- curl -LsSf https://get.nexte.st/0.9.43/linux | tar zxf - -C /usr/bin
- echo "0b100bd45bbae6e7a4fa05f8f2cee0ca231997875ec43f984cd5ffaa2e6e9a98 /usr/bin/cargo-nextest" | sha256sum -c -
- curl -LsSf https://get.nexte.st/0.9.96/linux | tar zxf - -C /usr/bin
- echo "4d9d511e911b41dd71e87367bc5edb209199a46795fb1a8706be25803411cf39 /usr/bin/cargo-nextest" | sha256sum -c -
{% endif %}
# Enable core dumps for debugging crashes

View file

@ -1 +1 @@
r0016
r0017

View file

@ -9,7 +9,7 @@ param (
[Parameter(
Position = 0
)]
[string]$BASE_DIR = $Env:TEMP ##
[string]$BASE_DIR = $Env:TEMP ##
)
$BASE_DIR = $BASE_DIR + "\"
@ -73,5 +73,6 @@ $BINSTALL_DEST=((Get-Command cargo) | Get-Item).DirectoryName
Expand-Archive -Path $BINSTALL_ZIP -DestinationPath $BINSTALL_DEST
# Nextest is an improved test runner for cargo
cargo binstall --no-confirm cargo-nextest --version "0.9.49"
cargo binstall --no-confirm cargo-nextest --version "0.9.96"

View file

@ -347,7 +347,7 @@ impl GuestMemory {
if last
.guest_base
.checked_add(last.mapping.size() as u64)
.map_or(true, |a| a > range.0)
.is_none_or(|a| a > range.0)
{
return Err(Error::MemoryRegionOverlap);
}
@ -866,11 +866,7 @@ impl GuestMemory {
// Assume no overlap among regions
let (mapping, offset, _) = self.find_region(guest_addr)?;
if mapping
.size()
.checked_sub(offset)
.map_or(true, |v| v < size)
{
if mapping.size().checked_sub(offset).is_none_or(|v| v < size) {
return Err(Error::InvalidGuestAddress(guest_addr));
}

View file

@ -58,7 +58,7 @@ fn memory_offset(mem: &GuestMemory, guest_addr: GuestAddress, len: u64) -> Udmab
let map_offset = map_offset as u64;
if map_offset
.checked_add(len)
.map_or(true, |a| a > mapping.size() as u64)
.is_none_or(|a| a > mapping.size() as u64)
{
return Err(UdmabufError::InvalidOffset(
GuestMemoryError::InvalidGuestAddress(guest_addr),