summaryrefslogtreecommitdiff
path: root/tests/unit/ft8
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2026-10-20 22:35:06 +0100
committerDave Hibberd <hibby@debian.org>2026-10-20 22:35:06 +0100
commit82ebb1ed1af30cee4dfbb1c628431d32885a00e0 (patch)
tree1a1f782d3e576b758be0bc61171574a7cd8f2376 /tests/unit/ft8
parent061658210acb6425517733ea012dda803a7f72a1 (diff)
parent61d684922b0f1c8455cc60eb3d123df058c9e1f5 (diff)
Merge tag 'debian/3.3.0_beta2+dfsg-1' into hibbian/trixie-backports
tagging wsjtx 3.3.0~beta2+dfsg-1
Diffstat (limited to 'tests/unit/ft8')
-rw-r--r--tests/unit/ft8/CMakeLists.txt3
-rw-r--r--tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp46
2 files changed, 42 insertions, 7 deletions
diff --git a/tests/unit/ft8/CMakeLists.txt b/tests/unit/ft8/CMakeLists.txt
index 18eb4557..9e2c95ec 100644
--- a/tests/unit/ft8/CMakeLists.txt
+++ b/tests/unit/ft8/CMakeLists.txt
@@ -11,13 +11,12 @@ add_executable (test_ft8_mtd_decode_coordinator
${CMAKE_SOURCE_DIR}/Ft8MtdDecodeCoordinator.cpp
${CMAKE_SOURCE_DIR}/Ft8MtdDecodeScheduler.cpp
${CMAKE_SOURCE_DIR}/DecoderIpc.cpp
- ${CMAKE_SOURCE_DIR}/lib/decoder_ipc_control.cpp
)
target_include_directories (test_ft8_mtd_decode_coordinator PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/lib
)
-target_link_libraries (test_ft8_mtd_decode_coordinator Qt5::Test)
+target_link_libraries (test_ft8_mtd_decode_coordinator wsjt_cxx Qt5::Test)
add_test (NAME test_ft8_mtd_decode_coordinator COMMAND test_ft8_mtd_decode_coordinator)
add_executable (test_ft8_decode_ranges
diff --git a/tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp b/tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp
index 2debacb3..51d79a11 100644
--- a/tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp
+++ b/tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp
@@ -20,6 +20,7 @@ namespace
pending->payload.params.nmode = 8;
pending->payload.params.lmultift8 = true;
pending->payload.params.nutc = nutc;
+ pending->payload.metadata = {period, period + 1000, 2, 170000};
pending->payload.samples[0] = firstSample;
pending->context.mode = "FT8";
pending->context.periodFrequency = 14074000;
@@ -27,6 +28,8 @@ namespace
pending->context.multithreadFt8 = true;
pending->context.ft8ThreadCount = 4;
pending->context.decodeDepth = 3;
+ pending->context.inputId = pending->payload.metadata.input_id;
+ pending->context.analysisId = pending->payload.metadata.analysis_id;
return pending;
}
@@ -62,8 +65,9 @@ namespace
return decision.action;
}
- return coordinator.deferFinal (
- pendingDecode (period, nutc, firstSample));
+ auto pending = pendingDecode (period, nutc, firstSample);
+ currentContext = pending->context;
+ return coordinator.deferFinal (std::move (pending));
}
void completeAndDrain ()
@@ -76,7 +80,9 @@ namespace
if (!coordinator.hasPending ()) return;
auto const outcome = coordinator.drainPending (
- [] (Ft8MtdDecodeCoordinator::PendingMtdDecode const&) {return true;},
+ [this] (Ft8MtdDecodeCoordinator::PendingMtdDecode const& pending) {
+ return pending.context.hasSameFt8PendingIdentity (currentContext);
+ },
[this] (Ft8MtdDecodeCoordinator::PendingMtdDecode const& pending) {
active = true;
activeStage = Stage::Final;
@@ -85,6 +91,7 @@ namespace
publishedNutcs.push_back (pending.payload.params.nutc);
publishedFirstSamples.push_back (pending.payload.samples[0]);
publishedContext = pending.context;
+ publishedMetadata = pending.payload.metadata;
return PendingPublishResult::Published;
});
QCOMPARE (outcome.result, DrainResult::Published);
@@ -103,6 +110,8 @@ namespace
std::vector<int> publishedNutcs;
std::vector<short> publishedFirstSamples;
DecodeOperatingContext publishedContext;
+ DecodeOperatingContext currentContext;
+ decoder_input_metadata_t publishedMetadata {};
};
}
@@ -112,6 +121,7 @@ class TestFt8MtdDecodeCoordinator final : public QObject
private Q_SLOTS:
void slowEarlyDecodeRetainsAndPublishesFinalOnce ();
+ void receiveRolloverRetainsPendingFinal ();
void unrelatedCompletionDoesNotPublishPendingFinal ();
void multiPeriodOverrunPublishesOnlyNewestFinal ();
void pendingSnapshotIsImmutable ();
@@ -141,6 +151,27 @@ void TestFt8MtdDecodeCoordinator::slowEarlyDecodeRetainsAndPublishesFinalOnce ()
QVERIFY (!backend.coordinator.hasPending ());
}
+void TestFt8MtdDecodeCoordinator::receiveRolloverRetainsPendingFinal ()
+{
+ FakeBackend backend;
+ backend.startEarly (Stage::EarlyOne, 100, 1);
+ QCOMPARE (backend.submitFinal (100, 120000, 17), Action::DeferFinal);
+ ++backend.currentContext.inputId;
+ ++backend.currentContext.analysisId;
+ backend.currentContext.sequenceStart = QDateTime::fromMSecsSinceEpoch (1515000);
+
+ backend.completeAndDrain ();
+
+ QVERIFY (backend.publishedPeriods == std::vector<qint64> ({100, 100}));
+ QCOMPARE (backend.publishedNutcs.back (), 120000);
+ QCOMPARE (backend.publishedFirstSamples.back (), short {17});
+ QCOMPARE (backend.publishedMetadata.input_id, int64_t {100});
+ QCOMPARE (backend.publishedMetadata.analysis_id, int64_t {1100});
+ QCOMPARE (backend.publishedMetadata.attempt_no, int32_t {2});
+ QCOMPARE (backend.publishedMetadata.valid_samples, int32_t {170000});
+ QVERIFY (!backend.coordinator.hasPending ());
+}
+
void TestFt8MtdDecodeCoordinator::unrelatedCompletionDoesNotPublishPendingFinal ()
{
FakeBackend backend;
@@ -292,11 +323,16 @@ void TestFt8MtdDecodeCoordinator::changedContextDropsPendingWithoutPublishing ()
{
Ft8MtdDecodeCoordinator coordinator;
coordinator.request (Stage::Final, 520, 1, true);
- coordinator.deferFinal (pendingDecode (520, 160030, 53));
+ auto pending = pendingDecode (520, 160030, 53);
+ auto current = pending->context;
+ ++current.ft8ThreadCount;
+ coordinator.deferFinal (std::move (pending));
int publishCalls {0};
auto const outcome = coordinator.drainPending (
- [] (Ft8MtdDecodeCoordinator::PendingMtdDecode const&) {return false;},
+ [&current] (Ft8MtdDecodeCoordinator::PendingMtdDecode const& pending) {
+ return pending.context.hasSameFt8PendingIdentity (current);
+ },
[&] (Ft8MtdDecodeCoordinator::PendingMtdDecode const&) {
++publishCalls;
return PendingPublishResult::Published;