1 #define TRACE_NAME "CommandableFragmentGenerator_t"
3 #define BOOST_TEST_MODULE CommandableFragmentGenerator_t
4 #include <boost/test/auto_unit_test.hpp>
6 #include "artdaq-core/Data/ContainerFragment.hh"
7 #include "artdaq-core/Data/Fragment.hh"
8 #include "artdaq/DAQrate/RequestSender.hh"
9 #include "artdaq/Generators/CommandableFragmentGenerator.hh"
11 #define TRACE_REQUIRE_EQUAL(l, r) \
16 TLOG(TLVL_DEBUG) << __LINE__ << ": Checking if " << #l << " (" << l << ") equals " << #r << " (" << r << ")...YES!"; \
20 TLOG(TLVL_ERROR) << __LINE__ << ": Checking if " << #l << " (" << l << ") equals " << #r << " (" << r << ")...NO!"; \
22 BOOST_REQUIRE_EQUAL(l, r); \
25 #define MULTICAST_MODE 0
27 namespace artdaqtest {
28 class CommandableFragmentGeneratorTest;
52 bool getNext_(artdaq::FragmentPtrs& frags)
override;
63 void start()
override;
78 void pause()
override;
123 auto start_time = std::chrono::steady_clock::now();
124 while (fireCount_ > 0) { usleep(1000); }
125 TLOG(TLVL_INFO) <<
"Waited " << std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - start_time).count() <<
" us for events to be picked up by CFG";
129 std::atomic<size_t> fireCount_;
130 std::atomic<bool> hwFail_;
131 artdaq::Fragment::timestamp_t ts_;
132 std::atomic<bool> hw_stop_;
133 std::atomic<uint64_t> enabled_ids_;
137 : CommandableFragmentGenerator(ps)
144 metricMan->initialize(ps.get<fhicl::ParameterSet>(
"metrics", fhicl::ParameterSet()));
145 metricMan->do_start();
150 while (fireCount_ > 0)
153 for (
auto&
id : fragmentIDs())
155 if (
id < 64 && ((enabled_ids_ & (0x1 <<
id)) != 0))
157 TLOG(TLVL_DEBUG) <<
"Adding Fragment with ID " <<
id <<
", SeqID " << ev_counter() <<
", and timestamp " << ts_;
158 frags.emplace_back(
new artdaq::Fragment(ev_counter(),
id, artdaq::Fragment::FirstUserFragmentType, ts_));
183 BOOST_AUTO_TEST_SUITE(CommandableFragmentGenerator_t)
187 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
188 TLOG(TLVL_INFO) <<
"Simple test case BEGIN";
189 fhicl::ParameterSet ps;
190 ps.put<
int>(
"board_id", 1);
191 ps.put<
int>(
"fragment_id", 1);
193 artdaq::FragmentPtrs fps;
194 auto sts = testGen.getNext(fps);
195 TRACE_REQUIRE_EQUAL(sts,
true);
196 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
197 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
198 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
199 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
200 TLOG(TLVL_INFO) <<
"Simple test case END";
205 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
206 TLOG(TLVL_INFO) <<
"IgnoreRequests test case BEGIN";
207 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
208 const int DELAY_TIME = 1;
209 fhicl::ParameterSet ps;
210 ps.put<
int>(
"board_id", 1);
211 ps.put<
int>(
"fragment_id", 1);
212 ps.put<
int>(
"request_port", REQUEST_PORT);
214 ps.put<std::string>(
"request_address",
"227.18.12.29");
216 ps.put<std::string>(
"request_address",
"localhost");
218 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
219 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
220 ps.put<
bool>(
"separate_data_thread",
true);
221 ps.put<
bool>(
"separate_monitoring_thread",
false);
222 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
223 ps.put<std::string>(
"request_mode",
"ignored");
224 ps.put(
"request_delay_ms", DELAY_TIME);
225 ps.put(
"send_requests",
true);
234 artdaq::FragmentPtrs fps;
236 TRACE_REQUIRE_EQUAL(sts,
true);
237 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
238 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
239 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
240 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
243 TLOG(TLVL_INFO) <<
"IgnoreRequests test case END";
248 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
249 TLOG(TLVL_INFO) <<
"SingleMode test case BEGIN";
250 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
251 const int DELAY_TIME = 100;
252 fhicl::ParameterSet ps;
253 ps.put<
int>(
"board_id", 1);
254 ps.put<
int>(
"fragment_id", 1);
255 ps.put<
int>(
"request_port", REQUEST_PORT);
257 ps.put<std::string>(
"request_address",
"227.18.12.30");
259 ps.put<std::string>(
"request_address",
"localhost");
261 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
262 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
263 ps.put<
bool>(
"separate_data_thread",
true);
264 ps.put<
bool>(
"separate_monitoring_thread",
false);
265 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
266 ps.put<std::string>(
"request_mode",
"single");
267 ps.put(
"request_delay_ms", DELAY_TIME);
268 ps.put(
"send_requests",
true);
282 artdaq::FragmentPtrs fps;
284 auto type = artdaq::Fragment::FirstUserFragmentType;
285 TRACE_REQUIRE_EQUAL(sts,
true);
286 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
287 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
288 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
289 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
290 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
297 TRACE_REQUIRE_EQUAL(sts,
true);
298 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
299 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
300 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
301 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
302 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
312 TRACE_REQUIRE_EQUAL(sts,
true);
313 TRACE_REQUIRE_EQUAL(fps.size(), 2);
314 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
315 auto ts = artdaq::Fragment::InvalidTimestamp;
316 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
317 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
318 auto emptyType = artdaq::Fragment::EmptyFragmentType;
319 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
321 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
322 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
323 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
324 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
329 TLOG(TLVL_INFO) <<
"SingleMode test case END";
334 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
335 TLOG(TLVL_INFO) <<
"BufferMode test case BEGIN";
336 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
337 const int DELAY_TIME = 100;
338 fhicl::ParameterSet ps;
339 ps.put<
int>(
"board_id", 1);
340 ps.put<
int>(
"fragment_id", 1);
341 ps.put<
int>(
"request_port", REQUEST_PORT);
343 ps.put<std::string>(
"request_address",
"227.18.12.31");
345 ps.put<std::string>(
"request_address",
"localhost");
347 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
348 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
349 ps.put<
bool>(
"separate_data_thread",
true);
350 ps.put<
bool>(
"separate_monitoring_thread",
false);
351 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
352 ps.put<std::string>(
"request_mode",
"buffer");
353 ps.put(
"request_delay_ms", DELAY_TIME);
354 ps.put(
"send_requests",
true);
368 artdaq::FragmentPtrs fps;
370 TRACE_REQUIRE_EQUAL(sts,
true);
371 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
372 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
373 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
374 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
375 auto type = artdaq::Fragment::ContainerFragmentType;
376 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
377 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
378 auto cf = artdaq::ContainerFragment(*fps.front());
379 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
380 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
381 type = artdaq::Fragment::FirstUserFragmentType;
382 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
389 TRACE_REQUIRE_EQUAL(sts,
true);
390 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
391 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
392 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
393 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
394 type = artdaq::Fragment::ContainerFragmentType;
395 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
396 auto cf2 = artdaq::ContainerFragment(*fps.front());
397 TRACE_REQUIRE_EQUAL(cf2.block_count(), 0);
398 TRACE_REQUIRE_EQUAL(cf2.missing_data(),
false);
399 type = artdaq::Fragment::EmptyFragmentType;
400 TRACE_REQUIRE_EQUAL(cf2.fragment_type(), type);
409 TRACE_REQUIRE_EQUAL(sts,
true);
410 TRACE_REQUIRE_EQUAL(fps.size(), 2);
412 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
413 auto ts = artdaq::Fragment::InvalidTimestamp;
414 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
415 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
416 auto emptyType = artdaq::Fragment::EmptyFragmentType;
417 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
418 TRACE_REQUIRE_EQUAL(fps.front()->size(), artdaq::detail::RawFragmentHeader::num_words());
420 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
421 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
422 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
423 type = artdaq::Fragment::ContainerFragmentType;
424 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
425 auto cf3 = artdaq::ContainerFragment(*fps.front());
426 TRACE_REQUIRE_EQUAL(cf3.block_count(), 2);
427 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
428 type = artdaq::Fragment::FirstUserFragmentType;
429 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
436 TLOG(TLVL_INFO) <<
"BufferMode test case END";
441 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
442 TLOG(TLVL_INFO) <<
"BufferMode_KeepLatest test case BEGIN";
443 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
444 const int DELAY_TIME = 100;
445 fhicl::ParameterSet ps;
446 ps.put<
int>(
"board_id", 1);
447 ps.put<
int>(
"fragment_id", 1);
448 ps.put<
int>(
"request_port", REQUEST_PORT);
450 ps.put<std::string>(
"request_address",
"227.18.12.31");
452 ps.put<std::string>(
"request_address",
"localhost");
454 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
455 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
456 ps.put<
bool>(
"separate_data_thread",
true);
457 ps.put<
bool>(
"separate_monitoring_thread",
false);
458 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
459 ps.put<std::string>(
"request_mode",
"buffer");
460 ps.put(
"request_delay_ms", DELAY_TIME);
461 ps.put(
"send_requests",
true);
462 ps.put(
"buffer_mode_keep_latest",
true);
476 artdaq::FragmentPtrs fps;
478 TRACE_REQUIRE_EQUAL(sts,
true);
479 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
480 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
481 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
482 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
483 auto type = artdaq::Fragment::ContainerFragmentType;
484 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
485 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
486 auto cf = artdaq::ContainerFragment(*fps.front());
487 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
488 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
489 type = artdaq::Fragment::FirstUserFragmentType;
490 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
497 TRACE_REQUIRE_EQUAL(sts,
true);
498 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
499 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
500 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
501 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
502 type = artdaq::Fragment::ContainerFragmentType;
503 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
504 auto cf2 = artdaq::ContainerFragment(*fps.front());
505 TRACE_REQUIRE_EQUAL(cf2.block_count(), 1);
506 TRACE_REQUIRE_EQUAL(cf2.missing_data(),
false);
507 type = artdaq::Fragment::FirstUserFragmentType;
508 TRACE_REQUIRE_EQUAL(cf2.fragment_type(), type);
517 TRACE_REQUIRE_EQUAL(sts,
true);
518 TRACE_REQUIRE_EQUAL(fps.size(), 2);
520 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
521 auto ts = artdaq::Fragment::InvalidTimestamp;
522 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
523 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
524 auto emptyType = artdaq::Fragment::EmptyFragmentType;
525 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
526 TRACE_REQUIRE_EQUAL(fps.front()->size(), artdaq::detail::RawFragmentHeader::num_words());
528 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
529 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
530 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
531 type = artdaq::Fragment::ContainerFragmentType;
532 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
533 auto cf3 = artdaq::ContainerFragment(*fps.front());
534 TRACE_REQUIRE_EQUAL(cf3.block_count(), 2);
535 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
536 type = artdaq::Fragment::FirstUserFragmentType;
537 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
544 TLOG(TLVL_INFO) <<
"BufferMode_KeepLatest test case END";
548 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
549 TLOG(TLVL_INFO) <<
"CircularBufferMode test case BEGIN";
550 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
551 const int DELAY_TIME = 100;
552 fhicl::ParameterSet ps;
553 ps.put<
int>(
"board_id", 1);
554 ps.put<
int>(
"fragment_id", 1);
555 ps.put<
int>(
"request_port", REQUEST_PORT);
557 ps.put<std::string>(
"request_address",
"227.18.12.31");
559 ps.put<std::string>(
"request_address",
"localhost");
561 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
562 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
563 ps.put<
bool>(
"separate_data_thread",
true);
564 ps.put<
bool>(
"circular_buffer_mode",
true);
565 ps.put<
int>(
"data_buffer_depth_fragments", 3);
566 ps.put<
bool>(
"separate_monitoring_thread",
false);
567 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
568 ps.put<std::string>(
"request_mode",
"buffer");
569 ps.put(
"request_delay_ms", DELAY_TIME);
570 ps.put(
"send_requests",
true);
584 artdaq::FragmentPtrs fps;
586 TRACE_REQUIRE_EQUAL(sts,
true);
587 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
588 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
589 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
590 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
591 auto type = artdaq::Fragment::ContainerFragmentType;
592 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
593 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
594 auto cf = artdaq::ContainerFragment(*fps.front());
595 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
596 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
597 type = artdaq::Fragment::FirstUserFragmentType;
598 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
605 TRACE_REQUIRE_EQUAL(sts,
true);
606 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
607 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
608 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
609 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
610 type = artdaq::Fragment::ContainerFragmentType;
611 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
612 auto cf2 = artdaq::ContainerFragment(*fps.front());
613 TRACE_REQUIRE_EQUAL(cf2.block_count(), 0);
614 TRACE_REQUIRE_EQUAL(cf2.missing_data(),
false);
615 type = artdaq::Fragment::EmptyFragmentType;
616 TRACE_REQUIRE_EQUAL(cf2.fragment_type(), type);
625 TRACE_REQUIRE_EQUAL(sts,
true);
626 TRACE_REQUIRE_EQUAL(fps.size(), 2);
628 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
629 auto ts = artdaq::Fragment::InvalidTimestamp;
630 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
631 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
632 auto emptyType = artdaq::Fragment::EmptyFragmentType;
633 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
634 TRACE_REQUIRE_EQUAL(fps.front()->size(), artdaq::detail::RawFragmentHeader::num_words());
636 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
637 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
638 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
639 type = artdaq::Fragment::ContainerFragmentType;
640 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
641 auto cf3 = artdaq::ContainerFragment(*fps.front());
642 TRACE_REQUIRE_EQUAL(cf3.block_count(), 3);
643 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
644 type = artdaq::Fragment::FirstUserFragmentType;
645 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
654 TRACE_REQUIRE_EQUAL(sts,
true);
655 TRACE_REQUIRE_EQUAL(fps.size(), 1);
657 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
658 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 8);
659 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
660 type = artdaq::Fragment::ContainerFragmentType;
661 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
662 auto cf4 = artdaq::ContainerFragment(*fps.front());
663 TRACE_REQUIRE_EQUAL(cf4.block_count(), 3);
664 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
false);
665 type = artdaq::Fragment::FirstUserFragmentType;
666 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
667 TRACE_REQUIRE_EQUAL(cf4.at(0)->timestamp(), 7);
668 TRACE_REQUIRE_EQUAL(cf4.at(1)->timestamp(), 8);
669 TRACE_REQUIRE_EQUAL(cf4.at(2)->timestamp(), 9);
676 TLOG(TLVL_INFO) <<
"CircularBufferMode test case END";
681 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
682 TLOG(TLVL_INFO) <<
"WindowMode_Function test case BEGIN";
683 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
684 const int DELAY_TIME = 100;
685 fhicl::ParameterSet ps;
686 ps.put<
int>(
"board_id", 1);
687 ps.put<
int>(
"fragment_id", 1);
688 ps.put<
int>(
"request_port", REQUEST_PORT);
690 ps.put<std::string>(
"request_address",
"227.18.12.32");
692 ps.put<std::string>(
"request_address",
"localhost");
694 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
695 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
696 ps.put<
bool>(
"separate_data_thread",
true);
697 ps.put<
bool>(
"separate_monitoring_thread",
false);
698 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
699 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
700 ps.put<
bool>(
"circular_buffer_mode",
true);
701 ps.put<std::string>(
"request_mode",
"window");
702 ps.put<
size_t>(
"missing_request_window_timeout_us", 500000);
703 ps.put<
size_t>(
"window_close_timeout_us", 500000);
704 ps.put(
"request_delay_ms", DELAY_TIME);
705 ps.put(
"send_requests",
true);
719 artdaq::FragmentPtrs fps;
722 TRACE_REQUIRE_EQUAL(sts,
true);
723 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
724 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
725 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
726 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
727 auto type = artdaq::Fragment::ContainerFragmentType;
728 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
729 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
730 auto cf = artdaq::ContainerFragment(*fps.front());
731 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
732 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
733 type = artdaq::Fragment::FirstUserFragmentType;
734 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
742 TRACE_REQUIRE_EQUAL(sts,
true);
743 TRACE_REQUIRE_EQUAL(fps.size(), 0);
749 TRACE_REQUIRE_EQUAL(sts,
true);
750 TRACE_REQUIRE_EQUAL(fps.size(), 1);
751 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
752 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 2);
753 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
754 type = artdaq::Fragment::ContainerFragmentType;
755 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
756 auto cf2 = artdaq::ContainerFragment(*fps.front());
757 TRACE_REQUIRE_EQUAL(cf2.block_count(), 1);
758 TRACE_REQUIRE_EQUAL(cf2.missing_data(),
false);
759 type = artdaq::Fragment::FirstUserFragmentType;
760 TRACE_REQUIRE_EQUAL(cf2.fragment_type(), type);
767 TRACE_REQUIRE_EQUAL(sts,
true);
768 TRACE_REQUIRE_EQUAL(fps.size(), 0);
773 TRACE_REQUIRE_EQUAL(sts,
true);
774 TRACE_REQUIRE_EQUAL(fps.size(), 1);
778 TRACE_REQUIRE_EQUAL(list.size(), 1);
779 TRACE_REQUIRE_EQUAL(list.begin()->first, 4);
784 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
785 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 3);
786 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
787 type = artdaq::Fragment::ContainerFragmentType;
788 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
789 auto cf3 = artdaq::ContainerFragment(*fps.front());
790 TRACE_REQUIRE_EQUAL(cf3.block_count(), 0);
791 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
true);
792 type = artdaq::Fragment::EmptyFragmentType;
793 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
803 TRACE_REQUIRE_EQUAL(list.size(), 1);
807 TRACE_REQUIRE_EQUAL(list.size(), 0);
808 TRACE_REQUIRE_EQUAL(sts,
true);
809 TRACE_REQUIRE_EQUAL(fps.size(), 1);
810 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
811 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 4);
812 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
813 type = artdaq::Fragment::ContainerFragmentType;
814 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
815 auto cf4 = artdaq::ContainerFragment(*fps.front());
816 TRACE_REQUIRE_EQUAL(cf4.block_count(), 0);
817 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
818 type = artdaq::Fragment::EmptyFragmentType;
819 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
826 TRACE_REQUIRE_EQUAL(sts,
true);
827 TRACE_REQUIRE_EQUAL(fps.size(), 1);
828 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
829 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 13);
830 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 7);
831 type = artdaq::Fragment::ContainerFragmentType;
832 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
833 auto cf5 = artdaq::ContainerFragment(*fps.front());
834 TRACE_REQUIRE_EQUAL(cf5.block_count(), 1);
835 TRACE_REQUIRE_EQUAL(cf5.missing_data(),
false);
836 type = artdaq::Fragment::FirstUserFragmentType;
837 TRACE_REQUIRE_EQUAL(cf5.fragment_type(), type);
842 TRACE_REQUIRE_EQUAL(list.size(), 1);
843 TRACE_REQUIRE_EQUAL(list.begin()->first, 7);
848 TRACE_REQUIRE_EQUAL(sts,
true);
849 TRACE_REQUIRE_EQUAL(fps.size(), 1);
850 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
851 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 12);
852 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 6);
853 type = artdaq::Fragment::ContainerFragmentType;
854 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
855 auto cf6 = artdaq::ContainerFragment(*fps.front());
856 TRACE_REQUIRE_EQUAL(cf6.block_count(), 1);
857 TRACE_REQUIRE_EQUAL(cf6.missing_data(),
false);
858 type = artdaq::Fragment::FirstUserFragmentType;
859 TRACE_REQUIRE_EQUAL(cf6.fragment_type(), type);
864 TRACE_REQUIRE_EQUAL(list.size(), 0);
869 TLOG(TLVL_INFO) <<
"WindowMode_Function test case END";
881 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
882 TLOG(TLVL_INFO) <<
"WindowMode_RequestBeforeBuffer test case BEGIN";
883 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
884 const int DELAY_TIME = 100;
885 fhicl::ParameterSet ps;
886 ps.put<
int>(
"board_id", 1);
887 ps.put<
int>(
"fragment_id", 1);
888 ps.put<
int>(
"request_port", REQUEST_PORT);
890 ps.put<std::string>(
"request_address",
"227.18.12.32");
892 ps.put<std::string>(
"request_address",
"localhost");
894 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
895 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 3);
896 ps.put<
bool>(
"separate_data_thread",
true);
897 ps.put<
bool>(
"separate_monitoring_thread",
false);
898 ps.put<
bool>(
"circular_buffer_mode",
true);
899 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
900 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
901 ps.put<std::string>(
"request_mode",
"window");
902 ps.put(
"request_delay_ms", DELAY_TIME);
903 ps.put(
"send_requests",
true);
912 artdaq::FragmentPtrs fps;
914 artdaq::Fragment::type_t type;
924 TRACE_REQUIRE_EQUAL(sts,
true);
925 TRACE_REQUIRE_EQUAL(fps.size(), 1);
926 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
927 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
928 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
929 type = artdaq::Fragment::ContainerFragmentType;
930 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
931 auto cf4 = artdaq::ContainerFragment(*fps.front());
932 TRACE_REQUIRE_EQUAL(cf4.block_count(), 0);
933 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
934 type = artdaq::Fragment::EmptyFragmentType;
935 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
938 TLOG(TLVL_INFO) <<
"WindowMode_RequestBeforeBuffer test case END";
942 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
943 TLOG(TLVL_INFO) <<
"WindowMode_RequestStartsBeforeBuffer test case BEGIN";
944 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
945 const int DELAY_TIME = 100;
946 fhicl::ParameterSet ps;
947 ps.put<
int>(
"board_id", 1);
948 ps.put<
int>(
"fragment_id", 1);
949 ps.put<
int>(
"request_port", REQUEST_PORT);
951 ps.put<std::string>(
"request_address",
"227.18.12.32");
953 ps.put<std::string>(
"request_address",
"localhost");
955 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
956 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 3);
957 ps.put<
bool>(
"separate_data_thread",
true);
958 ps.put<
bool>(
"separate_monitoring_thread",
false);
959 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
960 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
961 ps.put<
bool>(
"circular_buffer_mode",
true);
962 ps.put<std::string>(
"request_mode",
"window");
963 ps.put(
"request_delay_ms", DELAY_TIME);
964 ps.put(
"send_requests",
true);
973 artdaq::FragmentPtrs fps;
975 artdaq::Fragment::type_t type;
987 TRACE_REQUIRE_EQUAL(sts,
true);
988 TRACE_REQUIRE_EQUAL(fps.size(), 1);
989 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
990 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 4);
991 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
992 type = artdaq::Fragment::ContainerFragmentType;
993 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
994 auto cf4 = artdaq::ContainerFragment(*fps.front());
995 TRACE_REQUIRE_EQUAL(cf4.block_count(), 1);
996 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
997 type = artdaq::Fragment::FirstUserFragmentType;
998 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
1002 TLOG(TLVL_INFO) <<
"WindowMode_RequestStartsBeforeBuffer test case END";
1006 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1007 TLOG(TLVL_INFO) <<
"WindowMode_RequestOutsideBuffer test case BEGIN";
1008 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1009 const int DELAY_TIME = 100;
1010 fhicl::ParameterSet ps;
1011 ps.put<
int>(
"board_id", 1);
1012 ps.put<
int>(
"fragment_id", 1);
1013 ps.put<
int>(
"request_port", REQUEST_PORT);
1015 ps.put<std::string>(
"request_address",
"227.18.12.32");
1017 ps.put<std::string>(
"request_address",
"localhost");
1019 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1020 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 4);
1021 ps.put<
size_t>(
"window_close_timeout_us", 500000);
1022 ps.put<
bool>(
"separate_data_thread",
true);
1023 ps.put<
bool>(
"separate_monitoring_thread",
false);
1024 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1025 ps.put<
bool>(
"circular_buffer_mode",
true);
1026 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
1027 ps.put<std::string>(
"request_mode",
"window");
1028 ps.put(
"request_delay_ms", DELAY_TIME);
1029 ps.put(
"send_requests",
true);
1038 artdaq::FragmentPtrs fps;
1040 artdaq::Fragment::type_t type;
1052 TRACE_REQUIRE_EQUAL(sts,
true);
1053 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1054 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1055 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 6);
1056 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1057 type = artdaq::Fragment::ContainerFragmentType;
1058 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1059 auto cf = artdaq::ContainerFragment(*fps.front());
1060 TRACE_REQUIRE_EQUAL(cf.block_count(), 4);
1061 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
1062 type = artdaq::Fragment::FirstUserFragmentType;
1063 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
1069 TRACE_REQUIRE_EQUAL(sts,
true);
1070 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1076 TRACE_REQUIRE_EQUAL(sts,
true);
1077 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1078 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1079 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 9);
1080 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1081 type = artdaq::Fragment::ContainerFragmentType;
1082 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1083 auto cf2 = artdaq::ContainerFragment(*fps.front());
1084 TRACE_REQUIRE_EQUAL(cf2.block_count(), 3);
1085 TRACE_REQUIRE_EQUAL(cf2.missing_data(),
true);
1086 type = artdaq::Fragment::FirstUserFragmentType;
1087 TRACE_REQUIRE_EQUAL(cf2.fragment_type(), type);
1094 TRACE_REQUIRE_EQUAL(sts,
true);
1095 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1100 TRACE_REQUIRE_EQUAL(sts,
true);
1101 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1102 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1103 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 12);
1104 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
1105 type = artdaq::Fragment::ContainerFragmentType;
1106 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1107 auto cf4 = artdaq::ContainerFragment(*fps.front());
1108 TRACE_REQUIRE_EQUAL(cf4.block_count(), 1);
1109 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
1110 type = artdaq::Fragment::FirstUserFragmentType;
1111 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
1115 TLOG(TLVL_INFO) <<
"WindowMode_RequestOutsideBuffer test case END";
1119 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1120 TLOG(TLVL_INFO) <<
"WindowMode_RequestInBuffer test case BEGIN";
1121 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1122 const int DELAY_TIME = 100;
1123 fhicl::ParameterSet ps;
1124 ps.put<
int>(
"board_id", 1);
1125 ps.put<
int>(
"fragment_id", 1);
1126 ps.put<
int>(
"request_port", REQUEST_PORT);
1128 ps.put<std::string>(
"request_address",
"227.18.12.32");
1130 ps.put<std::string>(
"request_address",
"localhost");
1132 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1133 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 3);
1134 ps.put<
bool>(
"separate_data_thread",
true);
1135 ps.put<
bool>(
"separate_monitoring_thread",
false);
1136 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1137 ps.put<
bool>(
"circular_buffer_mode",
true);
1138 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
1139 ps.put<std::string>(
"request_mode",
"window");
1140 ps.put(
"request_delay_ms", DELAY_TIME);
1141 ps.put(
"send_requests",
true);
1149 artdaq::FragmentPtrs fps;
1151 artdaq::Fragment::type_t type;
1162 TRACE_REQUIRE_EQUAL(sts,
true);
1163 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1164 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1165 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 3);
1166 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1167 type = artdaq::Fragment::ContainerFragmentType;
1168 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1169 auto cf4 = artdaq::ContainerFragment(*fps.front());
1170 TRACE_REQUIRE_EQUAL(cf4.block_count(), 3);
1171 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
false);
1172 type = artdaq::Fragment::FirstUserFragmentType;
1173 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
1176 TLOG(TLVL_INFO) <<
"WindowMode_RequestInBuffer test case END";
1180 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1181 TLOG(TLVL_INFO) <<
"WindowMode_RequestEndsAfterBuffer test case BEGIN";
1182 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1183 const int DELAY_TIME = 100;
1184 fhicl::ParameterSet ps;
1185 ps.put<
int>(
"board_id", 1);
1186 ps.put<
int>(
"fragment_id", 1);
1187 ps.put<
int>(
"request_port", REQUEST_PORT);
1189 ps.put<std::string>(
"request_address",
"227.18.12.32");
1191 ps.put<std::string>(
"request_address",
"localhost");
1193 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1194 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 3);
1195 ps.put<
size_t>(
"window_close_timeout_us", 500000);
1196 ps.put<
bool>(
"separate_data_thread",
true);
1197 ps.put<
bool>(
"separate_monitoring_thread",
false);
1198 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1199 ps.put<
bool>(
"circular_buffer_mode",
true);
1200 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
1201 ps.put<std::string>(
"request_mode",
"window");
1202 ps.put(
"request_delay_ms", DELAY_TIME);
1203 ps.put(
"send_requests",
true);
1211 artdaq::FragmentPtrs fps;
1213 artdaq::Fragment::type_t type;
1223 TRACE_REQUIRE_EQUAL(sts,
true);
1224 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1229 TRACE_REQUIRE_EQUAL(sts,
true);
1230 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1231 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1232 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
1233 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1234 type = artdaq::Fragment::ContainerFragmentType;
1235 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1236 auto cf = artdaq::ContainerFragment(*fps.front());
1237 TRACE_REQUIRE_EQUAL(cf.block_count(), 3);
1238 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
1239 type = artdaq::Fragment::FirstUserFragmentType;
1240 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
1247 TRACE_REQUIRE_EQUAL(sts,
true);
1248 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1253 TRACE_REQUIRE_EQUAL(sts,
true);
1254 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1255 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1256 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 8);
1257 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1258 type = artdaq::Fragment::ContainerFragmentType;
1259 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1260 auto cf4 = artdaq::ContainerFragment(*fps.front());
1261 TRACE_REQUIRE_EQUAL(cf4.block_count(), 1);
1262 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
1263 type = artdaq::Fragment::FirstUserFragmentType;
1264 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
1268 TLOG(TLVL_INFO) <<
"WindowMode_RequestEndsAfterBuffer test case END";
1272 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1273 TLOG(TLVL_INFO) <<
"WindowMode_RequestAfterBuffer test case BEGIN";
1274 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1275 const int DELAY_TIME = 100;
1276 fhicl::ParameterSet ps;
1277 ps.put<
int>(
"board_id", 1);
1278 ps.put<
int>(
"fragment_id", 1);
1279 ps.put<
int>(
"request_port", REQUEST_PORT);
1281 ps.put<std::string>(
"request_address",
"227.18.12.32");
1283 ps.put<std::string>(
"request_address",
"localhost");
1285 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1286 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 3);
1287 ps.put<
size_t>(
"window_close_timeout_us", 500000);
1288 ps.put<
bool>(
"separate_data_thread",
true);
1289 ps.put<
bool>(
"separate_monitoring_thread",
false);
1290 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1291 ps.put<
bool>(
"circular_buffer_mode",
true);
1292 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
1293 ps.put<std::string>(
"request_mode",
"window");
1294 ps.put(
"request_delay_ms", DELAY_TIME);
1295 ps.put(
"send_requests",
true);
1303 artdaq::FragmentPtrs fps;
1305 artdaq::Fragment::type_t type;
1316 TRACE_REQUIRE_EQUAL(sts,
true);
1317 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1321 TRACE_REQUIRE_EQUAL(sts,
true);
1322 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1327 TRACE_REQUIRE_EQUAL(sts,
true);
1328 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1329 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1330 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 11);
1331 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1332 type = artdaq::Fragment::ContainerFragmentType;
1333 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1334 auto cf = artdaq::ContainerFragment(*fps.front());
1335 TRACE_REQUIRE_EQUAL(cf.block_count(), 3);
1336 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
1337 type = artdaq::Fragment::FirstUserFragmentType;
1338 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
1344 TRACE_REQUIRE_EQUAL(sts,
true);
1345 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1350 TRACE_REQUIRE_EQUAL(sts,
true);
1351 TRACE_REQUIRE_EQUAL(fps.size(), 1);
1352 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1353 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 16);
1354 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1355 type = artdaq::Fragment::ContainerFragmentType;
1356 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1357 auto cf4 = artdaq::ContainerFragment(*fps.front());
1358 TRACE_REQUIRE_EQUAL(cf4.block_count(), 0);
1359 TRACE_REQUIRE_EQUAL(cf4.missing_data(),
true);
1360 type = artdaq::Fragment::EmptyFragmentType;
1361 TRACE_REQUIRE_EQUAL(cf4.fragment_type(), type);
1365 TLOG(TLVL_INFO) <<
"WindowMode_RequestAfterBuffer test case END";
1370 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1371 TLOG(TLVL_INFO) <<
"SequenceIDMode test case BEGIN";
1372 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1373 const int DELAY_TIME = 100;
1374 fhicl::ParameterSet ps;
1375 ps.put<
int>(
"board_id", 1);
1376 ps.put<
int>(
"fragment_id", 1);
1377 ps.put<
int>(
"request_port", REQUEST_PORT);
1379 ps.put<std::string>(
"request_address",
"227.18.12.30");
1381 ps.put<std::string>(
"request_address",
"localhost");
1383 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1384 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
1385 ps.put<
bool>(
"separate_data_thread",
true);
1386 ps.put<
bool>(
"separate_monitoring_thread",
false);
1387 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1388 ps.put<std::string>(
"request_mode",
"SequenceID");
1389 ps.put(
"request_delay_ms", DELAY_TIME);
1390 ps.put(
"send_requests",
true);
1405 artdaq::FragmentPtrs fps;
1407 auto type = artdaq::Fragment::FirstUserFragmentType;
1408 TRACE_REQUIRE_EQUAL(sts,
true);
1409 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1410 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1411 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1412 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1413 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1421 TRACE_REQUIRE_EQUAL(sts,
true);
1422 TRACE_REQUIRE_EQUAL(fps.size(), 0u);
1428 TRACE_REQUIRE_EQUAL(sts,
true);
1429 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1430 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1431 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 2);
1432 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1433 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1444 TRACE_REQUIRE_EQUAL(sts,
true);
1445 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1446 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1447 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 4);
1448 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
1449 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1456 TRACE_REQUIRE_EQUAL(sts,
true);
1457 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1458 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1459 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 3);
1460 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
1461 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1465 TLOG(TLVL_INFO) <<
"SequenceIDMode test case END";
1470 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1471 TLOG(TLVL_INFO) <<
"HardwareFailure_NonThreaded test case BEGIN";
1472 fhicl::ParameterSet ps;
1473 ps.put<
int>(
"board_id", 1);
1474 ps.put<
int>(
"fragment_id", 1);
1475 ps.put<
bool>(
"separate_data_thread",
false);
1476 ps.put<
bool>(
"separate_monitoring_thread",
false);
1477 ps.put<int64_t>(
"hardware_poll_interval_us", 10);
1480 gen.StartCmd(1, 0xFFFFFFFF, 1);
1482 artdaq::FragmentPtrs fps;
1483 auto sts = gen.getNext(fps);
1484 TRACE_REQUIRE_EQUAL(sts,
true);
1485 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1486 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1487 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1488 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1491 gen.setFireCount(1);
1494 sts = gen.getNext(fps);
1495 TRACE_REQUIRE_EQUAL(sts,
false);
1496 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1498 gen.StopCmd(0xFFFFFFFF, 1);
1500 TLOG(TLVL_INFO) <<
"HardwareFailure_NonThreaded test case END";
1505 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1506 TLOG(TLVL_INFO) <<
"HardwareFailure_Threaded test case BEGIN";
1507 fhicl::ParameterSet ps;
1508 ps.put<
int>(
"board_id", 1);
1509 ps.put<
int>(
"fragment_id", 1);
1510 ps.put<
bool>(
"separate_data_thread",
true);
1511 ps.put<
bool>(
"separate_monitoring_thread",
true);
1512 ps.put<int64_t>(
"hardware_poll_interval_us", 750000);
1515 gen.StartCmd(1, 0xFFFFFFFF, 1);
1518 artdaq::FragmentPtrs fps;
1519 auto sts = gen.getNext(fps);
1520 TRACE_REQUIRE_EQUAL(sts,
true);
1521 TRACE_REQUIRE_EQUAL(fps.size(), 1u);
1522 TRACE_REQUIRE_EQUAL(fps.front()->fragmentID(), 1);
1523 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1524 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1539 gen.setFireCount(1);
1540 sts = gen.getNext(fps);
1541 TRACE_REQUIRE_EQUAL(sts,
false);
1542 TRACE_REQUIRE_EQUAL(fps.size(), 0);
1544 gen.StopCmd(0xFFFFFFFF, 1);
1546 TLOG(TLVL_INFO) <<
"HardwareFailure_Threaded test case END";
1551 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1552 TLOG(TLVL_INFO) <<
"IgnoreRequests_MultipleIDs test case BEGIN";
1553 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1554 const int DELAY_TIME = 1;
1555 fhicl::ParameterSet ps;
1556 ps.put<
int>(
"board_id", 1);
1557 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
1558 ps.put<
int>(
"request_port", REQUEST_PORT);
1560 ps.put<std::string>(
"request_address",
"227.18.12.29");
1562 ps.put<std::string>(
"request_address",
"localhost");
1564 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1565 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
1566 ps.put<
bool>(
"separate_data_thread",
true);
1567 ps.put<
bool>(
"separate_monitoring_thread",
false);
1568 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1569 ps.put<std::string>(
"request_mode",
"ignored");
1570 ps.put(
"request_delay_ms", DELAY_TIME);
1571 ps.put(
"send_requests",
true);
1580 artdaq::FragmentPtrs fps;
1581 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
1583 TRACE_REQUIRE_EQUAL(sts,
true);
1584 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1585 while (fps.size() > 0)
1587 ids[fps.front()->fragmentID()]++;
1588 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1589 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1593 TRACE_REQUIRE_EQUAL(ids[1], 1);
1594 TRACE_REQUIRE_EQUAL(ids[2], 1);
1595 TRACE_REQUIRE_EQUAL(ids[3], 1);
1604 TRACE_REQUIRE_EQUAL(sts,
true);
1605 TRACE_REQUIRE_EQUAL(fps.size(), 2u);
1606 while (fps.size() > 0)
1608 ids[fps.front()->fragmentID()]++;
1609 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 2);
1610 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1613 TRACE_REQUIRE_EQUAL(ids[1], 1);
1614 TRACE_REQUIRE_EQUAL(ids[2], 1);
1618 TLOG(TLVL_INFO) <<
"IgnoreRequests_MultipleIDs test case END";
1623 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1624 TLOG(TLVL_INFO) <<
"SingleMode_MultipleIDs test case BEGIN";
1625 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1626 const int DELAY_TIME = 100;
1627 fhicl::ParameterSet ps;
1628 ps.put<
int>(
"board_id", 1);
1629 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
1630 ps.put<
int>(
"request_port", REQUEST_PORT);
1632 ps.put<std::string>(
"request_address",
"227.18.12.30");
1634 ps.put<std::string>(
"request_address",
"localhost");
1636 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1637 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
1638 ps.put<
bool>(
"separate_data_thread",
true);
1639 ps.put<
bool>(
"separate_monitoring_thread",
false);
1640 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1641 ps.put<std::string>(
"request_mode",
"single");
1642 ps.put(
"request_delay_ms", DELAY_TIME);
1643 ps.put(
"send_requests",
true);
1657 artdaq::FragmentPtrs fps;
1658 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
1660 auto type = artdaq::Fragment::FirstUserFragmentType;
1661 TRACE_REQUIRE_EQUAL(sts,
true);
1662 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1663 while (fps.size() > 0)
1665 ids[fps.front()->fragmentID()]++;
1666 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1667 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1668 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1671 TRACE_REQUIRE_EQUAL(ids[1], 1);
1672 TRACE_REQUIRE_EQUAL(ids[2], 1);
1673 TRACE_REQUIRE_EQUAL(ids[3], 1);
1682 TRACE_REQUIRE_EQUAL(sts,
true);
1683 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1684 while (fps.size() > 0)
1686 ids[fps.front()->fragmentID()]++;
1687 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
1688 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1689 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1692 TRACE_REQUIRE_EQUAL(ids[1], 1);
1693 TRACE_REQUIRE_EQUAL(ids[2], 1);
1694 TRACE_REQUIRE_EQUAL(ids[3], 1);
1706 TRACE_REQUIRE_EQUAL(sts,
true);
1707 TRACE_REQUIRE_EQUAL(fps.size(), 6);
1708 auto ts = artdaq::Fragment::InvalidTimestamp;
1709 auto emptyType = artdaq::Fragment::EmptyFragmentType;
1710 for (
auto ii = 0; ii < 3; ++ii)
1712 ids[fps.front()->fragmentID()]++;
1713 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
1714 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
1715 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
1718 TRACE_REQUIRE_EQUAL(ids[1], 1);
1719 TRACE_REQUIRE_EQUAL(ids[2], 1);
1720 TRACE_REQUIRE_EQUAL(ids[3], 1);
1722 for (
auto ii = 0; ii < 3; ++ii)
1724 ids[fps.front()->fragmentID()]++;
1725 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
1726 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
1727 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1730 TRACE_REQUIRE_EQUAL(ids[1], 1);
1731 TRACE_REQUIRE_EQUAL(ids[2], 1);
1732 TRACE_REQUIRE_EQUAL(ids[3], 1);
1744 TRACE_REQUIRE_EQUAL(sts,
true);
1745 TRACE_REQUIRE_EQUAL(fps.size(), 3);
1746 for (
auto ii = 0; ii < 3; ++ii)
1748 ids[fps.front()->fragmentID()]++;
1749 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 9);
1750 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
1751 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1754 TRACE_REQUIRE_EQUAL(ids[1], 1);
1755 TRACE_REQUIRE_EQUAL(ids[2], 1);
1756 TRACE_REQUIRE_EQUAL(ids[3], 1);
1762 TLOG(TLVL_INFO) <<
"SingleMode_MultipleIDs test case END";
1767 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1768 TLOG(TLVL_INFO) <<
"BufferMode_MultipleIDs test case BEGIN";
1769 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1770 const int DELAY_TIME = 100;
1771 fhicl::ParameterSet ps;
1772 ps.put<
int>(
"board_id", 1);
1773 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
1774 ps.put<
int>(
"request_port", REQUEST_PORT);
1776 ps.put<std::string>(
"request_address",
"227.18.12.31");
1778 ps.put<std::string>(
"request_address",
"localhost");
1780 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1781 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
1782 ps.put<
bool>(
"separate_data_thread",
true);
1783 ps.put<
bool>(
"separate_monitoring_thread",
false);
1784 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1785 ps.put<std::string>(
"request_mode",
"buffer");
1786 ps.put(
"request_delay_ms", DELAY_TIME);
1787 ps.put(
"send_requests",
true);
1801 artdaq::FragmentPtrs fps;
1802 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
1804 TRACE_REQUIRE_EQUAL(sts,
true);
1805 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1806 auto type = artdaq::Fragment::ContainerFragmentType;
1807 while (fps.size() > 0)
1809 ids[fps.front()->fragmentID()]++;
1810 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1811 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1812 type = artdaq::Fragment::ContainerFragmentType;
1813 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1814 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
1815 auto cf = artdaq::ContainerFragment(*fps.front());
1816 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
1817 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
1818 type = artdaq::Fragment::FirstUserFragmentType;
1819 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
1822 TRACE_REQUIRE_EQUAL(ids[1], 1);
1823 TRACE_REQUIRE_EQUAL(ids[2], 1);
1824 TRACE_REQUIRE_EQUAL(ids[3], 1);
1832 TRACE_REQUIRE_EQUAL(sts,
true);
1833 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1834 while (fps.size() > 0)
1836 ids[fps.front()->fragmentID()]++;
1837 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
1838 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
1839 type = artdaq::Fragment::ContainerFragmentType;
1840 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1841 auto cf = artdaq::ContainerFragment(*fps.front());
1842 TRACE_REQUIRE_EQUAL(cf.block_count(), 0);
1843 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
1844 type = artdaq::Fragment::EmptyFragmentType;
1845 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
1848 TRACE_REQUIRE_EQUAL(ids[1], 1);
1849 TRACE_REQUIRE_EQUAL(ids[2], 1);
1850 TRACE_REQUIRE_EQUAL(ids[3], 1);
1860 TRACE_REQUIRE_EQUAL(sts,
true);
1861 TRACE_REQUIRE_EQUAL(fps.size(), 6);
1863 auto ts = artdaq::Fragment::InvalidTimestamp;
1864 auto emptyType = artdaq::Fragment::EmptyFragmentType;
1865 for (
auto ii = 0; ii < 3; ++ii)
1867 ids[fps.front()->fragmentID()]++;
1868 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
1869 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
1870 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
1871 TRACE_REQUIRE_EQUAL(fps.front()->size(), artdaq::detail::RawFragmentHeader::num_words());
1874 TRACE_REQUIRE_EQUAL(ids[1], 1);
1875 TRACE_REQUIRE_EQUAL(ids[2], 1);
1876 TRACE_REQUIRE_EQUAL(ids[3], 1);
1878 for (
auto ii = 0; ii < 3; ++ii)
1880 ids[fps.front()->fragmentID()]++;
1881 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
1882 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
1883 type = artdaq::Fragment::ContainerFragmentType;
1884 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1885 auto cf3 = artdaq::ContainerFragment(*fps.front());
1886 TRACE_REQUIRE_EQUAL(cf3.block_count(), 2);
1887 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
1888 type = artdaq::Fragment::FirstUserFragmentType;
1889 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
1892 TRACE_REQUIRE_EQUAL(ids[1], 1);
1893 TRACE_REQUIRE_EQUAL(ids[2], 1);
1894 TRACE_REQUIRE_EQUAL(ids[3], 1);
1906 TRACE_REQUIRE_EQUAL(sts,
true);
1907 TRACE_REQUIRE_EQUAL(fps.size(), 3);
1909 for (
auto ii = 0; ii < 3; ++ii)
1911 ids[fps.front()->fragmentID()]++;
1912 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 8);
1913 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
1914 type = artdaq::Fragment::ContainerFragmentType;
1915 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1916 auto cf3 = artdaq::ContainerFragment(*fps.front());
1917 if (fps.front()->fragmentID() != 3)
1919 TRACE_REQUIRE_EQUAL(cf3.block_count(), 2);
1920 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
1921 type = artdaq::Fragment::FirstUserFragmentType;
1922 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
1926 TRACE_REQUIRE_EQUAL(cf3.block_count(), 0);
1927 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
1928 type = artdaq::Fragment::EmptyFragmentType;
1929 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
1933 TRACE_REQUIRE_EQUAL(ids[1], 1);
1934 TRACE_REQUIRE_EQUAL(ids[2], 1);
1935 TRACE_REQUIRE_EQUAL(ids[3], 1);
1944 TLOG(TLVL_INFO) <<
"BufferMode_MultipleIDs test case END";
1949 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
1950 TLOG(TLVL_INFO) <<
"CircularBufferMode_MultipleIDs test case BEGIN";
1951 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
1952 const int DELAY_TIME = 100;
1953 fhicl::ParameterSet ps;
1954 ps.put<
int>(
"board_id", 1);
1955 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
1956 ps.put<
int>(
"request_port", REQUEST_PORT);
1958 ps.put<std::string>(
"request_address",
"227.18.12.31");
1960 ps.put<std::string>(
"request_address",
"localhost");
1962 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
1963 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
1964 ps.put<
bool>(
"separate_data_thread",
true);
1965 ps.put<
bool>(
"circular_buffer_mode",
true);
1966 ps.put<
int>(
"data_buffer_depth_fragments", 3);
1967 ps.put<
bool>(
"separate_monitoring_thread",
false);
1968 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
1969 ps.put<std::string>(
"request_mode",
"buffer");
1970 ps.put(
"request_delay_ms", DELAY_TIME);
1971 ps.put(
"send_requests",
true);
1985 artdaq::FragmentPtrs fps;
1986 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
1988 auto type = artdaq::Fragment::ContainerFragmentType;
1989 TRACE_REQUIRE_EQUAL(sts,
true);
1990 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
1991 while (fps.size() > 0)
1993 ids[fps.front()->fragmentID()]++;
1994 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
1995 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
1996 type = artdaq::Fragment::ContainerFragmentType;
1997 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
1998 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
1999 auto cf = artdaq::ContainerFragment(*fps.front());
2000 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2001 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2002 type = artdaq::Fragment::FirstUserFragmentType;
2003 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2006 TRACE_REQUIRE_EQUAL(ids[1], 1);
2007 TRACE_REQUIRE_EQUAL(ids[2], 1);
2008 TRACE_REQUIRE_EQUAL(ids[3], 1);
2017 TRACE_REQUIRE_EQUAL(sts,
true);
2018 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2019 while (fps.size() > 0)
2021 ids[fps.front()->fragmentID()]++;
2022 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 5);
2023 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
2024 type = artdaq::Fragment::ContainerFragmentType;
2025 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2026 auto cf = artdaq::ContainerFragment(*fps.front());
2027 TRACE_REQUIRE_EQUAL(cf.block_count(), 0);
2028 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2029 type = artdaq::Fragment::EmptyFragmentType;
2030 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2033 TRACE_REQUIRE_EQUAL(ids[1], 1);
2034 TRACE_REQUIRE_EQUAL(ids[2], 1);
2035 TRACE_REQUIRE_EQUAL(ids[3], 1);
2046 TRACE_REQUIRE_EQUAL(sts,
true);
2047 TRACE_REQUIRE_EQUAL(fps.size(), 6);
2049 auto ts = artdaq::Fragment::InvalidTimestamp;
2050 auto emptyType = artdaq::Fragment::EmptyFragmentType;
2051 for (
auto ii = 0; ii < 3; ++ii)
2053 ids[fps.front()->fragmentID()]++;
2054 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), ts);
2055 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
2056 TRACE_REQUIRE_EQUAL(fps.front()->type(), emptyType);
2057 TRACE_REQUIRE_EQUAL(fps.front()->size(), artdaq::detail::RawFragmentHeader::num_words());
2060 TRACE_REQUIRE_EQUAL(ids[1], 1);
2061 TRACE_REQUIRE_EQUAL(ids[2], 1);
2062 TRACE_REQUIRE_EQUAL(ids[3], 1);
2064 for (
auto ii = 0; ii < 3; ++ii)
2066 ids[fps.front()->fragmentID()]++;
2067 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 7);
2068 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
2069 type = artdaq::Fragment::ContainerFragmentType;
2070 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2071 auto cf3 = artdaq::ContainerFragment(*fps.front());
2072 TRACE_REQUIRE_EQUAL(cf3.block_count(), 3);
2073 TRACE_REQUIRE_EQUAL(cf3.missing_data(),
false);
2074 type = artdaq::Fragment::FirstUserFragmentType;
2075 TRACE_REQUIRE_EQUAL(cf3.fragment_type(), type);
2078 TRACE_REQUIRE_EQUAL(ids[1], 1);
2079 TRACE_REQUIRE_EQUAL(ids[2], 1);
2080 TRACE_REQUIRE_EQUAL(ids[3], 1);
2091 TRACE_REQUIRE_EQUAL(sts,
true);
2092 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2093 while (fps.size() > 0)
2095 ids[fps.front()->fragmentID()]++;
2096 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 8);
2097 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
2098 type = artdaq::Fragment::ContainerFragmentType;
2099 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2100 auto cf = artdaq::ContainerFragment(*fps.front());
2101 TRACE_REQUIRE_EQUAL(cf.block_count(), 3);
2102 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2103 type = artdaq::Fragment::FirstUserFragmentType;
2104 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2105 TRACE_REQUIRE_EQUAL(cf.at(0)->timestamp(), 7);
2106 TRACE_REQUIRE_EQUAL(cf.at(1)->timestamp(), 8);
2107 TRACE_REQUIRE_EQUAL(cf.at(2)->timestamp(), 9);
2110 TRACE_REQUIRE_EQUAL(ids[1], 1);
2111 TRACE_REQUIRE_EQUAL(ids[2], 1);
2112 TRACE_REQUIRE_EQUAL(ids[3], 1);
2126 TRACE_REQUIRE_EQUAL(sts,
true);
2127 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2128 while (fps.size() > 0)
2130 ids[fps.front()->fragmentID()]++;
2131 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 10);
2132 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 6);
2133 type = artdaq::Fragment::ContainerFragmentType;
2134 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2135 auto cf = artdaq::ContainerFragment(*fps.front());
2136 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2137 type = artdaq::Fragment::FirstUserFragmentType;
2138 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2140 if (fps.front()->fragmentID() != 3)
2142 TRACE_REQUIRE_EQUAL(cf.block_count(), 3);
2143 TRACE_REQUIRE_EQUAL(cf.at(0)->timestamp(), 12);
2144 TRACE_REQUIRE_EQUAL(cf.at(1)->timestamp(), 13);
2145 TRACE_REQUIRE_EQUAL(cf.at(2)->timestamp(), 14);
2149 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2150 TRACE_REQUIRE_EQUAL(cf.at(0)->timestamp(), 10);
2154 TRACE_REQUIRE_EQUAL(ids[1], 1);
2155 TRACE_REQUIRE_EQUAL(ids[2], 1);
2156 TRACE_REQUIRE_EQUAL(ids[3], 1);
2165 TLOG(TLVL_INFO) <<
"CircularBufferMode_MultipleIDs test case END";
2170 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
2171 TLOG(TLVL_INFO) <<
"WindowMode_Function_MultipleIDs test case BEGIN";
2172 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
2173 const int DELAY_TIME = 100;
2174 fhicl::ParameterSet ps;
2175 ps.put<
int>(
"board_id", 1);
2176 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
2177 ps.put<
int>(
"request_port", REQUEST_PORT);
2179 ps.put<std::string>(
"request_address",
"227.18.12.32");
2181 ps.put<std::string>(
"request_address",
"localhost");
2183 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
2184 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
2185 ps.put<
bool>(
"separate_data_thread",
true);
2186 ps.put<
bool>(
"separate_monitoring_thread",
false);
2187 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
2188 ps.put<
size_t>(
"data_buffer_depth_fragments", 5);
2189 ps.put<
bool>(
"circular_buffer_mode",
true);
2190 ps.put<std::string>(
"request_mode",
"window");
2191 ps.put<
size_t>(
"missing_request_window_timeout_us", 500000);
2192 ps.put<
size_t>(
"window_close_timeout_us", 500000);
2193 ps.put(
"request_delay_ms", DELAY_TIME);
2194 ps.put(
"send_requests",
true);
2208 artdaq::FragmentPtrs fps;
2209 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
2211 auto type = artdaq::Fragment::ContainerFragmentType;
2213 TRACE_REQUIRE_EQUAL(sts,
true);
2214 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2215 while (fps.size() > 0)
2217 ids[fps.front()->fragmentID()]++;
2218 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
2219 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
2220 type = artdaq::Fragment::ContainerFragmentType;
2221 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2222 BOOST_REQUIRE_GE(fps.front()->sizeBytes(), 2 *
sizeof(artdaq::detail::RawFragmentHeader) +
sizeof(artdaq::ContainerFragment::Metadata));
2223 auto cf = artdaq::ContainerFragment(*fps.front());
2224 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2225 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2226 type = artdaq::Fragment::FirstUserFragmentType;
2227 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2230 TRACE_REQUIRE_EQUAL(ids[1], 1);
2231 TRACE_REQUIRE_EQUAL(ids[2], 1);
2232 TRACE_REQUIRE_EQUAL(ids[3], 1);
2241 TRACE_REQUIRE_EQUAL(sts,
true);
2242 TRACE_REQUIRE_EQUAL(fps.size(), 0);
2248 TRACE_REQUIRE_EQUAL(sts,
true);
2249 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2250 while (fps.size() > 0)
2252 ids[fps.front()->fragmentID()]++;
2253 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 2);
2254 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
2255 type = artdaq::Fragment::ContainerFragmentType;
2256 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2257 auto cf = artdaq::ContainerFragment(*fps.front());
2258 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2259 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2260 type = artdaq::Fragment::FirstUserFragmentType;
2261 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2264 TRACE_REQUIRE_EQUAL(ids[1], 1);
2265 TRACE_REQUIRE_EQUAL(ids[2], 1);
2266 TRACE_REQUIRE_EQUAL(ids[3], 1);
2274 TRACE_REQUIRE_EQUAL(sts,
true);
2275 TRACE_REQUIRE_EQUAL(fps.size(), 0);
2280 TRACE_REQUIRE_EQUAL(sts,
true);
2281 TRACE_REQUIRE_EQUAL(fps.size(), 3);
2285 TRACE_REQUIRE_EQUAL(list.size(), 1);
2286 TRACE_REQUIRE_EQUAL(list.begin()->first, 4);
2291 while (fps.size() > 0)
2293 ids[fps.front()->fragmentID()]++;
2294 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 3);
2295 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
2296 type = artdaq::Fragment::ContainerFragmentType;
2297 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2298 auto cf = artdaq::ContainerFragment(*fps.front());
2299 TRACE_REQUIRE_EQUAL(cf.block_count(), 0);
2300 TRACE_REQUIRE_EQUAL(cf.missing_data(),
true);
2301 type = artdaq::Fragment::EmptyFragmentType;
2302 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2305 TRACE_REQUIRE_EQUAL(ids[1], 1);
2306 TRACE_REQUIRE_EQUAL(ids[2], 1);
2307 TRACE_REQUIRE_EQUAL(ids[3], 1);
2319 TRACE_REQUIRE_EQUAL(list.size(), 1);
2323 TRACE_REQUIRE_EQUAL(list.size(), 0);
2324 TRACE_REQUIRE_EQUAL(sts,
true);
2325 TRACE_REQUIRE_EQUAL(fps.size(), 3);
2326 while (fps.size() > 0)
2328 ids[fps.front()->fragmentID()]++;
2329 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 4);
2330 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 5);
2331 type = artdaq::Fragment::ContainerFragmentType;
2332 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2333 auto cf = artdaq::ContainerFragment(*fps.front());
2334 TRACE_REQUIRE_EQUAL(cf.block_count(), 0);
2335 TRACE_REQUIRE_EQUAL(cf.missing_data(),
true);
2336 type = artdaq::Fragment::EmptyFragmentType;
2337 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2340 TRACE_REQUIRE_EQUAL(ids[1], 1);
2341 TRACE_REQUIRE_EQUAL(ids[2], 1);
2342 TRACE_REQUIRE_EQUAL(ids[3], 1);
2350 TRACE_REQUIRE_EQUAL(sts,
true);
2351 TRACE_REQUIRE_EQUAL(fps.size(), 3);
2352 while (fps.size() > 0)
2354 ids[fps.front()->fragmentID()]++;
2355 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 13);
2356 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 7);
2357 type = artdaq::Fragment::ContainerFragmentType;
2358 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2359 auto cf = artdaq::ContainerFragment(*fps.front());
2360 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2361 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2362 type = artdaq::Fragment::FirstUserFragmentType;
2363 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2366 TRACE_REQUIRE_EQUAL(ids[1], 1);
2367 TRACE_REQUIRE_EQUAL(ids[2], 1);
2368 TRACE_REQUIRE_EQUAL(ids[3], 1);
2374 TRACE_REQUIRE_EQUAL(list.size(), 1);
2375 TRACE_REQUIRE_EQUAL(list.begin()->first, 7);
2380 TRACE_REQUIRE_EQUAL(sts,
true);
2381 TRACE_REQUIRE_EQUAL(fps.size(), 3);
2382 while (fps.size() > 0)
2384 ids[fps.front()->fragmentID()]++;
2385 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 12);
2386 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 6);
2387 type = artdaq::Fragment::ContainerFragmentType;
2388 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2389 auto cf = artdaq::ContainerFragment(*fps.front());
2390 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2391 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2392 type = artdaq::Fragment::FirstUserFragmentType;
2393 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2396 TRACE_REQUIRE_EQUAL(ids[1], 1);
2397 TRACE_REQUIRE_EQUAL(ids[2], 1);
2398 TRACE_REQUIRE_EQUAL(ids[3], 1);
2404 TRACE_REQUIRE_EQUAL(list.size(), 0);
2413 TRACE_REQUIRE_EQUAL(sts,
true);
2414 TRACE_REQUIRE_EQUAL(fps.size(), 2);
2415 while (fps.size() > 0)
2417 ids[fps.front()->fragmentID()]++;
2418 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 15);
2419 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 8);
2420 type = artdaq::Fragment::ContainerFragmentType;
2421 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2422 auto cf = artdaq::ContainerFragment(*fps.front());
2423 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2424 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2425 type = artdaq::Fragment::FirstUserFragmentType;
2426 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2429 TRACE_REQUIRE_EQUAL(ids[1], 1);
2430 TRACE_REQUIRE_EQUAL(ids[2], 1);
2431 TRACE_REQUIRE_EQUAL(ids[3], 0);
2442 TRACE_REQUIRE_EQUAL(sts,
true);
2443 TRACE_REQUIRE_EQUAL(fps.size(), 1);
2444 while (fps.size() > 0)
2446 ids[fps.front()->fragmentID()]++;
2447 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 15);
2448 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 8);
2449 type = artdaq::Fragment::ContainerFragmentType;
2450 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2451 auto cf = artdaq::ContainerFragment(*fps.front());
2452 TRACE_REQUIRE_EQUAL(cf.block_count(), 1);
2453 TRACE_REQUIRE_EQUAL(cf.missing_data(),
false);
2454 type = artdaq::Fragment::FirstUserFragmentType;
2455 TRACE_REQUIRE_EQUAL(cf.fragment_type(), type);
2458 TRACE_REQUIRE_EQUAL(ids[1], 0);
2459 TRACE_REQUIRE_EQUAL(ids[2], 0);
2460 TRACE_REQUIRE_EQUAL(ids[3], 1);
2466 TLOG(TLVL_INFO) <<
"WindowMode_Function_MultipleIDs test case END";
2472 artdaq::configureMessageFacility(
"CommandableFragmentGenerator_t");
2473 TLOG(TLVL_INFO) <<
"SequenceIDMode_MultipleIDs test case BEGIN";
2474 const int REQUEST_PORT = (seedAndRandom() % (32768 - 1024)) + 1024;
2475 const int DELAY_TIME = 100;
2476 fhicl::ParameterSet ps;
2477 ps.put<
int>(
"board_id", 1);
2478 ps.put<std::vector<int>>(
"fragment_ids", {1, 2, 3});
2479 ps.put<
int>(
"request_port", REQUEST_PORT);
2481 ps.put<std::string>(
"request_address",
"227.18.12.30");
2483 ps.put<std::string>(
"request_address",
"localhost");
2485 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_offset", 0);
2486 ps.put<artdaq::Fragment::timestamp_t>(
"request_window_width", 0);
2487 ps.put<
bool>(
"separate_data_thread",
true);
2488 ps.put<
bool>(
"separate_monitoring_thread",
false);
2489 ps.put<int64_t>(
"hardware_poll_interval_us", 0);
2490 ps.put<std::string>(
"request_mode",
"SequenceID");
2491 ps.put(
"request_delay_ms", DELAY_TIME);
2492 ps.put(
"send_requests",
true);
2507 artdaq::FragmentPtrs fps;
2508 std::map<artdaq::Fragment::fragment_id_t, size_t> ids;
2510 auto type = artdaq::Fragment::FirstUserFragmentType;
2511 TRACE_REQUIRE_EQUAL(sts,
true);
2512 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2514 for (
auto ii = 0; ii < 3; ++ii)
2516 ids[fps.front()->fragmentID()]++;
2517 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 1);
2518 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 1);
2519 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2522 TRACE_REQUIRE_EQUAL(ids[1], 1);
2523 TRACE_REQUIRE_EQUAL(ids[2], 1);
2524 TRACE_REQUIRE_EQUAL(ids[3], 1);
2534 TRACE_REQUIRE_EQUAL(sts,
true);
2535 TRACE_REQUIRE_EQUAL(fps.size(), 0u);
2541 TRACE_REQUIRE_EQUAL(sts,
true);
2542 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2543 for (
auto ii = 0; ii < 3; ++ii)
2545 ids[fps.front()->fragmentID()]++;
2546 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 2);
2547 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 2);
2548 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2551 TRACE_REQUIRE_EQUAL(ids[1], 1);
2552 TRACE_REQUIRE_EQUAL(ids[2], 1);
2553 TRACE_REQUIRE_EQUAL(ids[3], 1);
2566 TRACE_REQUIRE_EQUAL(sts,
true);
2567 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2568 for (
auto ii = 0; ii < 3; ++ii)
2570 ids[fps.front()->fragmentID()]++;
2571 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 4);
2572 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 4);
2573 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2576 TRACE_REQUIRE_EQUAL(ids[1], 1);
2577 TRACE_REQUIRE_EQUAL(ids[2], 1);
2578 TRACE_REQUIRE_EQUAL(ids[3], 1);
2586 TRACE_REQUIRE_EQUAL(sts,
true);
2587 TRACE_REQUIRE_EQUAL(fps.size(), 3u);
2588 for (
auto ii = 0; ii < 3; ++ii)
2590 ids[fps.front()->fragmentID()]++;
2591 TRACE_REQUIRE_EQUAL(fps.front()->timestamp(), 3);
2592 TRACE_REQUIRE_EQUAL(fps.front()->sequenceID(), 3);
2593 TRACE_REQUIRE_EQUAL(fps.front()->type(), type);
2596 TRACE_REQUIRE_EQUAL(ids[1], 1);
2597 TRACE_REQUIRE_EQUAL(ids[2], 1);
2598 TRACE_REQUIRE_EQUAL(ids[3], 1);
2603 TLOG(TLVL_INFO) <<
"SequenceIDMode_MultipleIDs test case END";
2605 BOOST_AUTO_TEST_SUITE_END()
bool getNext_(artdaq::FragmentPtrs &frags) override
Generate data and return it to CommandableFragmentGenerator.
void setEnabledIds(uint64_t bitmask)
Set the enabled IDs mask for the Fragment Generator.
CommandableFragmentGenerator derived class for testing.
The RequestSender contains methods used to send data requests and Routing tokens. ...
void StopCmd(uint64_t timeout, uint64_t timestamp)
Stop the CommandableFragmentGenerator.
CommandableFragmentGeneratorTest(const fhicl::ParameterSet &ps)
CommandableFragmentGeneratorTest Constructor.
void StartCmd(int run, uint64_t timeout, uint64_t timestamp)
Start the CommandableFragmentGenerator.
bool getNext(FragmentPtrs &output) overridefinal
getNext calls either applyRequests or getNext_ to get any data that is ready to be sent to the EventB...
std::map< Fragment::sequence_id_t, std::chrono::steady_clock::time_point > GetSentWindowList(Fragment::fragment_id_t id)
Get the map of Window-mode requests fulfilled by this Fragment Geneerator for the given Fragment ID...
bool checkHWStatus_() override
Returns whether the hwFail flag has not been set.
void stopNoMutex() override
Perform immediate stop actions. No-Op.
void SetRunNumber(uint32_t run)
Set the run number to be used in request messages.
void start() override
Perform start actions. No-Op.
CommandableFragmentGenerator is a FragmentGenerator-derived abstract class that defines the interface...
void resume() override
Perform resume actions. No-Op.
void pause() override
Perform pause actions. No-Op.
size_t ev_counter() const
Get the current value of the event counter.
bool RequestsInFlight()
Determine if the RequestSender is currently sending any requests.
void setHwFail()
Set the hwFail flag.
void setTimestamp(artdaq::Fragment::timestamp_t ts)
Set the timestamp to be used for the next Fragment.
artdaq::Fragment::timestamp_t getTimestamp()
Get the timestamp that will be used for the next Fragment.
void stop() override
Perform stop actions. No-Op.
void AddRequest(Fragment::sequence_id_t seqID, Fragment::timestamp_t timestamp)
Add a request to the request list.
void waitForFrags()
Wait for all fragments generated to be read by the CommandableFragmentGenerator
void joinThreads()
Join any data-taking threads. Should be called when destructing CommandableFragmentGenerator.
void setFireCount(size_t count)
Have getNext_ generate count fragments.