changelog
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
2024-04-02 20:25:20 +02:00
parent 52d16e0fe7
commit dd39b374bf
17 changed files with 268 additions and 349 deletions

View File

@ -2,12 +2,12 @@
pub mod crossbeam_test {
use hashbrown::HashMap;
use satrs::pool::{PoolProvider, PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
use satrs::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0};
use satrs::pus::verification::{
FailParams, RequestId, VerificationReporter, VerificationReporterCfg,
VerificationReportingProvider,
};
use satrs::pus::TmInSharedPoolSenderWithCrossbeam;
use satrs::request::UniqueApidTargetId;
use satrs::tmtc::tm_helper::SharedTmPool;
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTmReader;
@ -17,9 +17,6 @@ pub mod crossbeam_test {
use std::thread;
use std::time::Duration;
const TEST_APID: u16 = 0x03;
const TEST_ID: UniqueApidTargetId = UniqueApidTargetId::new(TEST_APID, 0x05);
const FIXED_STAMP: [u8; 7] = [0; 7];
const PACKETS_SENT: u8 = 8;
@ -45,7 +42,7 @@ pub mod crossbeam_test {
let (tx, rx) = crossbeam_channel::bounded(10);
let sender_0 = TmInSharedPoolSenderWithCrossbeam::new(shared_tm_pool.clone(), tx.clone());
let sender_1 = sender_0.clone();
let mut reporter_with_sender_0 = VerificationReporter::new(&cfg);
let mut reporter_with_sender_0 = VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &cfg);
let mut reporter_with_sender_1 = reporter_with_sender_0.clone();
// For test purposes, we retrieve the request ID from the TCs and pass them to the receiver
// tread.
@ -92,36 +89,24 @@ pub mod crossbeam_test {
let token = reporter_with_sender_0.add_tc_with_req_id(req_id_0);
let accepted_token = reporter_with_sender_0
.acceptance_success(TEST_ID.raw(), &sender_0, token, &FIXED_STAMP)
.acceptance_success(&sender_0, token, &FIXED_STAMP)
.expect("Acceptance success failed");
// Do some start handling here
let started_token = reporter_with_sender_0
.start_success(TEST_ID.raw(), &sender_0, accepted_token, &FIXED_STAMP)
.start_success(&sender_0, accepted_token, &FIXED_STAMP)
.expect("Start success failed");
// Do some step handling here
reporter_with_sender_0
.step_success(
TEST_ID.raw(),
&sender_0,
&started_token,
&FIXED_STAMP,
EcssEnumU8::new(0),
)
.step_success(&sender_0, &started_token, &FIXED_STAMP, EcssEnumU8::new(0))
.expect("Start success failed");
// Finish up
reporter_with_sender_0
.step_success(
TEST_ID.raw(),
&sender_0,
&started_token,
&FIXED_STAMP,
EcssEnumU8::new(1),
)
.step_success(&sender_0, &started_token, &FIXED_STAMP, EcssEnumU8::new(1))
.expect("Start success failed");
reporter_with_sender_0
.completion_success(TEST_ID.raw(), &sender_0, started_token, &FIXED_STAMP)
.completion_success(&sender_0, started_token, &FIXED_STAMP)
.expect("Completion success failed");
});
@ -139,15 +124,15 @@ pub mod crossbeam_test {
let (tc, _) = PusTcReader::new(&tc_buf[0..tc_len]).unwrap();
let token = reporter_with_sender_1.add_tc(&tc);
let accepted_token = reporter_with_sender_1
.acceptance_success(TEST_ID.raw(), &sender_1, token, &FIXED_STAMP)
.acceptance_success(&sender_1, token, &FIXED_STAMP)
.expect("Acceptance success failed");
let started_token = reporter_with_sender_1
.start_success(TEST_ID.raw(), &sender_1, accepted_token, &FIXED_STAMP)
.start_success(&sender_1, accepted_token, &FIXED_STAMP)
.expect("Start success failed");
let fail_code = EcssEnumU16::new(2);
let params = FailParams::new_no_fail_data(&FIXED_STAMP, &fail_code);
reporter_with_sender_1
.completion_failure(TEST_ID.raw(), &sender_1, started_token, params)
.completion_failure(&sender_1, started_token, params)
.expect("Completion success failed");
});