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: 2025-12-21 13:07:08 Functions: 0.0 % 1 0

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

Generated by: LCOV version 2.0-1