testing_api_loop.c (2555B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2018-2023 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it 6 under the terms of the GNU General Public License as published 7 by the Free Software Foundation; either version 3, or (at your 8 option) any later version. 9 10 TALER is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 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_loop.c 22 * @brief main interpreter loop for testcases 23 * @author Lukas Matyja 24 */ 25 #include "donau_config.h" 26 #include <taler/taler_json_lib.h> 27 #include <gnunet/gnunet_curl_lib.h> 28 #include <taler/taler_signatures.h> 29 #include <taler/taler_testing_lib.h> 30 #include "donau_testing_lib.h" 31 #include "donau_util.h" 32 33 34 int 35 DONAU_TESTING_main (char *const *argv, 36 const char *loglevel, 37 const char *cfg_file, 38 struct TALER_TESTING_Credentials *cred, 39 TALER_TESTING_Main main_cb, 40 void *main_cb_cls) 41 { 42 enum GNUNET_GenericReturnValue ret; 43 44 unsetenv ("XDG_DATA_HOME"); 45 unsetenv ("XDG_CONFIG_HOME"); 46 GNUNET_log_setup (argv[0], 47 loglevel, 48 NULL); 49 cred->cfg = GNUNET_CONFIGURATION_create (DONAU_project_data ()); 50 if (GNUNET_OK != 51 GNUNET_CONFIGURATION_load (cred->cfg, 52 cfg_file)) 53 { 54 GNUNET_break (0); 55 GNUNET_CONFIGURATION_destroy (cred->cfg); 56 return GNUNET_SYSERR; 57 } 58 if (GNUNET_OK != 59 GNUNET_CONFIGURATION_get_value_string (cred->cfg, 60 "donau", 61 "BASE_URL", 62 &cred->exchange_url)) 63 { 64 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 65 "donau", 66 "BASE_URL"); 67 return GNUNET_SYSERR; 68 } 69 // if (GNUNET_OK != 70 // TALER_TESTING_cleanup_files_cfg (NULL, 71 // cred->cfg)) 72 // { 73 // GNUNET_break (0); 74 // return 77; 75 // } 76 ret = TALER_TESTING_loop (main_cb, 77 main_cb_cls); 78 /* FIXME: should we free 'cred' resources here? */ 79 return (GNUNET_OK == ret) ? 0 : 1; 80 }