artdaq_core  v3_08_02
GenFile_t.cc
1 #include "artdaq-core/Utilities/ExceptionHandler.hh"
2 #include "artdaq-core/Utilities/configureMessageFacility.hh"
3 
4 #define BOOST_TEST_MODULE GenFile_t
5 #include <fhiclcpp/make_ParameterSet.h>
6 #include <boost/filesystem.hpp>
7 #include "cetlib/quiet_unit_test.hpp"
8 #include "cetlib_except/exception.h"
9 
10 #define TRACE_NAME "GenFile_t"
11 #include "tracemf.h"
12 
13 BOOST_AUTO_TEST_SUITE(GenFile_test)
14 
15 BOOST_AUTO_TEST_CASE(genFileFileNameFlags)
16 {
17  setenv("ARTDAQ_LOG_ROOT", "/tmp", 1);
18  auto pstr = artdaq::generateMessageFacilityConfiguration("configureMessageFacility_t", true, true, "-%N-%H-%T-%U-%%-%?N-%?L-");
19 
20  fhicl::ParameterSet pset;
21 #ifdef SIMPLER_PSET_MAKE
22  BOOST_REQUIRE_NO_THROW(pset = fhicl::ParameterSet::make(pstr));
23 #else
24  BOOST_REQUIRE_NO_THROW(fhicl::make_ParameterSet(pstr, pset));
25 #endif
26  mf::StartMessageFacility(pset, "configureMessageFacility_t");
27 
28  mf::LogInfo("Test") << "Test Message";
29  TLOG(TLVL_INFO) << "Test TRACE";
30 
31  boost::filesystem::remove_all("/tmp/configureMessageFacility_t");
32 }
33 
34 BOOST_AUTO_TEST_SUITE_END()
std::string generateMessageFacilityConfiguration(char const *progname, bool useConsole=true, bool printDebug=false, char const *fileExtraName="")
Create the MessageFacility configuration Fhicl string.