LCOV - code coverage report
Current view: top level - tests/harness - backendmanager_remote.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core c2b6f1024d3a Lines: 19 19 100.0 %
Date: 2019-05-16 09:13:18 Functions: 4 4 100.0 %
Branches: 16 32 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file backendmanager_remote.cc
       2                 :            :  * @brief BackendManager subclass for remote databases.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2006,2007,2008,2009,2011,2015 Olly Betts
       5                 :            :  * Copyright (C) 2008 Lemur Consulting Ltd
       6                 :            :  *
       7                 :            :  * This program is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU General Public License as
       9                 :            :  * published by the Free Software Foundation; either version 2 of the
      10                 :            :  * License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This program is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            :  * GNU General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU General Public License
      18                 :            :  * along with this program; if not, write to the Free Software
      19                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #include <config.h>
      23                 :            : #include "backendmanager_remote.h"
      24                 :            : 
      25                 :            : #include "backendmanager_glass.h"
      26                 :            : #include <cstdlib>
      27                 :            : #include <string>
      28                 :            : #include "str.h"
      29                 :            : 
      30                 :            : std::string
      31                 :        172 : BackendManagerRemote::get_writable_database_args(const std::string & name,
      32                 :            :                                                  const std::string & file)
      33                 :            : {
      34                 :            :     // Default to a long (5 minute) timeout so that tests won't fail just
      35                 :            :     // because the host is slow or busy.
      36         [ +  - ]:        172 :     std::string args = "-t300000 --writable ";
      37                 :            : 
      38         [ +  - ]:        172 :     sub_manager->get_writable_database(name, file);
      39 [ +  - ][ +  - ]:        172 :     args += sub_manager->get_writable_database_path(name);
      40                 :            : 
      41                 :        172 :     return args;
      42                 :            : }
      43                 :            : 
      44                 :            : std::string
      45                 :        514 : BackendManagerRemote::get_remote_database_args(const std::vector<std::string> & files,
      46                 :            :                                                unsigned int timeout)
      47                 :            : {
      48         [ +  - ]:        514 :     std::string args = "-t";
      49 [ +  - ][ +  - ]:        514 :     args += str(timeout);
      50         [ +  - ]:        514 :     args += ' ';
      51 [ +  - ][ +  - ]:        514 :     args += sub_manager->get_database_path(files);
      52                 :        514 :     return args;
      53                 :            : }
      54                 :            : 
      55                 :            : std::string
      56                 :         22 : BackendManagerRemote::get_writable_database_as_database_args()
      57                 :            : {
      58         [ +  - ]:         22 :     std::string args = "-t300000 ";
      59 [ +  - ][ +  - ]:         22 :     args += sub_manager->get_writable_database_path_again();
      60                 :         22 :     return args;
      61                 :            : }
      62                 :            : 
      63                 :            : std::string
      64                 :          2 : BackendManagerRemote::get_writable_database_again_args()
      65                 :            : {
      66         [ +  - ]:          2 :     std::string args = "-t300000 --writable ";
      67 [ +  - ][ +  - ]:          2 :     args += sub_manager->get_writable_database_path_again();
      68                 :          2 :     return args;
      69                 :            : }

Generated by: LCOV version 1.11