diff options
author | t3sserakt <t3ss@posteo.de> | 2021-03-04 10:41:01 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-03-04 10:42:39 +0100 |
commit | e5d31aa52e4983bffce3eca6ca601bbb8f4a302a (patch) | |
tree | 1878b4c6595b4b3d402988c1df772adf48908622 /src/testing/testing_api_trait_process.c | |
parent | 46111957db87028c369ea4792b9c533a9dd09a33 (diff) | |
download | gnunet-e5d31aa52e4983bffce3eca6ca601bbb8f4a302a.tar.gz gnunet-e5d31aa52e4983bffce3eca6ca601bbb8f4a302a.zip |
- first try to integrate GNU Taler command style testing
Diffstat (limited to 'src/testing/testing_api_trait_process.c')
-rw-r--r-- | src/testing/testing_api_trait_process.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_process.c b/src/testing/testing_api_trait_process.c new file mode 100644 index 000000000..7d694e35d --- /dev/null +++ b/src/testing/testing_api_trait_process.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2008, 2009, 2012 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet 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 GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_trait_process.c | ||
23 | * @brief trait offering process handles. | ||
24 | * @author Christian Grothoff (GNU Taler testing) | ||
25 | * @author Marcello Stanisci (GNU Taler testing) | ||
26 | * @author t3sserakt | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_testing_ng_lib.h" | ||
30 | |||
31 | #define GNUNET_TESTING_TRAIT_PROCESS "process" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Obtain location where a command stores a pointer to a process. | ||
36 | * | ||
37 | * @param cmd command to extract trait from. | ||
38 | * @param index which process to pick if @a cmd | ||
39 | * has multiple on offer. | ||
40 | * @param[out] processp set to the address of the pointer to the | ||
41 | * process. | ||
42 | * @return #GNUNET_OK on success. | ||
43 | */ | ||
44 | int | ||
45 | GNUNET_TESTING_get_trait_process | ||
46 | (const struct GNUNET_TESTING_Command *cmd, | ||
47 | unsigned int index, | ||
48 | struct GNUNET_OS_Process ***processp) | ||
49 | { | ||
50 | return cmd->traits (cmd->cls, | ||
51 | (const void **) processp, | ||
52 | GNUNET_TESTING_TRAIT_PROCESS, | ||
53 | index); | ||
54 | } | ||
55 | |||
56 | |||
57 | /** | ||
58 | * Offer location where a command stores a pointer to a process. | ||
59 | * | ||
60 | * @param index offered location index number, in case there are | ||
61 | * multiple on offer. | ||
62 | * @param processp process location to offer. | ||
63 | * | ||
64 | * @return the trait. | ||
65 | */ | ||
66 | struct GNUNET_TESTING_Trait | ||
67 | GNUNET_TESTING_make_trait_process | ||
68 | (unsigned int index, | ||
69 | struct GNUNET_OS_Process **processp) | ||
70 | { | ||
71 | struct GNUNET_TESTING_Trait ret = { | ||
72 | .index = index, | ||
73 | .trait_name = GNUNET_TESTING_TRAIT_PROCESS, | ||
74 | .ptr = (const void *) processp | ||
75 | }; | ||
76 | |||
77 | return ret; | ||
78 | } | ||
79 | |||
80 | |||
81 | /* end of testing_api_trait_process.c */ | ||