Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions components/patina_acpi/src/acpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,6 @@ where

#[cfg(test)]
mod tests {
extern crate std;

use crate::signature::MAX_INITIAL_ENTRIES;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion components/patina_acpi/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ pub(crate) trait AcpiProvider {
#[cfg(test)]
#[cfg_attr(coverage, coverage(off))]
mod tests {
use alloc::boxed::Box;
use core::mem;
use patina::component::service::memory::StdMemoryManager;
use std::boxed::Box;

use crate::acpi_table::AcpiFadt;

Expand Down
2 changes: 1 addition & 1 deletion components/patina_adv_logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![deny(missing_docs)]
#![cfg_attr(coverage, feature(coverage_attribute))]

#[cfg(any(feature = "alloc", test, doc))]
#[cfg(any(feature = "alloc", doc))]
extern crate alloc;

mod memory_log;
Expand Down
2 changes: 1 addition & 1 deletion components/patina_adv_logger/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ where
mod tests {
use core::{ffi::c_void, ptr};

use alloc::boxed::Box;
use log::Log;
use patina::standard::efi;
use patina::{
Expand All @@ -360,6 +359,7 @@ mod tests {
peripheral::serial::uart::UartNull,
pi::hob::{GUID_EXTENSION, GuidHob, HobHeader},
};
use std::boxed::Box;

use crate::{
logger::{AdvancedLogger, TargetFilter},
Expand Down
8 changes: 4 additions & 4 deletions components/patina_adv_logger/src/memory_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ impl AdvLoggerMessageEntry {
const TEST_DATA_SIZE: usize = 128;

#[cfg(test)]
pub(crate) fn create_buffer_v5(timer_frequency: u64, hw_port_disabled: bool) -> alloc::boxed::Box<[u8]> {
pub(crate) fn create_buffer_v5(timer_frequency: u64, hw_port_disabled: bool) -> std::boxed::Box<[u8]> {
let header_size = size_of::<AdvLoggerInfoV5>();
let mut buffer = alloc::vec![0_u8; header_size + TEST_DATA_SIZE].into_boxed_slice();
let mut buffer = std::vec![0_u8; header_size + TEST_DATA_SIZE].into_boxed_slice();
let header = AdvLoggerInfoV5 {
signature: AdvLoggerInfo::SIGNATURE,
version: ADV_LOGGER_INFO_VERSION_V5,
Expand Down Expand Up @@ -457,9 +457,9 @@ pub(crate) fn create_buffer_v5(timer_frequency: u64, hw_port_disabled: bool) ->
}

#[cfg(test)]
pub(crate) fn create_buffer_v6(timer_frequency: u64, new_address: u64) -> alloc::boxed::Box<[u8]> {
pub(crate) fn create_buffer_v6(timer_frequency: u64, new_address: u64) -> std::boxed::Box<[u8]> {
let header_size = size_of::<AdvLoggerInfoV6>();
let mut buffer = alloc::vec![0_u8; header_size + TEST_DATA_SIZE].into_boxed_slice();
let mut buffer = std::vec![0_u8; header_size + TEST_DATA_SIZE].into_boxed_slice();
let header = AdvLoggerInfoV6 {
v5: AdvLoggerInfoV5 {
signature: AdvLoggerInfo::SIGNATURE,
Expand Down
1 change: 0 additions & 1 deletion components/patina_adv_logger/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ impl<'a> Iterator for AdvLogIterator<'a> {
#[cfg(test)]
#[cfg_attr(coverage, coverage(off))]
mod tests {
extern crate std;
use core::{mem::size_of, sync::atomic::Ordering};

use super::*;
Expand Down
3 changes: 1 addition & 2 deletions components/patina_adv_logger/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ impl AdvancedLogWriter {
#[cfg(all(test, feature = "reader"))]
#[cfg_attr(coverage, coverage(off))]
mod tests {
extern crate std;
use alloc::boxed::Box;
use core::{mem::size_of, sync::atomic::Ordering};
use efi::PhysicalAddress;
use std::boxed::Box;

use super::*;
use crate::{memory_log::*, reader::AdvancedLogReader};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ mod tests {
};
use patina::uefi::boot_services::StandardBootServices;

use alloc::boxed::Box;
use std::boxed::Box;

/// Helper to create a test protocol notify context without boot services
fn create_test_context(updatable_buffer_id: u8) -> Box<ProtocolNotifyContext> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
//! SPDX-License-Identifier: Apache-2.0
use crate::patina_mm_integration::common::{constants::*, handlers::*, message_parser::*};

extern crate alloc;
use alloc::{boxed::Box, string::String, vec::Vec};
use patina::BinaryGuid;
use std::{boxed::Box, string::String, vec::Vec};
use std::{
collections::HashMap,
sync::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
use crate::patina_mm_integration::common::constants::*;
use patina::standard::efi;

extern crate alloc;
use alloc::{string::String, vec::Vec};
use std::{string::String, vec::Vec};
pub use zerocopy::IntoBytes;

pub use patina::management_mode::protocol::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
//!
//! SPDX-License-Identifier: Apache-2.0

extern crate alloc;
#[allow(unused_imports)] // Used in test module within this file
use alloc::vec::Vec;
use patina::BinaryGuid;

/// Error types for MM message parsing operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

use crate::patina_mm_integration::common::{constants::*, handlers::*};

extern crate alloc;
use alloc::{boxed::Box, vec::Vec};
use patina::Guid;
use std::{
boxed::Box,
collections::BTreeMap,
sync::{Arc, Mutex},
vec::Vec,
};

// Import the real patina_mm components and services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
//!
//! SPDX-License-Identifier: Apache-2.0

extern crate alloc;

// Common utilities available to all test modules
mod common;

Expand Down
4 changes: 2 additions & 2 deletions components/patina_performance/src/component/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ mod tests {
};
use patina::standard::efi;

use alloc::sync::Arc;
use patina::{
c_ptr::{CMutPtr, CPtr},
component::service::{IntoService, Service},
Expand All @@ -537,6 +536,7 @@ mod tests {
uefi::{boot_services::MockBootServices, runtime_services::MockRuntimeServices},
};
use patina_mm::component::communicator::{MmCommunication, Status};
use std::sync::Arc;

// Some constants shared between tests
const TEST_EVENT_HANDLE: efi::Event = 1_usize as efi::Event;
Expand Down Expand Up @@ -760,7 +760,7 @@ mod tests {
boot_services.expect_close_event().once().return_const(Ok(()));

// The component allocates the publishing buffer itself; hand back a real leaked page-sized buffer.
let leaked_buffer = Box::leak(alloc::vec![0u8; UEFI_PAGE_SIZE].into_boxed_slice());
let leaked_buffer = Box::leak(std::vec![0u8; UEFI_PAGE_SIZE].into_boxed_slice());
let leaked_buffer_addr = leaked_buffer.as_mut_ptr() as usize;
boot_services.expect_allocate_pages().once().returning(move |_, _, _| Ok(leaked_buffer_addr));

Expand Down
4 changes: 3 additions & 1 deletion components/patina_samples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
//!
//! SPDX-License-Identifier: Apache-2.0
//!
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
#![deny(missing_docs)]
#![cfg_attr(coverage, feature(coverage_attribute))]
#![cfg_attr(coverage, coverage(off))] // Disable all coverage instrumentation for sample code
extern crate alloc;

pub mod component;
pub mod smbios_platform;
2 changes: 0 additions & 2 deletions components/patina_samples/src/smbios_platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
//!
//! SPDX-License-Identifier: Apache-2.0

extern crate alloc;

use alloc::{string::String, vec};
use patina::{
component::{component, service::Service},
Expand Down
2 changes: 0 additions & 2 deletions components/patina_smbios/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//!
//! SPDX-License-Identifier: Apache-2.0

extern crate alloc;
use crate::{
error::SmbiosError,
manager::SmbiosManager,
Expand Down Expand Up @@ -143,7 +142,6 @@ impl SmbiosProvider {
#[cfg(test)]
mod tests {
use super::*;
extern crate std;

#[test]
fn test_smbios_provider_new() {
Expand Down
1 change: 0 additions & 1 deletion components/patina_smbios/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ mod tests {

#[test]
fn test_smbios_error_all_variants() {
extern crate std;
use std::vec;

// Test all error variants for completeness
Expand Down
2 changes: 2 additions & 0 deletions components/patina_smbios/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@
#![deny(missing_docs)]
#![cfg_attr(coverage, feature(coverage_attribute))]

extern crate alloc;

// SMBIOS tables require little-endian byte order. The SmbiosRecord derive macro
// uses zerocopy::IntoBytes::as_bytes() which returns native byte order.
#[cfg(not(target_endian = "little"))]
Expand Down
2 changes: 0 additions & 2 deletions components/patina_smbios/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//! SPDX-License-Identifier: Apache-2.0
//!

extern crate alloc;

use patina::protocol::ProtocolInterface;

mod core;
Expand Down
27 changes: 2 additions & 25 deletions components/patina_smbios/src/manager/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//! SPDX-License-Identifier: Apache-2.0
//!

extern crate alloc;

use alloc::{boxed::Box, collections::BTreeSet, string::String, vec::Vec};
use core::cell::RefCell;
use patina::standard::efi::{Handle, PhysicalAddress};
Expand Down Expand Up @@ -755,14 +753,13 @@ impl SmbiosManager {
#[cfg(test)]
mod tests {
use super::*;
extern crate std;
use std::{vec, vec::Vec};

use crate::{
error::SmbiosError,
service::{SMBIOS_HANDLE_PI_RESERVED, SMBIOS_STRING_MAX_LENGTH, SmbiosHandle, SmbiosTableHeader},
};
use patina::component::service::memory::StdMemoryManager;
use patina::standard::efi;
use std::{boxed::Box, vec, vec::Vec};
use zerocopy::IntoBytes;

/// Test helper: Build a simple SMBIOS record with the given header and strings
Expand Down Expand Up @@ -1771,10 +1768,6 @@ mod tests {

#[test]
fn test_allocate_buffers() {
use patina::component::service::memory::StdMemoryManager;
extern crate std;
use std::boxed::Box;

let manager = SmbiosManager::new(3, 9).expect("failed to create manager");
let memory_manager: &'static dyn patina::component::service::memory::MemoryManager =
Box::leak(Box::new(StdMemoryManager::new()));
Expand All @@ -1798,10 +1791,6 @@ mod tests {

#[test]
fn test_allocate_buffers_idempotent() {
use patina::component::service::memory::StdMemoryManager;
extern crate std;
use std::boxed::Box;

let manager = SmbiosManager::new(3, 9).expect("failed to create manager");
let memory_manager: &'static dyn patina::component::service::memory::MemoryManager =
Box::leak(Box::new(StdMemoryManager::new()));
Expand All @@ -1822,10 +1811,6 @@ mod tests {

#[test]
fn test_build_table_data() {
use patina::component::service::memory::StdMemoryManager;
extern crate std;
use std::boxed::Box;

let manager = SmbiosManager::new(3, 9).expect("failed to create manager");
let memory_manager: &'static dyn patina::component::service::memory::MemoryManager =
Box::leak(Box::new(StdMemoryManager::new()));
Expand Down Expand Up @@ -1865,10 +1850,6 @@ mod tests {

#[test]
fn test_build_table_data_copies_records_correctly() {
use patina::component::service::memory::StdMemoryManager;
extern crate std;
use std::boxed::Box;

let manager = SmbiosManager::new(3, 9).expect("failed to create manager");
let memory_manager: &'static dyn patina::component::service::memory::MemoryManager =
Box::leak(Box::new(StdMemoryManager::new()));
Expand Down Expand Up @@ -1899,10 +1880,6 @@ mod tests {

#[test]
fn test_build_table_data_no_records_error() {
use patina::component::service::memory::StdMemoryManager;
extern crate std;
use std::boxed::Box;

let manager = SmbiosManager::new(3, 9).expect("failed to create manager");
let memory_manager: &'static dyn patina::component::service::memory::MemoryManager =
Box::leak(Box::new(StdMemoryManager::new()));
Expand Down
3 changes: 0 additions & 3 deletions components/patina_smbios/src/manager/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
//! SPDX-License-Identifier: Apache-2.0
//!

extern crate alloc;

use core::ffi::c_char;

use alloc::string::ToString;
Expand Down Expand Up @@ -360,7 +358,6 @@ impl SmbiosProtocol {
mod tests {
use super::*;
use crate::{error::SmbiosError, manager::SmbiosManager};
extern crate std;
use std::vec::Vec;

fn create_test_bios_info_record() -> Vec<u8> {
Expand Down
3 changes: 0 additions & 3 deletions components/patina_smbios/src/manager/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//! SPDX-License-Identifier: Apache-2.0
//!

extern crate alloc;

use alloc::vec::Vec;

use crate::service::SmbiosTableHeader;
Expand Down Expand Up @@ -40,7 +38,6 @@ impl SmbiosRecord {
#[cfg(test)]
mod tests {
use super::*;
extern crate std;
use std::vec;

use patina::standard::efi;
Expand Down
Loading
Loading