LCOV - code coverage report
Current view: top level - testing - testing_api_trait_process.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 5 5 100.0 %
Date: 2021-08-30 06:43:37 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2018 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify
       6             :   it under the terms of the GNU General Public License as
       7             :   published by the Free Software Foundation; either version 3,
       8             :   or (at your option) any later version.
       9             : 
      10             :   TALER is distributed in the hope that it will be useful,
      11             :   but WITHOUT ANY WARRANTY; without even the implied warranty
      12             :   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      13             :   See the GNU General Public License for more details.
      14             : 
      15             :   You should have received a copy of the GNU General Public
      16             :   License along with TALER; see the file COPYING.  If not, see
      17             :   <http://www.gnu.org/licenses/>
      18             : */
      19             : 
      20             : /**
      21             :  * @file testing/testing_api_trait_process.c
      22             :  * @brief trait offering process handles.
      23             :  * @author Christian Grothoff
      24             :  * @author Marcello Stanisci
      25             :  */
      26             : #include "platform.h"
      27             : #include "taler_json_lib.h"
      28             : #include <gnunet/gnunet_curl_lib.h>
      29             : #include "taler_signatures.h"
      30             : #include "taler_testing_lib.h"
      31             : 
      32             : #define TALER_TESTING_TRAIT_PROCESS "process"
      33             : 
      34             : 
      35             : /**
      36             :  * Obtain location where a command stores a pointer to a process.
      37             :  *
      38             :  * @param cmd command to extract trait from.
      39             :  * @param index which process to pick if @a cmd
      40             :  *        has multiple on offer.
      41             :  * @param[out] processp set to the address of the pointer to the
      42             :  *        process.
      43             :  * @return #GNUNET_OK on success.
      44             :  */
      45             : int
      46         130 : TALER_TESTING_get_trait_process
      47             :   (const struct TALER_TESTING_Command *cmd,
      48             :   unsigned int index,
      49             :   struct GNUNET_OS_Process ***processp)
      50             : {
      51         130 :   return cmd->traits (cmd->cls,
      52             :                       (const void **) processp,
      53             :                       TALER_TESTING_TRAIT_PROCESS,
      54             :                       index);
      55             : }
      56             : 
      57             : 
      58             : /**
      59             :  * Offer location where a command stores a pointer to a process.
      60             :  *
      61             :  * @param index offered location index number, in case there are
      62             :  *        multiple on offer.
      63             :  * @param processp process location to offer.
      64             :  *
      65             :  * @return the trait.
      66             :  */
      67             : struct TALER_TESTING_Trait
      68         328 : TALER_TESTING_make_trait_process
      69             :   (unsigned int index,
      70             :   struct GNUNET_OS_Process **processp)
      71             : {
      72         328 :   struct TALER_TESTING_Trait ret = {
      73             :     .index = index,
      74             :     .trait_name = TALER_TESTING_TRAIT_PROCESS,
      75             :     .ptr = (const void *) processp
      76             :   };
      77             : 
      78         328 :   return ret;
      79             : }
      80             : 
      81             : 
      82             : /* end of testing_api_trait_process.c */

Generated by: LCOV version 1.14