Heapless memory pool #191
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
- run: cargo nextest run --all-features
|
||||
- run: cargo test --doc
|
||||
- run: cargo test --doc --all-features
|
||||
|
||||
cross-check:
|
||||
name: Check Cross-Compilation
|
||||
|
2
automation/Jenkinsfile
vendored
2
automation/Jenkinsfile
vendored
@ -33,7 +33,7 @@ pipeline {
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'cargo nextest r --all-features'
|
||||
sh 'cargo test --doc'
|
||||
sh 'cargo test --doc --all-features'
|
||||
}
|
||||
}
|
||||
stage('Check with all features') {
|
||||
|
@ -182,7 +182,7 @@ pub mod pool {
|
||||
use super::*;
|
||||
pub fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) {
|
||||
(
|
||||
StaticMemoryPool::new(StaticPoolConfig::new(
|
||||
StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![
|
||||
(30, 32),
|
||||
(15, 64),
|
||||
@ -193,7 +193,7 @@ pub mod pool {
|
||||
],
|
||||
true,
|
||||
)),
|
||||
StaticMemoryPool::new(StaticPoolConfig::new(
|
||||
StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![
|
||||
(30, 32),
|
||||
(15, 64),
|
||||
@ -208,7 +208,7 @@ pub mod pool {
|
||||
}
|
||||
|
||||
pub fn create_sched_tc_pool() -> StaticMemoryPool {
|
||||
StaticMemoryPool::new(StaticPoolConfig::new(
|
||||
StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![
|
||||
(30, 32),
|
||||
(15, 64),
|
||||
|
@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# [unreleased]
|
||||
|
||||
## Changed
|
||||
|
||||
- Renamed `StaticPoolConfig::new` to `StaticPoolConfig::new_from_subpool_cfg_tuples`. The new
|
||||
`new` implementation expects a type struct instead of tuples.
|
||||
|
||||
## Added
|
||||
|
||||
- `StaticHeaplessMemoryPool` which can be grown with user-provided static buffers.
|
||||
|
||||
# [v0.2.1] 2024-05-19
|
||||
|
||||
## Changed
|
||||
|
1221
satrs/src/pool.rs
1221
satrs/src/pool.rs
File diff suppressed because it is too large
Load Diff
@ -1356,7 +1356,10 @@ pub mod tests {
|
||||
///
|
||||
/// The PUS service handler is instantiated with a [EcssTcInStoreConverter].
|
||||
pub fn new(id: ComponentId) -> (Self, PusServiceHelperStatic) {
|
||||
let pool_cfg = StaticPoolConfig::new(alloc::vec![(16, 16), (8, 32), (4, 64)], false);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
alloc::vec![(16, 16), (8, 32), (4, 64)],
|
||||
false,
|
||||
);
|
||||
let tc_pool = StaticMemoryPool::new(pool_cfg.clone());
|
||||
let tm_pool = StaticMemoryPool::new(pool_cfg);
|
||||
let shared_tc_pool = SharedStaticMemoryPool::new(RwLock::new(tc_pool));
|
||||
|
@ -939,7 +939,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_reset() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
@ -1088,7 +1091,10 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn test_release_telecommands() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
@ -1153,7 +1159,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn release_multi_with_same_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
@ -1210,7 +1219,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn release_with_scheduler_disabled() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
scheduler.disable();
|
||||
@ -1278,7 +1290,10 @@ mod tests {
|
||||
fn insert_unwrapped_tc() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
|
||||
@ -1325,7 +1340,10 @@ mod tests {
|
||||
fn insert_wrapped_tc() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc = scheduled_tc(UnixTime::new_only_secs(100), &mut buf);
|
||||
@ -1374,7 +1392,10 @@ mod tests {
|
||||
fn insert_wrong_service() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc = wrong_tc_service(UnixTime::new_only_secs(100), &mut buf);
|
||||
@ -1396,7 +1417,10 @@ mod tests {
|
||||
fn insert_wrong_subservice() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc = wrong_tc_subservice(UnixTime::new_only_secs(100), &mut buf);
|
||||
@ -1417,7 +1441,10 @@ mod tests {
|
||||
#[test]
|
||||
fn insert_wrapped_tc_faulty_app_data() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let tc = invalid_time_tagged_cmd();
|
||||
let insert_res = scheduler.insert_wrapped_tc::<cds::CdsTime>(&tc, &mut pool);
|
||||
assert!(insert_res.is_err());
|
||||
@ -1431,7 +1458,10 @@ mod tests {
|
||||
#[test]
|
||||
fn insert_doubly_wrapped_time_tagged_cmd() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut buf: [u8; 64] = [0; 64];
|
||||
let tc = double_wrapped_time_tagged_tc(UnixTime::new_only_secs(50), &mut buf);
|
||||
let insert_res = scheduler.insert_wrapped_tc::<cds::CdsTime>(&tc, &mut pool);
|
||||
@ -1465,7 +1495,10 @@ mod tests {
|
||||
fn release_time_within_time_margin() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
|
||||
@ -1489,7 +1522,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_store_error_propagation_release() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
@ -1523,7 +1559,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_store_error_propagation_reset() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
@ -1546,7 +1585,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_delete_by_req_id_simple_retrieve_addr() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
@ -1564,7 +1606,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_delete_by_req_id_simple_delete_all() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
@ -1582,7 +1627,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_delete_by_req_id_complex() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
let tc_info_0 = ping_tc_to_store(&mut pool, &mut buf, 0, &[]);
|
||||
@ -1627,7 +1675,10 @@ mod tests {
|
||||
fn insert_full_store_test() {
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(1, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(1, 64)],
|
||||
false,
|
||||
));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
// Store is full after this.
|
||||
@ -1663,7 +1714,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_time_window_retrieval_select_all() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let tc_info_0 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let tc_info_1 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1692,7 +1746,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_time_window_retrieval_select_from_stamp() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let _ = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let tc_info_1 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1724,7 +1781,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_time_window_retrieval_select_to_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let tc_info_0 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let tc_info_1 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1756,7 +1816,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_time_window_retrieval_select_from_time_to_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let _ = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let tc_info_1 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1794,7 +1857,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_deletion_all() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1820,7 +1886,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_deletion_from_start_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let cmd_0_to_delete = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1842,7 +1911,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_deletion_to_end_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let cmd_0_to_delete = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let cmd_1_to_delete = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1865,7 +1937,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_deletion_from_start_time_to_end_time() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
let cmd_out_of_range_0 = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 50);
|
||||
let cmd_0_to_delete = insert_command_with_release_time(&mut pool, &mut scheduler, 0, 100);
|
||||
@ -1897,7 +1972,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_release_without_deletion() {
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(10, 32), (5, 64)], false));
|
||||
let mut pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (5, 64)],
|
||||
false,
|
||||
));
|
||||
let mut scheduler = PusScheduler::new(UnixTime::new_only_secs(0), Duration::from_secs(5));
|
||||
|
||||
let mut buf: [u8; 32] = [0; 32];
|
||||
|
@ -286,7 +286,10 @@ mod tests {
|
||||
impl Pus11HandlerWithStoreTester {
|
||||
pub fn new() -> Self {
|
||||
let test_scheduler = TestScheduler::default();
|
||||
let pool_cfg = StaticPoolConfig::new(alloc::vec![(16, 16), (8, 32), (4, 64)], false);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
alloc::vec![(16, 16), (8, 32), (4, 64)],
|
||||
false,
|
||||
);
|
||||
let sched_tc_pool = StaticMemoryPool::new(pool_cfg.clone());
|
||||
let (common, srv_handler) = PusServiceHandlerWithSharedStoreCommon::new(0);
|
||||
Self {
|
||||
|
@ -31,7 +31,9 @@
|
||||
//! const TEST_APID: u16 = 0x02;
|
||||
//! const TEST_COMPONENT_ID: UniqueApidTargetId = UniqueApidTargetId::new(TEST_APID, 0x05);
|
||||
//!
|
||||
//! let pool_cfg = StaticPoolConfig::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)], false);
|
||||
//! let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
//! vec![(10, 32), (10, 64), (10, 128), (10, 1024)], false
|
||||
//! );
|
||||
//! let tm_pool = StaticMemoryPool::new(pool_cfg.clone());
|
||||
//! let shared_tm_pool = SharedStaticMemoryPool::new(RwLock::new(tm_pool));
|
||||
//! let (verif_tx, verif_rx) = mpsc::sync_channel(10);
|
||||
@ -2069,7 +2071,10 @@ pub mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_mpsc_verif_send() {
|
||||
let pool = StaticMemoryPool::new(StaticPoolConfig::new(vec![(8, 8)], false));
|
||||
let pool = StaticMemoryPool::new(StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(8, 8)],
|
||||
false,
|
||||
));
|
||||
let shared_tm_store =
|
||||
SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(pool)));
|
||||
let (tx, _) = mpsc::sync_channel(10);
|
||||
|
@ -486,7 +486,9 @@ pub(crate) mod tests {
|
||||
|
||||
use std::sync::RwLock;
|
||||
|
||||
use crate::pool::{PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
|
||||
use crate::pool::{
|
||||
PoolProviderWithGuards, SharedStaticMemoryPool, StaticMemoryPool, StaticPoolConfig,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use std::sync::mpsc;
|
||||
@ -554,7 +556,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_basic_shared_store_sender_unbounded_sender() {
|
||||
let (tc_tx, tc_rx) = mpsc::channel();
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(2, 8)], true);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(2, 8)], true);
|
||||
let shared_pool = SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(
|
||||
StaticMemoryPool::new(pool_cfg),
|
||||
)));
|
||||
@ -571,7 +573,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_basic_shared_store_sender() {
|
||||
let (tc_tx, tc_rx) = mpsc::sync_channel(10);
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(2, 8)], true);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(2, 8)], true);
|
||||
let shared_pool = SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(
|
||||
StaticMemoryPool::new(pool_cfg),
|
||||
)));
|
||||
@ -588,7 +590,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_basic_shared_store_sender_rx_dropped() {
|
||||
let (tc_tx, tc_rx) = mpsc::sync_channel(10);
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(2, 8)], true);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(2, 8)], true);
|
||||
let shared_pool = SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(
|
||||
StaticMemoryPool::new(pool_cfg),
|
||||
)));
|
||||
@ -606,7 +608,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_basic_shared_store_sender_queue_full() {
|
||||
let (tc_tx, tc_rx) = mpsc::sync_channel(1);
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(2, 8)], true);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(2, 8)], true);
|
||||
let shared_pool = SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(
|
||||
StaticMemoryPool::new(pool_cfg),
|
||||
)));
|
||||
@ -629,7 +631,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_basic_shared_store_store_error() {
|
||||
let (tc_tx, tc_rx) = mpsc::sync_channel(1);
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(1, 8)], true);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(1, 8)], true);
|
||||
let shared_pool = SharedPacketPool::new(&SharedStaticMemoryPool::new(RwLock::new(
|
||||
StaticMemoryPool::new(pool_cfg),
|
||||
)));
|
||||
|
@ -9,7 +9,8 @@ const DUMMY_DATA: [u8; 4] = [0, 1, 2, 3];
|
||||
|
||||
#[test]
|
||||
fn threaded_usage() {
|
||||
let pool_cfg = StaticPoolConfig::new(vec![(16, 6), (32, 3), (8, 12)], false);
|
||||
let pool_cfg =
|
||||
StaticPoolConfig::new_from_subpool_cfg_tuples(vec![(16, 6), (32, 3), (8, 12)], false);
|
||||
let shared_pool = Arc::new(RwLock::new(StaticMemoryPool::new(pool_cfg)));
|
||||
let shared_clone = shared_pool.clone();
|
||||
let (tx, rx): (Sender<PoolAddr>, Receiver<PoolAddr>) = mpsc::channel();
|
||||
|
@ -33,8 +33,10 @@ pub mod crossbeam_test {
|
||||
// each reporter have an own sequence count provider.
|
||||
let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap();
|
||||
// Shared pool object to store the verification PUS telemetry
|
||||
let pool_cfg =
|
||||
StaticPoolConfig::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)], false);
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (10, 64), (10, 128), (10, 1024)],
|
||||
false,
|
||||
);
|
||||
let shared_tm_pool =
|
||||
SharedStaticMemoryPool::new(RwLock::new(StaticMemoryPool::new(pool_cfg.clone())));
|
||||
let shared_tc_pool =
|
||||
|
Loading…
Reference in New Issue
Block a user