Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 42 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,48 @@ jobs:
run: |
cmake --build build --config Release -- -j$(nproc)

# If you use CTest (add_test in CMake), you can enable this step.
# - name: Run CTest
# run: |
# cd build
# ctest --output-on-failure

- name: Run test_ipc_crash
- name: Run IPC Crash Recovery Test
run: |
chmod +x build/test_ipc_crash || true
./build/test_ipc_crash

- name: Start Gateway in Background
run: |
chmod +x build/Gateway || true
./build/Gateway &
GATEWAY_PID=$!
echo "GATEWAY_PID=$GATEWAY_PID" >> $GITHUB_ENV
# Wait for gateway to start listening
sleep 2

- name: Run Gateway Network Tests
run: |
chmod +x build/test_gateway || true
./build/test_gateway
TEST_RESULT=$?
exit $TEST_RESULT

- name: Cleanup Gateway Process
if: always()
run: |
if [ ! -z "$GATEWAY_PID" ]; then
kill $GATEWAY_PID || true
wait $GATEWAY_PID 2>/dev/null || true
fi
# Kill any remaining Gateway processes
pkill -f "./build/Gateway" || true

- name: Run CTest (Optional)
if: false # Disabled for now, enable if you want to use CTest
run: |
cd build
ctest --output-on-failure

- name: Upload Test Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: |
build/Testing/Temporary/
*.log
61 changes: 0 additions & 61 deletions .github/workflows/ipc-tests.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
.vscode
.vscode
*.log
27 changes: 22 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ set(IPC_SOURCES
common/ipc/SharedMemory_Consumer.cpp
)

# Process 1 executable
add_executable(process1 process1/main.cpp ${IPC_SOURCES})
target_include_directories(process1 PRIVATE ${CMAKE_SOURCE_DIR}/common)
target_include_directories(process1 PRIVATE ${CMAKE_SOURCE_DIR}/common/ipc)
target_include_directories(process1 PRIVATE ${CMAKE_SOURCE_DIR}/common/Logger)
# Process 1 executable (Gateway)
add_executable(Gateway Gateway/main.cpp ${IPC_SOURCES})
target_include_directories(Gateway PRIVATE ${CMAKE_SOURCE_DIR}/common)
target_include_directories(Gateway PRIVATE ${CMAKE_SOURCE_DIR}/common/ipc)
target_include_directories(Gateway PRIVATE ${CMAKE_SOURCE_DIR}/common/Logger)
target_link_libraries(Gateway pthread)

# Process 2 executable
add_executable(process2 process2/main.cpp ${IPC_SOURCES})
Expand All @@ -30,3 +31,19 @@ target_include_directories(process2 PRIVATE ${CMAKE_SOURCE_DIR}/common/Logger)
add_executable(test_ipc_crash tests/test_ipc_crash.cpp ${IPC_SOURCES})
target_include_directories(test_ipc_crash PRIVATE ${CMAKE_SOURCE_DIR}/common)
target_include_directories(test_ipc_crash PRIVATE ${CMAKE_SOURCE_DIR}/common/ipc)

# Test executable - Gateway Network and FIX Protocol Test
add_executable(test_gateway tests/test_gateway.cpp)
target_include_directories(test_gateway PRIVATE ${CMAKE_SOURCE_DIR}/common)
target_include_directories(test_gateway PRIVATE ${CMAKE_SOURCE_DIR}/common/Logger)

# Enable testing
enable_testing()

# Add tests to CTest
add_test(NAME IPC_Crash_Recovery COMMAND test_ipc_crash)
add_test(NAME Gateway_Network_Tests COMMAND test_gateway)

# Set test properties
set_tests_properties(IPC_Crash_Recovery PROPERTIES TIMEOUT 30)
set_tests_properties(Gateway_Network_Tests PROPERTIES TIMEOUT 60)
Loading