Merge pull request #5395 from wllenyj/dragonball-s390

ci: skip s390x for dragonball.
This commit is contained in:
Bin Liu 2022-10-13 09:03:08 +08:00 committed by GitHub
commit 3b70c72436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 14 deletions

View File

@ -116,5 +116,4 @@ jobs:
cd src/dragonball cd src/dragonball
/root/.cargo/bin/cargo version /root/.cargo/bin/cargo version
rustc --version rustc --version
# TODO: Using the cargo command directly will get `sudo: cargo: command not found` error. sudo -E env PATH=$PATH LIBC=gnu SUPPORT_VIRTUALIZATION=true make test
sudo -E /root/.cargo/bin/cargo test --all-features -- --nocapture

View File

@ -2,10 +2,19 @@
# Copyright (c) 2019-2022 Ant Group. All rights reserved. # Copyright (c) 2019-2022 Ant Group. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
include ../../utils.mk
ifeq ($(ARCH), s390x)
default build check test clippy:
@echo "s390x not support currently"
exit 0
else
default: build default: build
build: build:
cargo build --all-features @echo "INFO: cargo build..."
cargo build --all-features --target $(TRIPLE)
check: clippy format check: clippy format
@ -26,4 +35,13 @@ clean:
cargo clean cargo clean
test: test:
@echo "INFO: skip testing dragonball" ifdef SUPPORT_VIRTUALIZATION
cargo test --all-features --target $(TRIPLE) -- --nocapture
else
@echo "INFO: skip testing dragonball, it need virtualization support."
exit 0
endif
endif # ifeq ($(ARCH), s390x)
.DEFAULT_GOAL := default

View File

@ -795,13 +795,14 @@ impl DeviceManager {
fn allocate_mmio_device_resource( fn allocate_mmio_device_resource(
&self, &self,
) -> std::result::Result<DeviceResources, StartMicroVmError> { ) -> std::result::Result<DeviceResources, StartMicroVmError> {
let mut requests = Vec::new(); let requests = vec![
requests.push(ResourceConstraint::MmioAddress { ResourceConstraint::MmioAddress {
range: None, range: None,
align: MMIO_DEFAULT_CFG_SIZE, align: MMIO_DEFAULT_CFG_SIZE,
size: MMIO_DEFAULT_CFG_SIZE, size: MMIO_DEFAULT_CFG_SIZE,
}); },
requests.push(ResourceConstraint::LegacyIrq { irq: None }); ResourceConstraint::LegacyIrq { irq: None },
];
self.res_manager self.res_manager
.allocate_device_resources(&requests, false) .allocate_device_resources(&requests, false)

View File

@ -39,6 +39,7 @@ impl Vcpu {
/// vcpu thread to vmm thread. /// vcpu thread to vmm thread.
/// * `create_ts` - A timestamp used by the vcpu to calculate its lifetime. /// * `create_ts` - A timestamp used by the vcpu to calculate its lifetime.
/// * `support_immediate_exit` - whether kvm uses supports immediate_exit flag. /// * `support_immediate_exit` - whether kvm uses supports immediate_exit flag.
#[allow(clippy::too_many_arguments)]
pub fn new_aarch64( pub fn new_aarch64(
id: u8, id: u8,
vcpu_fd: Arc<VcpuFd>, vcpu_fd: Arc<VcpuFd>,

View File

@ -851,7 +851,7 @@ pub mod tests {
let kvm = Kvm::new().unwrap(); let kvm = Kvm::new().unwrap();
let vm = Arc::new(kvm.create_vm().unwrap()); let vm = Arc::new(kvm.create_vm().unwrap());
let kvm_context = KvmContext::new(Some(kvm.as_raw_fd())).unwrap(); let _kvm_context = KvmContext::new(Some(kvm.as_raw_fd())).unwrap();
let vcpu_fd = Arc::new(vm.create_vcpu(0).unwrap()); let vcpu_fd = Arc::new(vm.create_vcpu(0).unwrap());
let io_manager = IoManagerCached::new(Arc::new(ArcSwap::new(Arc::new(IoManager::new())))); let io_manager = IoManagerCached::new(Arc::new(ArcSwap::new(Arc::new(IoManager::new()))));
let reset_event_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap(); let reset_event_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap();

View File

@ -774,7 +774,7 @@ impl VcpuManager {
self.reset_event_fd.as_ref().unwrap().try_clone().unwrap(), self.reset_event_fd.as_ref().unwrap().try_clone().unwrap(),
self.vcpu_state_event.try_clone().unwrap(), self.vcpu_state_event.try_clone().unwrap(),
self.vcpu_state_sender.clone(), self.vcpu_state_sender.clone(),
request_ts.clone(), request_ts,
self.support_immediate_exit, self.support_immediate_exit,
) )
.map_err(VcpuManagerError::Vcpu) .map_err(VcpuManagerError::Vcpu)

View File

@ -35,6 +35,7 @@ use crate::event_manager::EventManager;
/// * `device_info` - A hashmap containing the attached devices for building FDT device nodes. /// * `device_info` - A hashmap containing the attached devices for building FDT device nodes.
/// * `gic_device` - The GIC device. /// * `gic_device` - The GIC device.
/// * `initrd` - Information about an optional initrd. /// * `initrd` - Information about an optional initrd.
#[allow(clippy::borrowed_box)]
fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>( fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>(
guest_mem: &M, guest_mem: &M,
cmdline: &str, cmdline: &str,
@ -58,8 +59,9 @@ fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>(
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
impl Vm { impl Vm {
/// Gets a reference to the irqchip of the VM /// Gets a reference to the irqchip of the VM
#[allow(clippy::borrowed_box)]
pub fn get_irqchip(&self) -> &Box<dyn GICDevice> { pub fn get_irqchip(&self) -> &Box<dyn GICDevice> {
&self.irqchip_handle.as_ref().unwrap() self.irqchip_handle.as_ref().unwrap()
} }
/// Creates the irq chip in-kernel device model. /// Creates the irq chip in-kernel device model.

View File

@ -173,6 +173,7 @@ TRIPLE = $(ARCH)-unknown-linux-$(LIBC)
CWD := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) CWD := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
standard_rust_check: standard_rust_check:
@echo "standard rust check..."
cargo fmt -- --check cargo fmt -- --check
cargo clippy --all-targets --all-features --release \ cargo clippy --all-targets --all-features --release \
-- \ -- \