From 28240da002ad635ad515d9120902bbce691115b8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 6 Jul 2023 00:58:25 +0200 Subject: [PATCH] fix tests --- satrs-core/src/hal/host/udp_server.rs | 1 + satrs-core/src/pus/verification.rs | 32 +++++++++++++-------------- satrs-core/src/tmtc/ccsds_distrib.rs | 1 + satrs-core/tests/pus_verification.rs | 11 +-------- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/satrs-core/src/hal/host/udp_server.rs b/satrs-core/src/hal/host/udp_server.rs index a83f4f8..8f80eb7 100644 --- a/satrs-core/src/hal/host/udp_server.rs +++ b/satrs-core/src/hal/host/udp_server.rs @@ -18,6 +18,7 @@ use std::vec::Vec; /// /// ``` /// use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; +/// use spacepackets::ecss::SerializablePusPacket; /// use satrs_core::hal::host::udp_server::UdpTcServer; /// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; /// use spacepackets::SpHeader; diff --git a/satrs-core/src/pus/verification.rs b/satrs-core/src/pus/verification.rs index b4db15f..c3c8522 100644 --- a/satrs-core/src/pus/verification.rs +++ b/satrs-core/src/pus/verification.rs @@ -29,8 +29,8 @@ //! let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]); //! let shared_tm_pool: SharedPool = Arc::new(RwLock::new(Box::new(LocalPool::new(pool_cfg.clone())))); //! let (verif_tx, verif_rx) = mpsc::channel(); -//! let sender = MpscVerifSender::new(shared_tm_pool.clone(), verif_tx); -//! let cfg = VerificationReporterCfg::new(TEST_APID, Box::new(SeqCountProviderSimple::default()), Box::new(SeqCountProviderSimple::default()), 1, 2, 8).unwrap(); +//! let sender = MpscVerifSender::new(0, "Test Sender", shared_tm_pool.clone(), verif_tx); +//! let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); //! let mut reporter = VerificationReporterWithSender::new(&cfg , Box::new(sender)); //! //! let mut sph = SpHeader::tc_unseg(TEST_APID, 0, 0).unwrap(); @@ -939,7 +939,7 @@ mod alloc_mod { /// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets /// and verify the various steps of telecommand handling as specified in the PUS standard. - /// It is assumed that the sequence counter and message counters are written in a central + /// It is assumed that the sequence counter and message counters are updated in a central /// TM funnel. This helper will always set those fields to 0. #[derive(Clone)] pub struct VerificationReporter { @@ -1795,7 +1795,7 @@ mod tests { common: CommonTmInfo { subservice: 4, apid: TEST_APID, - msg_counter: 1, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -1874,7 +1874,7 @@ mod tests { common: CommonTmInfo { subservice: 3, apid: TEST_APID, - msg_counter: 1, + msg_counter: 0, dest_id: 0, time_stamp: [0, 1, 0, 1, 0, 1, 0], }, @@ -1887,7 +1887,7 @@ mod tests { common: CommonTmInfo { subservice: 5, apid: TEST_APID, - msg_counter: 2, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -1900,7 +1900,7 @@ mod tests { common: CommonTmInfo { subservice: 5, apid: TEST_APID, - msg_counter: 3, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -1992,7 +1992,7 @@ mod tests { common: CommonTmInfo { subservice: 3, apid: TEST_APID, - msg_counter: 1, + msg_counter: 0, dest_id: 0, time_stamp: [0, 1, 0, 1, 0, 1, 0], }, @@ -2006,7 +2006,7 @@ mod tests { common: CommonTmInfo { subservice: 5, apid: TEST_APID, - msg_counter: 2, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -2020,7 +2020,7 @@ mod tests { common: CommonTmInfo { subservice: 6, apid: TEST_APID, - msg_counter: 3, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -2137,7 +2137,7 @@ mod tests { common: CommonTmInfo { subservice: 3, apid: TEST_APID, - msg_counter: 1, + msg_counter: 0, dest_id: 0, time_stamp: [0, 1, 0, 1, 0, 1, 0], }, @@ -2151,7 +2151,7 @@ mod tests { common: CommonTmInfo { subservice: 8, apid: TEST_APID, - msg_counter: 2, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -2227,7 +2227,7 @@ mod tests { common: CommonTmInfo { subservice: 3, apid: TEST_APID, - msg_counter: 1, + msg_counter: 0, dest_id: 0, time_stamp: [0, 1, 0, 1, 0, 1, 0], }, @@ -2240,7 +2240,7 @@ mod tests { common: CommonTmInfo { subservice: 7, apid: TEST_APID, - msg_counter: 2, + msg_counter: 0, dest_id: 0, time_stamp: EMPTY_STAMP, }, @@ -2336,10 +2336,10 @@ mod tests { assert_eq!(pus_tm.sp_header.seq_count(), 0); } else if packet_idx == 1 { assert_eq!(pus_tm.subservice(), 3); - assert_eq!(pus_tm.sp_header.seq_count(), 1); + assert_eq!(pus_tm.sp_header.seq_count(), 0); } else if packet_idx == 2 { assert_eq!(pus_tm.subservice(), 7); - assert_eq!(pus_tm.sp_header.seq_count(), 2); + assert_eq!(pus_tm.sp_header.seq_count(), 0); } packet_idx += 1; } diff --git a/satrs-core/src/tmtc/ccsds_distrib.rs b/satrs-core/src/tmtc/ccsds_distrib.rs index 6cb4987..eefed54 100644 --- a/satrs-core/src/tmtc/ccsds_distrib.rs +++ b/satrs-core/src/tmtc/ccsds_distrib.rs @@ -21,6 +21,7 @@ //! use satrs_core::tmtc::ccsds_distrib::{CcsdsPacketHandler, CcsdsDistributor}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use spacepackets::{CcsdsPacket, SpHeader}; +//! use spacepackets::ecss::SerializablePusPacket; //! use spacepackets::tc::PusTc; //! //! #[derive (Default)] diff --git a/satrs-core/tests/pus_verification.rs b/satrs-core/tests/pus_verification.rs index 035904b..cd68e98 100644 --- a/satrs-core/tests/pus_verification.rs +++ b/satrs-core/tests/pus_verification.rs @@ -7,7 +7,6 @@ pub mod crossbeam_test { CrossbeamVerifSender, FailParams, RequestId, VerificationReporterCfg, VerificationReporterWithSender, }; - use satrs_core::seq_count::SeqCountProviderSyncClonable; use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket}; use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; use spacepackets::tm::PusTm; @@ -32,15 +31,7 @@ pub mod crossbeam_test { // We use a synced sequence count provider here because both verification reporters have the // the same APID. If they had distinct APIDs, the more correct approach would be to have // each reporter have an own sequence count provider. - let cfg = VerificationReporterCfg::new( - TEST_APID, - Box::new(SeqCountProviderSyncClonable::default()), - Box::new(SeqCountProviderSyncClonable::default()), - 1, - 2, - 8, - ) - .unwrap(); + let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); // Shared pool object to store the verification PUS telemetry let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]); let shared_tm_pool: SharedPool =