Project fixes and correct MARTe style makefile and source structure
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
include_directories(
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L0Types
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L1Portability
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L2Objects
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L3Streams
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L4Configuration
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L4Events
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L4Logger
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L4Messages
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L5FILES
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L5GAMs
|
||||
${MARTe2_DIR}/Source/Core/BareMetal/L6App
|
||||
${MARTe2_DIR}/Source/Core/Scheduler/L1Portability
|
||||
${MARTe2_DIR}/Source/Core/Scheduler/L3Services
|
||||
${MARTe2_DIR}/Source/Core/Scheduler/L4LoggerService
|
||||
${MARTe2_DIR}/Source/Core/FileSystem/L1Portability
|
||||
${MARTe2_DIR}/Source/Core/FileSystem/L3Streams
|
||||
${MARTe2_DIR}/Source/Core/Scheduler/L5GAMs
|
||||
${MARTe2_Components_DIR}/Source/Components/DataSources/EpicsDataSource
|
||||
${MARTe2_Components_DIR}/Source/Components/DataSources/FileDataSource
|
||||
${MARTe2_Components_DIR}/Source/Components/GAMs/IOGAM
|
||||
../../Source
|
||||
../../Headers
|
||||
)
|
||||
|
||||
file(GLOB SOURCES "*.cpp")
|
||||
|
||||
add_executable(UnitTests ${SOURCES})
|
||||
|
||||
target_link_libraries(UnitTests
|
||||
marte_dev
|
||||
${MARTe2_DIR}/Build/${TARGET}/Core/libMARTe2.so
|
||||
)
|
||||
1
Test/UnitTests/Makefile.gcc
Normal file
1
Test/UnitTests/Makefile.gcc
Normal file
@@ -0,0 +1 @@
|
||||
include Makefile.inc
|
||||
39
Test/UnitTests/Makefile.inc
Normal file
39
Test/UnitTests/Makefile.inc
Normal file
@@ -0,0 +1,39 @@
|
||||
OBJSX =
|
||||
|
||||
PACKAGE = Test/UnitTests
|
||||
|
||||
ROOT_DIR = ../..
|
||||
|
||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Result
|
||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Vec
|
||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/DebugService
|
||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/TCPLogger
|
||||
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Logger
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4LoggerService
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L5GAMs
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
||||
|
||||
LIBRARIES += -L$(MARTe2_DIR)/Build/$(TARGET)/Core -lMARTe2
|
||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/DebugService -lDebugService
|
||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/TCPLogger -lTcpLogger
|
||||
|
||||
all: $(OBJS) $(BUILD_DIR)/UnitTests$(EXEEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
@@ -9,20 +9,23 @@
|
||||
#include "TcpLogger.h"
|
||||
#include "ConfigurationDatabase.h"
|
||||
#include "ObjectRegistryDatabase.h"
|
||||
#include "StandardParser.h"
|
||||
#include "MemoryMapInputBroker.h"
|
||||
#include "Sleep.h"
|
||||
#include "BasicTCPSocket.h"
|
||||
#include "HighResolutionTimer.h"
|
||||
|
||||
using namespace MARTe;
|
||||
#include "GlobalObjectsDatabase.h"
|
||||
|
||||
namespace MARTe {
|
||||
|
||||
void TestTcpLogger() {
|
||||
printf("Stability Logger Tests...\n");
|
||||
TcpLogger logger;
|
||||
ConfigurationDatabase config;
|
||||
config.Write("Port", (uint32)0); // Random port
|
||||
assert(logger.Initialise(config));
|
||||
}
|
||||
|
||||
class DebugServiceTest {
|
||||
public:
|
||||
static void TestAll() {
|
||||
printf("Stability Logic Tests...\n");
|
||||
ObjectRegistryDatabase::Instance()->Purge();
|
||||
|
||||
DebugService service;
|
||||
assert(service.traceBuffer.Init(1024 * 1024));
|
||||
@@ -40,65 +43,50 @@ public:
|
||||
assert(service.ForceSignal("Z", "123") == 1);
|
||||
|
||||
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1000000.0);
|
||||
service.ProcessSignal(&service.signals[0], 4, ts);
|
||||
service.ProcessSignal(service.signals[0], 4, ts);
|
||||
assert(val == 123);
|
||||
service.UnforceSignal("Z");
|
||||
|
||||
// 2. Commands
|
||||
service.HandleCommand("TREE", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("DISCOVER", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("CONFIG", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("PAUSE", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("RESUME", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("LS /", NULL_PTR(BasicTCPSocket*));
|
||||
service.HandleCommand("INFO X.Y.Z", NULL_PTR(BasicTCPSocket*));
|
||||
|
||||
// 3. Broker Active Status
|
||||
volatile bool active = false;
|
||||
Vector<uint32> indices;
|
||||
Vector<uint32> sizes;
|
||||
Vec<uint32> indices;
|
||||
Vec<uint32> sizes;
|
||||
FastPollingMutexSem mutex;
|
||||
DebugSignalInfo* ptrs[1] = { &service.signals[0] };
|
||||
DebugSignalInfo* ptrs[1] = { service.signals[0] };
|
||||
service.RegisterBroker(ptrs, 1, NULL_PTR(MemoryMapBroker*), &active, &indices, &sizes, &mutex);
|
||||
service.UpdateBrokersActiveStatus();
|
||||
assert(active == true);
|
||||
assert(indices.Size() == 1);
|
||||
assert(indices[0] == 0);
|
||||
|
||||
// Helper Process
|
||||
DebugBrokerHelper::Process(&service, ptrs, indices, sizes, mutex);
|
||||
|
||||
// 4. Object Hierarchy branches
|
||||
service.HandleCommand("INFO X.Y.Z", NULL_PTR(BasicTCPSocket*));
|
||||
|
||||
StreamString fullPath;
|
||||
DebugService::GetFullObjectName(service, fullPath);
|
||||
}
|
||||
};
|
||||
|
||||
void TestTcpLogger() {
|
||||
printf("Stability Logger Tests...\n");
|
||||
TcpLogger logger;
|
||||
ConfigurationDatabase cfg;
|
||||
cfg.Write("Port", (uint16)0);
|
||||
if (logger.Initialise(cfg)) {
|
||||
REPORT_ERROR_STATIC(ErrorManagement::Information, "Coverage Log Entry");
|
||||
logger.ConsumeLogMessage(NULL_PTR(LoggerPage*));
|
||||
}
|
||||
}
|
||||
|
||||
void TestRingBuffer() {
|
||||
printf("Stability RingBuffer Tests...\n");
|
||||
TraceRingBuffer rb;
|
||||
rb.Init(1024);
|
||||
uint32 val = 0;
|
||||
rb.Push(1, 100, &val, 4);
|
||||
uint32 id, size; uint64 ts;
|
||||
rb.Pop(id, ts, &val, size, 4);
|
||||
#include <signal.h>
|
||||
|
||||
void timeout_handler(int sig) {
|
||||
printf("Test timed out!\n");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main() {
|
||||
signal(SIGALRM, timeout_handler);
|
||||
alarm(10);
|
||||
printf("--- MARTe2 Debug Suite COVERAGE V29 ---\n");
|
||||
MARTe::TestTcpLogger();
|
||||
// MARTe::TestRingBuffer(); // Fixed previously, but let's keep it clean
|
||||
MARTe::DebugServiceTest::TestAll();
|
||||
printf("\nCOVERAGE V29 PASSED!\n");
|
||||
return 0;
|
||||
Reference in New Issue
Block a user