LCOV - code coverage report
Current view: top level - oksconflibs/test/apps - test_create_oksdb.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 33 0
Test Date: 2026-07-12 15:23:06 Functions: 0.0 % 1 0

            Line data    Source code
       1              : //
       2              : // DUNE DAQ modification notice:
       3              : // This file has been modified from the original ATLAS oksconfig source for the DUNE DAQ project.
       4              : // Fork baseline commit: oksconfig-03-02-00 (2021-04-20).
       5              : // Renamed since fork: yes (from test/test_create_oksdb.cpp to test/apps/test_create_oksdb.cxx).
       6              : //
       7              : 
       8              : #include <stdlib.h>
       9              : #include <iostream>
      10              : 
      11              : #include "conffwk/Configuration.hpp"
      12              : #include "conffwk/ConfigObject.hpp"
      13              : 
      14              : using namespace dunedaq;
      15              : using namespace dunedaq::conffwk;
      16              : 
      17            0 : int main(int argc, char *argv[])
      18              : {
      19            0 :   std::string dbname = "oksconflibs:../test/okstest.data.xml:../test/test2.data.xml";
      20              : 
      21            0 :   if(argc < 3) {
      22            0 :     std::cerr <<
      23              :       "Usage: test_create_oksdb out-file in-file-1 in-file-2 [...]\n"
      24              :       "  out-file   - existing or new file name\n"
      25              :       "  in-file1   - first file to be added to out-file\n"
      26              :       "  in-file2   - second file to be added to out-file\n"
      27            0 :       "  ...        - list of files to be added to out-file\n";
      28              :     return 1;
      29              :   }
      30              : 
      31            0 :   const char * db_name = argv[1];
      32              : 
      33              : 
      34              :       // start of real test program
      35              : 
      36            0 :   Configuration db("oksconflibs");
      37              : 
      38              : 
      39            0 :   try {
      40            0 :     bool db_exist = false;
      41              : 
      42            0 :     try {
      43            0 :       db.load(db_name);
      44            0 :       db_exist = true;
      45            0 :       std::cout << "database file " << db_name << " already created" << std::endl;
      46              :     }
      47            0 :     catch(dunedaq::conffwk::Exception & dummu) {
      48            0 :       std::cout << "create database file " << db_name << std::endl;
      49            0 :     }
      50              : 
      51              :       // create db if it does not exist
      52            0 :     if(!db_exist) {
      53            0 :       std::list<std::string> includes;
      54            0 :       for(int i = 2; i < argc; ++i) {
      55            0 :         std::cout << "- include file " << argv[i] << std::endl;
      56            0 :         includes.push_back(argv[i]);
      57              :       }
      58              : 
      59            0 :       db.create(db_name, includes);
      60            0 :     }
      61              :     else {
      62            0 :       for(int i = 2; i < argc; ++i) {
      63            0 :         std::cout << "- include file " << argv[i] << std::endl;
      64            0 :         db.add_include(db_name, argv[i]);
      65              :       }
      66              :     }
      67              : 
      68            0 :     db.commit("test application (oksconflibs/test/test_create_oksdb.cpp)");
      69              : 
      70            0 :     std::cout << "done, see file \'" << db_name << "\'\n";
      71              :   }
      72            0 :   catch(dunedaq::conffwk::Exception & ex) {
      73            0 :     std::cerr << "ERROR: " << ex << std::endl;
      74            0 :     return 1;
      75            0 :   }
      76              : 
      77              :   return 0;
      78            0 : }
        

Generated by: LCOV version 2.0-1