crosvm: Uprev rust toolchain and dev container

- Rust toolchain is updated to 1.65.0
- Catapult dashboard upload tool is added to dev_container
- Bindgen is updated to latest version to support custom derive
- Derive Eq when PartialEq is derived as required by new Clippy

TEST=CQ, bindgen-all-the-things

FIXED=b:260784028
BUG=b:257303497

Change-Id: I2034cd09e0aed84d4e9b30f2e85d84d94a442ea4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4228427
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
This commit is contained in:
Zihan Chen 2023-02-07 13:00:31 -08:00 committed by crosvm LUCI
parent 7c9d6e00ce
commit 28ce4e5423
32 changed files with 65 additions and 56 deletions

View file

@ -9,7 +9,7 @@ use crate::EventToken;
/// Represents descriptor-token pairs which represent an event which can be triggered in the
/// EventContext
#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
pub struct EventTrigger<T: EventToken> {
pub(crate) token: T,
pub(crate) event: RawDescriptor,

View file

@ -187,7 +187,7 @@ pub trait ReadOverlapped {
fn try_read_result(&mut self, overlapped_wrapper: &mut OverlappedWrapper) -> io::Result<usize>;
}
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Eq)]
pub enum FramingMode {
Byte,
Message,
@ -209,7 +209,7 @@ impl FramingMode {
}
}
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Debug)]
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Debug, Eq)]
pub enum BlockingMode {
/// Calls to read() block until data is received
Wait,

View file

@ -5,7 +5,7 @@
use bit_field::*;
#[bitfield]
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
enum TwoBits {
Zero = 0b00,
One = 0b01,
@ -15,7 +15,7 @@ enum TwoBits {
#[bitfield]
#[bits = 3]
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
enum ThreeBits {
Zero = 0b00,
One = 0b01,

View file

@ -22,7 +22,7 @@ pub enum CrashReportReason {
Unknown,
}
#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)]
#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq, Eq)]
enum CrashTubeCommand {
UploadCrashReport(CrashReportReason),
}

View file

@ -49,7 +49,7 @@ impl WaitForHandleInner {
}
/// Future's state.
#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq, Eq)]
enum WaitState {
New,
Sleeping,

View file

@ -193,7 +193,7 @@ macro_rules! ensure_exit_code {
}
#[allow(clippy::enum_clike_unportable_variant)]
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Exit {
// Windows process exit codes triggered by the kernel tend to be NTSTATUS, so we treat
// our error codes as NTSTATUS to avoid clashing. This means we set the vendor bit. We also

View file

@ -884,7 +884,7 @@ impl Reg {
/// interrupt vector. The flags are spread across the first 32 bits of each of eight 16-byte APIC
/// register slots.
#[repr(usize)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum VectorReg {
/// In-service register. A bit is set for each interrupt vector currently being serviced by the
/// processor.

View file

@ -210,7 +210,7 @@ struct CoIommuReg {
dtt_level: u64,
}
#[derive(Default, Debug, Copy, Clone, PartialEq)]
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)]
struct PinnedPageInfo {
gfn: u64,
unpin_busy_cnt: u64,
@ -225,7 +225,7 @@ impl PinnedPageInfo {
}
}
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Debug, Eq)]
enum UnpinThreadState {
Unparked,
Parked,
@ -432,7 +432,7 @@ fn pin_page(
Ok(())
}
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Debug, Eq)]
enum UnpinResult {
UnpinlistEmpty,
Unpinned,

View file

@ -36,7 +36,7 @@ pub enum Error {
type Result<T> = std::result::Result<T, Error>;
#[derive(PartialEq, Copy, Clone)]
#[derive(PartialEq, Copy, Clone, Eq)]
enum RingBufferState {
/// Running: RingBuffer is running, consuming transfer descriptor.
Running,

View file

@ -146,7 +146,7 @@ enum IommuType {
// Hint as to whether IOMMU mappings will tend to be large and static or
// small and dynamic.
#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
enum IommuMappingHint {
Static,
Dynamic,

View file

@ -111,7 +111,7 @@ mod tests {
#[test]
fn context_mask_serialize_deserialize() {
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
struct ContextMask {
#[serde(rename = "context-types", with = "serde_context_mask")]
pub value: u64,

View file

@ -256,7 +256,7 @@ impl VirtioDevice for Tpm {
impl Suspendable for Tpm {}
#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
enum NeedsInterrupt {
Yes,
No,

View file

@ -295,7 +295,7 @@ struct Worker {
pending_unmap: Option<u64 /* shmem_offset */>,
}
#[derive(EventToken, Debug, Clone, PartialEq)]
#[derive(EventToken, Debug, Clone, PartialEq, Eq)]
enum Token {
// Data is available on the Vhost-user sibling socket.
SiblingSocket,

View file

@ -649,7 +649,7 @@ impl Worker {
// by allocating the buffer and overlapped struct
// on the heap.
unsafe {
match pipe_connection.read_overlapped(&mut buffer[..], &mut *overlapped_wrapper)
match pipe_connection.read_overlapped(&mut buffer[..], &mut overlapped_wrapper)
{
Ok(()) => {}
Err(e) => {

View file

@ -151,14 +151,14 @@ impl TestVmSys {
let earlycon_path = Path::new(logs_dir).join(GUEST_EARLYCON);
let earlycon_str = earlycon_path.to_str().unwrap();
command.args(&[
command.args([
r"--serial",
&format!("hardware=serial,num=1,type=file,path={earlycon_str},earlycon=true"),
]);
let console_path = Path::new(logs_dir).join(GUEST_CONSOLE);
let console_str = console_path.to_str().unwrap();
command.args(&[
command.args([
r"--serial",
&format!("hardware=virtio-console,num=1,type=file,path={console_str},console=true"),
]);
@ -168,14 +168,14 @@ impl TestVmSys {
"hardware=serial,type=namedpipe,path={},num=2",
from_guest_pipe.display(),
);
command.args(&["--serial", &serial_params]);
command.args(["--serial", &serial_params]);
}
/// Configures the VM rootfs to load from the guest_under_test assets.
fn configure_rootfs(command: &mut Command, _o_direct: bool) {
let rootfs_and_option =
format!("{},ro,root,sparse=false", rootfs_path().to_str().unwrap(),);
command.args(&["--root", &rootfs_and_option]).args(&[
command.args(["--root", &rootfs_and_option]).args([
"--params",
"init=/bin/delegate noxsaves noxsave nopat nopti tsc=reliable",
]);
@ -194,7 +194,7 @@ impl TestVmSys {
let from_guest_pipe = Path::new(&from_guest_path);
let mut command = Command::new(find_crosvm_binary());
command.args(&["--log-level", "INFO", "run-mp"]);
command.args(["--log-level", "INFO", "run-mp"]);
f(
&mut command,
@ -207,7 +207,7 @@ impl TestVmSys {
let hypervisor_log_path = Path::new(logs_dir).join(HYPERVISOR_LOG);
let hypervisor_log_str = hypervisor_log_path.to_str().unwrap();
command.args(&[
command.args([
"--logs-directory",
logs_dir,
"--kernel-log-file",

View file

@ -117,7 +117,7 @@ impl From<MSG> for MessagePacket {
/// (2) NotInLoop -> WillResizeOrMove -> IsMoving -> NotInLoop. This is for moving modal loops.
/// (3) NotInLoop -> WillResizeOrMove -> NotInLoop. This may occur if the user long presses the
/// window title bar, window borders or corners, but doesn't actually resize or move the window.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum SizeMoveLoopState {
/// The window is not in the moving or sizing modal loop.
NotInLoop,

View file

@ -381,7 +381,7 @@ impl VcpuX86_64 for HaxmVcpu {
// Safe because we know we mapped enough memory to hold the hax_tunnel struct because the
// kernel told us how large it was.
unsafe {
(*self.tunnel).request_interrupt_window = if requested { 1 } else { 0 };
(*self.tunnel).request_interrupt_window = i32::from(requested);
}
}

View file

@ -82,7 +82,7 @@ impl Default for NegotiationStatus {
}
}
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Segmentation {
/// Loop filter level
pub lvl_lookup: [[u8; MAX_MODE_LF_DELTAS]; MAX_REF_FRAMES],

View file

@ -47,7 +47,7 @@ pub enum SlirpError {
#[cfg(windows)]
impl SlirpError {
pub fn sys_error(&self) -> SysError {
match &*self {
match self {
SlirpError::BrokenPipe(e) => SysError::new(e.raw_os_error().unwrap_or_default()),
SlirpError::CloneFailed(e) => SysError::new(e.raw_os_error().unwrap_or_default()),
SlirpError::OverlappedError(e) => SysError::new(e.raw_os_error().unwrap_or_default()),

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.62.1"
channel = "1.65.0"
components = [ "rustfmt", "clippy" ]

View file

@ -85,7 +85,6 @@ def download_virgl(src, dst, branch):
if subprocess.Popen(args).wait() == 0:
return True
else:
return False

View file

@ -515,7 +515,7 @@ fn run_internal(mut cfg: Config) -> Result<()> {
let mut metric_tubes = Vec::new();
let metrics_controller = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["run-metrics"],
["run-metrics"],
get_log_path(&cfg, "metrics_stdout.log"),
get_log_path(&cfg, "metrics_stderr.log"),
ProcessType::Metrics,
@ -536,7 +536,7 @@ fn run_internal(mut cfg: Config) -> Result<()> {
let mut main_child = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["run-main"],
["run-main"],
get_log_path(&cfg, "main_stdout.log"),
get_log_path(&cfg, "main_stderr.log"),
ProcessType::Main,
@ -1095,7 +1095,7 @@ fn spawn_block_backend(
vhost_user_device_tube.set_target_pid(main_child.alias_pid);
let block_child = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["device", "block"],
["device", "block"],
get_log_path(cfg, &format!("disk_{}_stdout.log", log_index)),
get_log_path(cfg, &format!("disk_{}_stderr.log", log_index)),
ProcessType::Block,
@ -1347,7 +1347,7 @@ fn spawn_slirp(
) -> Result<ChildProcess> {
let slirp_child = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["run-slirp"],
["run-slirp"],
get_log_path(cfg, "slirp_stdout.log"),
get_log_path(cfg, "slirp_stderr.log"),
ProcessType::Slirp,
@ -1382,7 +1382,7 @@ fn spawn_net_backend(
let net_child = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["device", "net"],
["device", "net"],
get_log_path(cfg, "net_stdout.log"),
get_log_path(cfg, "net_stderr.log"),
ProcessType::Net,
@ -1498,7 +1498,7 @@ fn start_up_gpu(
let gpu_child = spawn_child(
current_exe().unwrap().to_str().unwrap(),
&["device", "gpu"],
["device", "gpu"],
get_log_path(cfg, "gpu_stdout.log"),
get_log_path(cfg, "gpu_stderr.log"),
ProcessType::Gpu,
@ -1728,7 +1728,7 @@ mod tests {
let exit_events = vec![Event::new().unwrap()];
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "2"],
["127.0.0.1", "-n", "2"],
None,
None,
ProcessType::Main,
@ -1756,7 +1756,7 @@ mod tests {
let exit_events = vec![Event::new().unwrap()];
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "4"],
["127.0.0.1", "-n", "4"],
None,
None,
ProcessType::Main,
@ -1769,7 +1769,7 @@ mod tests {
);
let _child_device = spawn_child(
"ping",
&["127.0.0.1", "-n", "2"],
["127.0.0.1", "-n", "2"],
None,
None,
ProcessType::Block,
@ -1796,7 +1796,7 @@ mod tests {
let exit_events = vec![Event::new().unwrap()];
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "2"],
["127.0.0.1", "-n", "2"],
None,
None,
ProcessType::Main,
@ -1809,7 +1809,7 @@ mod tests {
);
let _child_device = spawn_child(
"ping",
&["127.0.0.1", "-n", "11"],
["127.0.0.1", "-n", "11"],
None,
None,
ProcessType::Block,
@ -1841,7 +1841,7 @@ mod tests {
let exit_events = vec![Event::new().unwrap()];
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "11"],
["127.0.0.1", "-n", "11"],
None,
None,
ProcessType::Main,
@ -1854,7 +1854,7 @@ mod tests {
);
let _child_device = spawn_child(
"ping",
&["127.0.0.1", "-n", "2"],
["127.0.0.1", "-n", "2"],
None,
None,
ProcessType::Block,
@ -1886,7 +1886,7 @@ mod tests {
let exit_events = vec![Event::new().unwrap()];
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "2"],
["127.0.0.1", "-n", "2"],
None,
None,
ProcessType::Main,
@ -1899,7 +1899,7 @@ mod tests {
);
let _child_device = spawn_child(
"cmd",
&["/c", "exit -1"],
["/c", "exit -1"],
None,
None,
ProcessType::Block,
@ -1934,7 +1934,7 @@ mod tests {
let mut children: HashMap<u32, ChildCleanup> = HashMap::new();
let _child_main = spawn_child(
"ping",
&["127.0.0.1", "-n", "3"],
["127.0.0.1", "-n", "3"],
None,
None,
ProcessType::Main,

View file

@ -43,7 +43,7 @@ pub fn validate_config(_cfg: &mut Config) -> std::result::Result<(), String> {
Ok(())
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum IrqChipKind {
/// All interrupt controllers are emulated in the kernel.
Kernel,
@ -67,7 +67,7 @@ impl FromStr for IrqChipKind {
}
/// Hypervisor backend.
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq)]
pub enum HypervisorKind {
#[cfg(feature = "gvm")]
Gvm,

View file

@ -85,7 +85,7 @@ use crate::sys::init_log;
static ALLOCATOR: scudo::GlobalScudoAllocator = scudo::GlobalScudoAllocator;
#[repr(i32)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
/// Exit code from crosvm,
enum CommandStatus {
/// Exit with success. Also used to mean VM stopped successfully.

View file

@ -73,7 +73,7 @@ impl BufferConsumptionRecord {
}
}
#[derive(Debug, Serialize, PartialEq)]
#[derive(Debug, Serialize, PartialEq, Eq)]
pub struct EstimatedRate {
/// linear coefficients of LINEST(frames,timestamps).
rate: f64,

View file

@ -7,7 +7,7 @@ use audio_streams::StreamSourceGenerator;
use crate::args::*;
use crate::error::Error;
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StreamSource {}
#[derive(Copy, Clone, Debug, FromArgs, Serialize)]

View file

@ -41,7 +41,7 @@ def replace_in_file(file_path: Path, search: SearchPattern, replace: Replacement
def replace_in_files(glob: str, replacements: List[Tuple[SearchPattern, Replacement]]):
for file in Path().glob(glob):
for (search, replace) in replacements:
for search, replace in replacements:
replace_in_file(file, search, replace)

View file

@ -9,6 +9,13 @@
#
# Note, if you are using docker, you will probably be using "Dockerfile.user".
# Build catapult dashboard upload tool in a builder container
FROM docker.io/golang:bullseye AS gobuilder
WORKDIR /root/
RUN git clone https://fuchsia.googlesource.com/infra/infra
WORKDIR /root/infra/cmd/catapult
RUN go build
FROM docker.io/debian:testing-slim
ENV RUSTUP_HOME=/usr/local/rustup \
@ -65,6 +72,9 @@ RUN /tools/setup-wine64
# Install global config.toml for cross-compilation
COPY --chmod=555 .cargo/config.debian.toml /.cargo/config.toml
# Install catapult dashboard upload tool
COPY --from=gobuilder /root/infra/cmd/catapult/catapult /tools/
# Prebuild aarch64 VM image for faster startup.
COPY tools/aarch64vm /tools/
COPY /tools/impl/testvm.py /tools/impl/

View file

@ -1 +1 @@
r0033
r0034

View file

@ -81,7 +81,7 @@ rustup target add x86_64-pc-windows-gnu
curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v0.19.3/cargo-binstall-x86_64-unknown-linux-gnu.tgz | tar -xzvvf - -C ${CARGO_HOME:-~/.cargo}/bin
# The bindgen tool is required to build a crosvm dependency.
cargo binstall --no-confirm bindgen --version "0.60.1"
cargo install bindgen-cli --version "0.64.0"
# binutils are wrappers to call the rustup bundled versions of llvm tools.
cargo binstall --no-confirm cargo-binutils

View file

@ -51,7 +51,7 @@ pub enum TubeTransportError {
}
/// The target child process will use this decide what a Tube's purpose is.
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum TubeToken {
Bootstrap,
Control,

View file

@ -270,7 +270,7 @@ pub unsafe fn create_file_mapping(
}
}
#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
pub enum ThreadState {
// The specified thread was not suspended.
NotSuspended,