Major functionality implemented (missing reconfig).

This commit is contained in:
Martino Ferrari
2026-04-14 01:40:43 +02:00
parent 96d98dfc3d
commit 3a1ecd3aba
6 changed files with 1173 additions and 107 deletions
+52 -5
View File
@@ -63,14 +63,61 @@ public:
Vec<uint32> sizes;
FastPollingMutexSem mutex;
DebugSignalInfo* ptrs[1] = { service.signals[0] };
service.RegisterBroker(ptrs, 1, NULL_PTR(MemoryMapBroker*), &active, &indices, &sizes, &mutex);
volatile bool anyBreak = false;
Vec<uint32> breakIdx;
service.RegisterBroker(ptrs, 1, NULL_PTR(MemoryMapBroker*), &active, &indices, &sizes, &mutex, &anyBreak, &breakIdx);
service.UpdateBrokersActiveStatus();
assert(active == true);
assert(indices.Size() == 1);
assert(indices[0] == 0);
// Helper Process
DebugBrokerHelper::Process(&service, ptrs, indices, sizes, mutex);
DebugBrokerHelper::Process(&service, ptrs, indices, sizes, mutex, &anyBreak, &breakIdx);
// 4. Step / per-thread filter
// STEP with no thread filter — all threads can consume
service.Step(2u, NULL_PTR(const char8 *));
assert(!service.IsPaused());
assert(service.stepRemaining == 2u);
service.ConsumeStepIfNeeded("GAM1", "ThreadA");
assert(service.stepRemaining == 1u);
assert(!service.IsPaused());
service.ConsumeStepIfNeeded("GAM1", "ThreadB");
assert(service.stepRemaining == 0u);
assert(service.IsPaused());
assert(service.pausedAtGam == "GAM1");
// STEP with a thread filter — only matching thread consumes
service.Step(2u, "ThreadA");
assert(!service.IsPaused());
assert(service.stepThreadFilter == "ThreadA");
// ThreadB should be ignored
service.ConsumeStepIfNeeded("GAMB", "ThreadB");
assert(service.stepRemaining == 2u); // unchanged
assert(!service.IsPaused());
// ThreadA consumes both credits
service.ConsumeStepIfNeeded("GAMA1", "ThreadA");
assert(service.stepRemaining == 1u);
assert(!service.IsPaused());
service.ConsumeStepIfNeeded("GAMA2", "ThreadA");
assert(service.stepRemaining == 0u);
assert(service.IsPaused());
assert(service.pausedAtGam == "GAMA2");
// STEP with unknown thread (NULL threadName arg to ConsumeStep) is also filtered out
service.Step(1u, "ThreadA");
service.ConsumeStepIfNeeded("X", NULL_PTR(const char8 *));
assert(service.stepRemaining == 1u); // not consumed
service.SetPaused(false);
service.Step(0u, NULL_PTR(const char8 *));
// 5. VALUE command (NULL client — smoke test, no crash)
service.HandleCommand("VALUE X.Y.Z", NULL_PTR(BasicTCPSocket*));
service.HandleCommand("VALUE NoSuchSignal", NULL_PTR(BasicTCPSocket*));
service.HandleCommand("STEP 1 ThreadA", NULL_PTR(BasicTCPSocket*));
assert(service.stepThreadFilter == "ThreadA");
service.HandleCommand("STEP 3", NULL_PTR(BasicTCPSocket*));
assert(service.stepThreadFilter.Size() == 0u);
}
};
@@ -86,9 +133,9 @@ void timeout_handler(int sig) {
int main() {
signal(SIGALRM, timeout_handler);
alarm(10);
printf("--- MARTe2 Debug Suite COVERAGE V29 ---\n");
printf("--- MARTe2 Debug Suite COVERAGE V30 ---\n");
MARTe::TestTcpLogger();
MARTe::DebugServiceTest::TestAll();
printf("\nCOVERAGE V29 PASSED!\n");
printf("\nCOVERAGE V30 PASSED!\n");
return 0;
}