Skip to content
Snippets Groups Projects
Commit 18c98770 authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto :mushroom:
Browse files

[fix] Pipeline and headers in tests

parent 5301cfc3
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include <fstream> #include <fstream>
#include <future> #include <future>
#include "scdaq/config.h" #include "config.h"
#include "scdaq/exception.h" #include "exception.h"
namespace { namespace {
...@@ -121,7 +121,7 @@ TEST(ConfigTest, LoadConfigurationPassthrough) { ...@@ -121,7 +121,7 @@ TEST(ConfigTest, LoadConfigurationPassthrough) {
EXPECT_TRUE(cfg.getEnableStreamProcessor()); EXPECT_TRUE(cfg.getEnableStreamProcessor());
// Output settings // Output settings
EXPECT_STREQ(cfg.getOutputFilenameBase().c_str(), "test"); EXPECT_STREQ(cfg.getOutputFilenameBase().c_str(), "test/data");
EXPECT_STREQ(cfg.getOutputFilenamePrefix().c_str(), "pass_gmt_1"); EXPECT_STREQ(cfg.getOutputFilenamePrefix().c_str(), "pass_gmt_1");
EXPECT_EQ(cfg.getOutputMaxFileSize(), 8589934592); EXPECT_EQ(cfg.getOutputMaxFileSize(), 8589934592);
EXPECT_TRUE(cfg.getOutputForceWrite()); EXPECT_TRUE(cfg.getOutputForceWrite());
......
...@@ -6,22 +6,20 @@ ...@@ -6,22 +6,20 @@
#include <stdexcept> #include <stdexcept>
#include <thread> #include <thread>
#include "scdaq/config.h" #include "config.h"
#include "scdaq/exception.h" #include "exception.h"
#include "scdaq/pipeline.h" #include "pipeline.h"
ctrl Pipeline::control;
namespace { namespace {
// Runs SCDAQ as configured by `cfg` for `secs` seconds before timing out. // Runs SCDAQ as configured by `cfg` for `secs` seconds before timing out.
// Propagates any exceptions that occur before the timeout period elapses. // Propagates any exceptions that occur before the timeout period elapses.
int bounded_run(config &cfg, int secs) { int bounded_run(config &cfg, int secs) {
ctrl control{}; std::vector<config> vecConfigs = {cfg};
control.max_file_size = cfg.getOutputMaxFileSize(); MultiPipeline p(vecConfigs);
control.packets_per_report = cfg.getPacketsPerReport(); auto pipeline = [&p] { return p.Run(); };
control.output_force_write = cfg.getOutputForceWrite();
control.n_orbits_per_packet = cfg.getNOrbitsPerPacket();
auto pipeline = [&control, &cfg] { return run_pipeline(cfg.getNumThreads(), control, cfg); };
std::packaged_task<int()> pipelineTask(pipeline); std::packaged_task<int()> pipelineTask(pipeline);
std::future<int> outcome = pipelineTask.get_future(); std::future<int> outcome = pipelineTask.get_future();
...@@ -29,7 +27,7 @@ int bounded_run(config &cfg, int secs) { ...@@ -29,7 +27,7 @@ int bounded_run(config &cfg, int secs) {
int timedOut = (outcome.wait_for(std::chrono::seconds(secs)) == std::future_status::timeout); int timedOut = (outcome.wait_for(std::chrono::seconds(secs)) == std::future_status::timeout);
if (timedOut) { if (timedOut) {
control.running = false; Pipeline::control.running = false;
th.detach(); th.detach();
} else { } else {
th.join(); th.join();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment