Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI coverage #300

Merged
merged 15 commits into from
May 2, 2024
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
56 changes: 50 additions & 6 deletions .github/workflows/ccpp-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,58 @@ on:
branches: [ master ]

jobs:
JTest_job:

jana2_env_everything_except_cuda:
name: Build JANA2 with all dependencies except CUDA
runs-on: ubuntu-latest
name: Full build with tests
container:
image: nbrei/jana2_env_everything_except_cuda

# Build Docker container and run the entrypoint.sh script in it
steps:
- name: Build and run
id: build_and_run
uses: nathanwbrei/[email protected]

- uses: actions/checkout@v4

- name: cmake
run: |
mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
cmake ../ -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/Linux \
-DUSE_PYTHON=ON \
-DUSE_ROOT=ON \
-DUSE_PODIO=ON \
-DUSE_XERCES=ON \
-DXercesC_DIR=/usr \
-DUSE_ZEROMQ=ON \
-Dpodio_DIR=/app/podio/install/lib/cmake/podio/
- name: make
run: |
cd $GITHUB_WORKSPACE/build
make
- name: make install
run: |
cd $GITHUB_WORKSPACE/build
make install
- name: JTest
run: |
echo "--- Running JTest plugin -----------------------"
export JANA_PLUGIN_PATH=$GITHUB_WORKSPACE/Linux/plugins
$GITHUB_WORKSPACE/Linux/bin/jana -PPLUGINS=JTest -Pjana:nevents=100
- name: jana-unit-tests
run: |
echo "--- Running jana-unit-tests ------------------------------"
export JANA_PLUGIN_PATH=$GITHUB_WORKSPACE/Linux/plugins
$GITHUB_WORKSPACE/Linux/bin/jana-unit-tests
- name: TimesliceExample with simple (physics event) topology
run: |
echo "--- Running TimesliceExample with simple topology ------------------------------"
export JANA_PLUGIN_PATH=$GITHUB_WORKSPACE/Linux/plugins
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/Linux/lib:/app/podio/install/lib:$LD_LIBRARY_PATH
$GITHUB_WORKSPACE/Linux/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=100 events.root
- name: TimesliceExample with complex (timeslice) topology
run: |
echo "--- Running TimesliceExample with complex topology ------------------------------"
export JANA_PLUGIN_PATH=$GITHUB_WORKSPACE/Linux/plugins
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/Linux/lib:/app/podio/install/lib:$LD_LIBRARY_PATH
$GITHUB_WORKSPACE/Linux/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=100 timeslices.root


1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ message(STATUS "-----------------------")
#---------

include_directories(src/libraries) # So that everyone can find the JANA header files
include_directories(src/external) # So that everyone can find our vendorized header-old libraries

# This is needed on macos to allow plugins to link without resolving all JANA symbols until runtime
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down
33 changes: 33 additions & 0 deletions containers/Docker/everything_except_cuda.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

# Docker image for testing JANA with all options enabled except CUDA

FROM rootproject/root:latest
# This is an Ubuntu >= 22.04

USER root
RUN mkdir /app
WORKDIR /app

RUN apt update -y \
&& apt install -y build-essential gdb valgrind cmake wget unzip vim libasan6 less exa bat git zlib1g-dev pip \
python3-dev python3-zmq libczmq-dev libxerces-c-dev libx11-dev libxpm-dev libxft-dev libxext-dev \
libyaml-dev python3-jinja2 python3-yaml libz3-dev


RUN git clone -b v00-99 https://github.com/AIDASoft/podio /app/podio

RUN cd /app/podio \
&& mkdir build install \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=../install -DUSE_EXTERNAL_CATCH2=OFF .. \
&& make -j4 install

ENV JANA_HOME /app/JANA2/install

# RUN cd /app/JANA2 \
# && mkdir build install \
# && cmake -S . -B build \
# && cmake --build build -j 10 --target install

CMD bash

4 changes: 2 additions & 2 deletions scripts/jana-generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def create_root_eventprocessor(processor_name, dir_name):
def build_plugin_test(plugin_name, copy_catch_hpp=True, dir="."):

if copy_catch_hpp:
files_to_copy = {"catch.hpp": {"sourcedir": "src/programs/tests",
files_to_copy = {"catch.hpp": {"sourcedir": "src/external",
"installdir": "include/external",
"destname": dir+"/catch.hpp"}}
copy_from_source_dir(files_to_copy)
Expand All @@ -959,7 +959,7 @@ def build_plugin_test(plugin_name, copy_catch_hpp=True, dir="."):
def build_jeventprocessor_test(processor_name, is_mini=True, copy_catch_hpp=True, dir="."):

if copy_catch_hpp:
files_to_copy = {"catch.hpp": {"sourcedir": "src/programs/tests",
files_to_copy = {"catch.hpp": {"sourcedir": "src/external",
"installdir": "include/external",
"destname": dir+"/catch.hpp"}}
copy_from_source_dir(files_to_copy)
Expand Down
2 changes: 2 additions & 0 deletions src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ add_subdirectory(SubeventCUDAExample)
add_subdirectory(UnitTestingExample)
add_subdirectory(PodioExample)
add_subdirectory(TimesliceExample)
add_subdirectory(RootDatamodelExample)
add_subdirectory(InteractiveStreamingExample)
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ if (${USE_ROOT} AND ${USE_ZEROMQ})
find_package(ROOT REQUIRED)

set(STREAMDET_SOURCES
InteractiveStreamingExample.cc
MonitoringProcessor.cc
MonitoringProcessor.h
RootProcessor.cc
RootProcessor.h
DecodeDASSource.cc
DecodeDASSource.h
JFactoryGenerator_streamDet.h
streamDet.cc
ZmqTransport.h
INDRAMessage.h
ADCSample.h
Expand All @@ -29,5 +29,5 @@ if (${USE_ROOT} AND ${USE_ZEROMQ})
install(FILES ${my_headers} DESTINATION include/streamDet)

else()
message(STATUS "Skipping plugins/streamDet because USE_ROOT=Off or USE_ZEROMQ=Off")
message(STATUS "Skipping examples/InteractiveStreamingExample because USE_ROOT=Off or USE_ZEROMQ=Off")
endif()
2 changes: 2 additions & 0 deletions src/examples/PodioExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ if (USE_PODIO)
set_target_properties(PodioExample PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)

install(TARGETS PodioExample DESTINATION bin)
install(TARGETS PodioExampleDatamodel DESTINATION lib)
install(TARGETS PodioExampleDatamodelDict DESTINATION lib)
else()
message(STATUS "Skipping examples/PodioExample because USE_PODIO=Off")

Expand Down
20 changes: 10 additions & 10 deletions src/examples/PodioExample/PodioExample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

void create_hits_file() {

EventInfo eventinfo1(7, 0, 22);
MutableEventInfo eventinfo1(7, 0, 22);
EventInfoCollection eventinfos1;
eventinfos1.push_back(eventinfo1);

ExampleHitCollection hits1;
hits1.push_back(ExampleHit(22, -1, -1, 0, 100, 0));
hits1.push_back(ExampleHit(49, 1, 1, 0, 15.5, 0));
hits1.push_back(ExampleHit(47, 1, 2, 0, 0.5, 0));
hits1.push_back(ExampleHit(42, 2, 1, 0, 4.0, 0));
hits1.push_back(MutableExampleHit(22, -1, -1, 0, 100, 0));
hits1.push_back(MutableExampleHit(49, 1, 1, 0, 15.5, 0));
hits1.push_back(MutableExampleHit(47, 1, 2, 0, 0.5, 0));
hits1.push_back(MutableExampleHit(42, 2, 1, 0, 4.0, 0));

podio::Frame event1;
event1.put(std::move(hits1), "hits");
Expand All @@ -38,15 +38,15 @@ void create_hits_file() {
podio::ROOTFrameWriter writer("hits.root");
writer.writeFrame(event1, "events");

EventInfo eventinfo2(8, 0, 22);
MutableEventInfo eventinfo2(8, 0, 22);
EventInfoCollection eventinfos2;
eventinfos2.push_back(eventinfo2);

ExampleHitCollection hits2;
hits2.push_back(ExampleHit(42, 5, -5, 5, 7.6, 0));
hits2.push_back(ExampleHit(618, -3, -5, 1, 99.9, 0));
hits2.push_back(ExampleHit(27, -10, 10, 10, 22.2, 0));
hits2.push_back(ExampleHit(28, -9, 11, 10, 7.8, 0));
hits2.push_back(MutableExampleHit(42, 5, -5, 5, 7.6, 0));
hits2.push_back(MutableExampleHit(618, -3, -5, 1, 99.9, 0));
hits2.push_back(MutableExampleHit(27, -10, 10, 10, 22.2, 0));
hits2.push_back(MutableExampleHit(28, -9, 11, 10, 7.8, 0));

podio::Frame event2;
event2.put(std::move(hits2), "hits");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ if(${USE_ROOT})
list(APPEND my_pcms ${CMAKE_CURRENT_BINARY_DIR}/lib${CLASS}_rdict.pcm )
endforeach()

set (JTestRoot_PLUGIN_SOURCES
JTestRoot.cc
set (RootDatamodelExample_PLUGIN_SOURCES
RootDatamodelExample.cc
JTestRootEventSource.cc
JTestRootEventSource.h
JFactory_Cluster.cc
Expand All @@ -33,21 +33,21 @@ if(${USE_ROOT})
G__Cluster.cxx
)

add_library(JTestRoot_plugin SHARED ${JTestRoot_PLUGIN_SOURCES})
target_compile_definitions(JTestRoot_plugin PUBLIC JANA2_HAVE_ROOT)
target_include_directories(JTestRoot_plugin PUBLIC ${JANA_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS})
target_link_libraries(JTestRoot_plugin jana2)
target_link_libraries(JTestRoot_plugin ${ROOT_LIBRARIES})
set_target_properties(JTestRoot_plugin PROPERTIES PREFIX "" OUTPUT_NAME "JTestRoot" SUFFIX ".so")
install(TARGETS JTestRoot_plugin DESTINATION plugins)
add_library(RootDatamodelExample_plugin SHARED ${RootDatamodelExample_PLUGIN_SOURCES})
target_compile_definitions(RootDatamodelExample_plugin PUBLIC JANA2_HAVE_ROOT)
target_include_directories(RootDatamodelExample_plugin PUBLIC ${JANA_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS})
target_link_libraries(RootDatamodelExample_plugin jana2)
target_link_libraries(RootDatamodelExample_plugin ${ROOT_LIBRARIES})
set_target_properties(RootDatamodelExample_plugin PROPERTIES PREFIX "" OUTPUT_NAME "JTestRoot" SUFFIX ".so")
install(TARGETS RootDatamodelExample_plugin DESTINATION plugins)

message(STATUS "Installing ROOT PCM files: ${my_pcms}")
install(FILES ${my_pcms} DESTINATION plugins)

file(GLOB my_headers "*.h*")
install(FILES ${my_headers} DESTINATION include/JTestRoot)
install(FILES ${my_headers} DESTINATION include/RootDatamodelExample)

else()
message(STATUS "Skipping plugins/JTestRoot because USE_ROOT=Off")
message(STATUS "Skipping plugins/RootDatamodelExample because USE_ROOT=Off")

endif() # ROOT_FOUND
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void InitPlugin(JApplication* app) {

InitJANAPlugin(app);

LOG << "Loading JTestRoot" << LOG_END;
LOG << "Loading RootDatamodelExample" << LOG_END;
app->Add(new JTestRootEventSource);
app->Add(new JTestRootProcessor);
app->Add(new JFactoryGeneratorT<JFactory_Cluster>);
Expand Down
10 changes: 5 additions & 5 deletions src/examples/TimesliceExample/MyFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ struct MyFileReader : public JEventSource {
auto hits_out = std::make_unique<ExampleHitCollection>();

// ExampleHit(unsigned long long cellID, double x, double y, double z, double energy, std::uint64_t time);
hits_out->push_back(ExampleHit(event_nr, 0, 22, 22, 22, 0));
hits_out->push_back(ExampleHit(event_nr, 0, 49, 49, 49, 1));
hits_out->push_back(ExampleHit(event_nr, 0, 7.6, 7.6, 7.6, 2));
hits_out->push_back(MutableExampleHit(event_nr, 0, 22, 22, 22, 0));
hits_out->push_back(MutableExampleHit(event_nr, 0, 49, 49, 49, 1));
hits_out->push_back(MutableExampleHit(event_nr, 0, 7.6, 7.6, 7.6, 2));

LOG_DEBUG(GetLogger()) << "MySource: Emitted " << GetLevel() << " " << event.GetEventNumber() << "\n"
<< TabulateHits(hits_out.get())
Expand All @@ -41,12 +41,12 @@ struct MyFileReader : public JEventSource {
// Furnish this event with info object
if (GetLevel() == JEventLevel::Timeslice) {
TimesliceInfoCollection info;
info.push_back(TimesliceInfo(event_nr, 0)); // event nr, run nr
info.push_back(MutableTimesliceInfo(event_nr, 0)); // event nr, run nr
event.InsertCollection<TimesliceInfo>(std::move(info), "ts_info");
}
else {
EventInfoCollection info;
info.push_back(EventInfo(event_nr, 0, 0)); // event nr, timeslice nr, run nr
info.push_back(MutableEventInfo(event_nr, 0, 0)); // event nr, timeslice nr, run nr
event.InsertCollection<EventInfo>(std::move(info), "evt_info");
}
return Result::Success;
Expand Down
2 changes: 1 addition & 1 deletion src/examples/TimesliceExample/MyTimesliceSplitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct MyTimesliceSplitter : public JEventUnfolder {
event_clusters_out->push_back(m_timeslice_clusters_in()->at(child_idx));

auto event_info_out = std::make_unique<EventInfoCollection>();
event_info_out->push_back(EventInfo(event_nr, timeslice_nr, 0));
event_info_out->push_back(MutableEventInfo(event_nr, timeslice_nr, 0));

LOG_DEBUG(GetLogger()) << "MyTimesliceSplitter: Timeslice " << parent.GetEventNumber()
<< ", Event " << child.GetEventNumber()
Expand Down
4 changes: 2 additions & 2 deletions src/examples/UnitTestingExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set (UnitTestingExample_SOURCES

add_executable(UnitTestingExample ${UnitTestingExample_SOURCES})

# Our copy of catch.hpp lives in this weird place. Maybe we should move it to ${CMAKE_SOURCE_DIR}/src/external
target_include_directories(UnitTestingExample PRIVATE ${CMAKE_SOURCE_DIR}/src/programs/unit_tests)
# Need to be able to find catch.hpp
target_include_directories(UnitTestingExample PRIVATE ${CMAKE_SOURCE_DIR}/src/external)

target_link_libraries(UnitTestingExample Tutorial_plugin jana2)
set_target_properties(UnitTestingExample PROPERTIES PREFIX "" OUTPUT_NAME "UnitTestingExample")
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions src/libraries/JANA/JEventUnfolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ class JEventUnfolder : public jana::omni::JComponent,
}
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JEventUnfolder::DoPreprocess(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = m_plugin_name;
ex.component_name = m_type_name;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JEventUnfolder::DoPreprocess()");
ex.nested_exception = std::current_exception();
Expand Down Expand Up @@ -182,6 +189,13 @@ class JEventUnfolder : public jana::omni::JComponent,
}
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JEventUnfolder::DoUnfold(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = m_plugin_name;
ex.component_name = m_type_name;
throw ex;
}
catch (...) {
auto ex = JException("Exception in JEventUnfolder::DoUnfold()");
ex.nested_exception = std::current_exception();
Expand Down
31 changes: 29 additions & 2 deletions src/libraries/JANA/JFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactoryT::Init(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::Init()");
ex.nested_exception = std::current_exception();
Expand Down Expand Up @@ -63,8 +72,17 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactory::BeginRun/ChangeRun/EndRun(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::BeginRun/ChangeRun/EndRun()");
auto ex = JException("Unknown exception in JFactory::BeginRun/ChangeRun/EndRun()");
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
Expand All @@ -82,8 +100,17 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactory::Process(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::Process()");
auto ex = JException("Unknown exception in JFactory::Process()");
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

add_subdirectory(JTest)
add_subdirectory(janacontrol)
add_subdirectory(janadot)
add_subdirectory(janarate)
add_subdirectory(janaview)
add_subdirectory(JTest)
add_subdirectory(JTestRoot)
add_subdirectory(regressiontest)
add_subdirectory(streamDet)

Loading
Loading