Skip to content

Commit

Permalink
Merge pull request #318 from odin-detector/code-ci
Browse files Browse the repository at this point in the history
Update Code CI
  • Loading branch information
GDYendell authored Aug 7, 2023
2 parents 551ca96 + 6fb3185 commit 5101f82
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Test odin-data

name: Code CI
on: [push, pull_request]

env:
INSTALL_PREFIX: ${{ github.workspace }}/../install
INSTALL_PREFIX: ${{ github.workspace }}/prefix

jobs:
test:
Expand All @@ -27,26 +26,23 @@ jobs:
mkdir -p $INSTALL_PREFIX
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ../cpp
make install VERBOSE=1
make -j8 VERBOSE=1 && make install VERBOSE=1
ls -la $INSTALL_PREFIX
- name: Run frame receiver unit tests
env:
INSTALL_PREFIX: ${{ env.INSTALL_PREFIX }}
run: |
cd build
bin/frameReceiverTest
$INSTALL_PREFIX/bin/frameReceiverTest --log_level=test_suite
- name: Run frame processor unit tests
env:
INSTALL_PREFIX: ${{ env.INSTALL_PREFIX }}
run: |
cd build
bin/frameProcessorTest
$INSTALL_PREFIX/bin/frameProcessorTest --log_level=test_suite
- name: Run odin-data frame integration test
env:
INSTALL_PREFIX: ${{ env.INSTALL_PREFIX }}
run: |
cd build
bin/odinDataTest --json=$INSTALL_PREFIX/test_config/dummyUDP.json
$INSTALL_PREFIX/bin/odinDataTest --json=$INSTALL_PREFIX/test_config/dummyUDP.json
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
19 changes: 2 additions & 17 deletions cpp/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
set(TEST_CONFIGS
fp_log4cxx.xml
fr_log4cxx.xml
)

foreach(test_config ${TEST_CONFIGS})
add_custom_command(
OUTPUT "${CMAKE_CONFIG_OUTPUT_DIRECTORY}/${test_config}"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/${test_config}"
"${CMAKE_CONFIG_OUTPUT_DIRECTORY}/${test_config}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${test_config}"
)
list(APPEND TEST_CONFIGS_DEST "${CMAKE_CONFIG_OUTPUT_DIRECTORY}/${test_config}")
endforeach(test_config)

add_custom_target(CopyTestConfigs ALL DEPENDS ${TEST_CONFIGS_DEST} )
file(GLOB LOG_CONFIGS ${CMAKE_CURRENT_SOURCE_DIR}/*log4cxx.xml)
install(PROGRAMS ${LOG_CONFIGS} DESTINATION test_config)

add_subdirectory(client_msgs)
2 changes: 1 addition & 1 deletion cpp/frameProcessor/src/DataBlockPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ void DataBlockPool::tearDownClass()
std::map<size_t , DataBlockPool*>::iterator it;
for (it = instance_map_.begin(); it != instance_map_.end(); it++) {
delete it->second;
instance_map_.erase(it);
}
instance_map_.clear();
}

} /* namespace FrameProcessor */
2 changes: 1 addition & 1 deletion cpp/frameProcessor/src/FrameProcessorController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,8 @@ void FrameProcessorController::shutdown() {
for (it = plugins_.begin(); it != plugins_.end(); it++) {
LOG4CXX_DEBUG_LEVEL(1, logger_, "Removing " << it->first);
while(it->second->isWorking());
plugins_.erase(it);
}
plugins_.clear();

// Stop worker thread (for IFrameCallback) and reactor
LOG4CXX_DEBUG_LEVEL(1, logger_, "Stopping FrameProcessorController worker thread and IPCReactor");
Expand Down
7 changes: 6 additions & 1 deletion cpp/frameProcessor/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ ADD_DEFINITIONS(-DBUILD_DIR="${CMAKE_BINARY_DIR}")
include_directories(${FRAMEPROCESSOR_DIR}/include ${HDF5_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${LOG4CXX_INCLUDE_DIRS}/.. ${ZEROMQ_INCLUDE_DIRS})
add_definitions(${HDF5_DEFINITIONS})

file(GLOB TEST_SOURCES FrameProcessorUnitTestMain.cpp FrameProcessorTest.cpp GapFillPluginTest.cpp)
file(GLOB TEST_SOURCES
FrameProcessorUnitTestMain.cpp
FrameProcessorTest.cpp
GapFillPluginTest.cpp
MetaMessageTest.cpp
)
# Add tests for BloscPlugin if Blosc is present
if (${BLOSC_FOUND})
list(APPEND TEST_SOURCES BloscPluginTest.cpp)
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions cpp/frameReceiver/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ if ( ${CMAKE_SYSTEM_NAME} MATCHES Linux )
target_link_libraries(frameReceiverTest ${PTHREAD_LIBRARY} ${REALTIME_LIBRARY})
endif()

install(TARGETS frameReceiverTest RUNTIME DESTINATION bin)
2 changes: 0 additions & 2 deletions cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ namespace FrameSimulator {

};

REGISTER(FrameSimulatorPlugin, DummyUDPFrameSimulatorPlugin, "DummyUDPFrameSimulatorPlugin");

}

#endif //FRAMESIMULATOR_DUMMYUDPSIMULATORPLUGIN_H
2 changes: 1 addition & 1 deletion cpp/frameSimulator/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ add_executable(frameSimulator ${APP_SOURCES} FrameSimulatorApp.cpp)

target_link_libraries(frameSimulator ${LIB_PROCESSOR} ${Boost_LIBRARIES} ${LOG4CXX_LIBRARIES} ${PCAP_LIBRARY} ${COMMON_LIBRARY})

file(GLOB DUMMY_LIB_SOURCES DummyUDPFrameSimulatorPlugin.cpp DummyUDPFrame.cpp)
file(GLOB DUMMY_LIB_SOURCES DummyUDPFrameSimulatorPlugin.cpp DummyUDPFrame.cpp DummyUDPFrameSimulatorPluginLib.cpp)

# Add library for DummyUDP plugin
add_library(DummyUDPFrameSimulatorPlugin SHARED ${DUMMY_LIB_SOURCES})
Expand Down
19 changes: 19 additions & 0 deletions cpp/frameSimulator/src/DummyUDPFrameSimulatorPluginLib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* DummyUDPFrameSimulatorPluginLib.cpp
*
* Created on: 19 Sep 2022
* Author: Gary Yendell
*/

#include "DummyUDPFrameSimulatorPlugin.h"
#include "ClassLoader.h"

namespace FrameSimulator
{
/**
* Registration of this decoder through the ClassLoader. This macro
* registers the class without needing to worry about name mangling
*/
REGISTER(FrameSimulatorPlugin, DummyUDPFrameSimulatorPlugin, "DummyUDPFrameSimulatorPlugin");

}
4 changes: 2 additions & 2 deletions cpp/test/integrationTest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ dest-ip=127.0.0.1
ports=61649
interval=1
[Receiver-args]
json_file=/scratch/odin-data/configs/excalibur-fr.json
config=/scratch/odin-data/configs/excalibur-fr.json
m=500000000
[Processor-args]
json_file=/scratch/odin-data/configs/excalibur-fp.json
config=/scratch/odin-data/configs/excalibur-fp.json
```

Launches:
Expand Down
13 changes: 9 additions & 4 deletions cpp/test/integrationTest/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
install(FILES dummyUDP.json DESTINATION test_config)
install(FILES dummyUDP-fp.json DESTINATION test_config)
install(FILES dummyUDP-fr.json DESTINATION test_config)
install(FILES testUDP.json DESTINATION test_config)
# Copy files to build and substitute macros
configure_file(dummyUDP.json .)
configure_file(dummyUDP-fp.json .)
configure_file(dummyUDP-fr.json .)
configure_file(testUDP.json .)

# Install files generated in build by above commands, *not* directly from source
file(GLOB CONFIG_FILES ${CMAKE_CURRENT_BINARY_DIR}/*json)
install(FILES ${CONFIG_FILES} DESTINATION test_config)
143 changes: 66 additions & 77 deletions cpp/test/integrationTest/config/dummyUDP-fp.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,77 @@
[
{
"fr_setup":
{
"fr_ready_cnxn":"tcp://127.0.0.1:5001",
"fr_release_cnxn":"tcp://127.0.0.1:5002"
"fr_setup": {
"fr_ready_cnxn": "tcp://127.0.0.1:5001",
"fr_release_cnxn": "tcp://127.0.0.1:5002"
},
"meta_endpoint": "tcp://*:5008",
"frames": 10
},
"meta_endpoint":"tcp://*:5008"
},

{
"plugin":
{
"load":
{
"index":"hdf",
"name":"FileWriterPlugin",
"library":"${INSTALL_PREFIX}/lib/libHdf5Plugin.so"
}
}
},
{
"plugin":
"plugin": {
"load": {
"index": "hdf",
"name": "FileWriterPlugin",
"library": "${CMAKE_INSTALL_PREFIX}/lib/libHdf5Plugin.so"
}
}
},
{
"load":
{
"index":"dummy",
"name":"DummyUDPProcessPlugin",
"library":"${INSTALL_PREFIX}/lib/libDummyUDPProcessPlugin.so"
}
}
},
{
"plugin":
"plugin": {
"load": {
"index": "dummy",
"name": "DummyUDPProcessPlugin",
"library": "${CMAKE_INSTALL_PREFIX}/lib/libDummyUDPProcessPlugin.so"
}
}
},
{
"connect":
{
"index":"dummy",
"connection":"frame_receiver"
}
}
},
{
"plugin":
"plugin": {
"connect": {
"index": "dummy",
"connection": "frame_receiver"
}
}
},
{
"connect":
{
"index":"hdf",
"connection":"dummy"
}
}
},
{
"dummy": {
"width": 1024,
"height": 1400
}
},

{
"hdf":
"plugin": {
"connect": {
"index": "hdf",
"connection": "dummy"
}
}
},
{
"dataset":"dummy"
}
},
{
"hdf":
"dummy": {
"width": 1024,
"height": 1400
}
},
{
"hdf": {
"dataset": "dummy"
}
},
{
"dataset":
{
"dummy":
{
"datatype":"uint16",
"dims":[1400,1024],
"compression":"none"
"hdf": {
"dataset": {
"dummy": {
"datatype": "uint16",
"dims": [
1400,
1024
],
"compression": "none"
}
},
"file": {
"path": "/tmp",
"first_number": 1
},
"frames": 10,
"acquisition_id": "test_1",
"timeout_timer_period": 3000,
"write": true
}
},
"file":
{
"path":"",
"first_number":1
},
"frames":10,
"acquisition_id":"test_1",
"write":true
}
}
]
]
9 changes: 5 additions & 4 deletions cpp/test/integrationTest/config/dummyUDP-fr.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[
{
"decoder_type": "DummyUDP",
"decoder_path": "${INSTALL_PREFIX}/lib",
"decoder_path": "${CMAKE_INSTALL_PREFIX}/lib",
"rx_ports": "61649",
"max_buffer_mem": 840000000,
"decoder_config": {
"enable_packet_logging": false,
"frame_timeout_ms": 1000,
"udp_packets_per_frame": 263,
"udp_packets_per_frame": 359,
"udp_packet_size": 8000
}
},
"frames": 10
}
]
]
Loading

0 comments on commit 5101f82

Please sign in to comment.