diff options
Diffstat (limited to 'src/testing/test_testing_portreservation.c')
-rw-r--r-- | src/testing/test_testing_portreservation.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/testing/test_testing_portreservation.c b/src/testing/test_testing_portreservation.c index 86ecc494a..308d462b7 100644 --- a/src/testing/test_testing_portreservation.c +++ b/src/testing/test_testing_portreservation.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 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/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -29,8 +29,8 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_testing_lib.h" | 30 | #include "gnunet_testing_lib.h" |
31 | 31 | ||
32 | #define LOG(kind,...) \ | 32 | #define LOG(kind, ...) \ |
33 | GNUNET_log (kind, __VA_ARGS__) | 33 | GNUNET_log(kind, __VA_ARGS__) |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * The status of the test | 36 | * The status of the test |
@@ -41,46 +41,46 @@ int status; | |||
41 | * Main point of test execution | 41 | * Main point of test execution |
42 | */ | 42 | */ |
43 | static void | 43 | static void |
44 | run (void *cls, char *const *args, const char *cfgfile, | 44 | run(void *cls, char *const *args, const char *cfgfile, |
45 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 45 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
46 | { | 46 | { |
47 | struct GNUNET_TESTING_System *system; | 47 | struct GNUNET_TESTING_System *system; |
48 | uint16_t new_port1; | 48 | uint16_t new_port1; |
49 | uint16_t new_port2; | 49 | uint16_t new_port2; |
50 | uint16_t old_port1; | 50 | uint16_t old_port1; |
51 | 51 | ||
52 | system = GNUNET_TESTING_system_create ("/tmp/gnunet-testing-new", | 52 | system = GNUNET_TESTING_system_create("/tmp/gnunet-testing-new", |
53 | "localhost", NULL, NULL); | 53 | "localhost", NULL, NULL); |
54 | GNUNET_assert (NULL != system); | 54 | GNUNET_assert(NULL != system); |
55 | new_port1 = GNUNET_TESTING_reserve_port (system); | 55 | new_port1 = GNUNET_TESTING_reserve_port(system); |
56 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 56 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
57 | "Reserved TCP port %u\n", new_port1); | 57 | "Reserved TCP port %u\n", new_port1); |
58 | if (0 == new_port1) | 58 | if (0 == new_port1) |
59 | goto end; | 59 | goto end; |
60 | new_port2 = GNUNET_TESTING_reserve_port (system); | 60 | new_port2 = GNUNET_TESTING_reserve_port(system); |
61 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 61 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
62 | "Reserved TCP port %u\n", new_port2); | 62 | "Reserved TCP port %u\n", new_port2); |
63 | if (0 == new_port2) | 63 | if (0 == new_port2) |
64 | goto end; | 64 | goto end; |
65 | GNUNET_assert (new_port1 != new_port2); | 65 | GNUNET_assert(new_port1 != new_port2); |
66 | GNUNET_TESTING_release_port (system, new_port1); | 66 | GNUNET_TESTING_release_port(system, new_port1); |
67 | old_port1 = new_port1; | 67 | old_port1 = new_port1; |
68 | new_port1 = 0; | 68 | new_port1 = 0; |
69 | new_port1 = GNUNET_TESTING_reserve_port (system); | 69 | new_port1 = GNUNET_TESTING_reserve_port(system); |
70 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 70 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
71 | "Reserved TCP port %u\n", new_port1); | 71 | "Reserved TCP port %u\n", new_port1); |
72 | GNUNET_assert (0 != new_port1); | 72 | GNUNET_assert(0 != new_port1); |
73 | GNUNET_assert (old_port1 == new_port1); | 73 | GNUNET_assert(old_port1 == new_port1); |
74 | GNUNET_TESTING_release_port (system, new_port1); | 74 | GNUNET_TESTING_release_port(system, new_port1); |
75 | GNUNET_TESTING_release_port (system, new_port2); | 75 | GNUNET_TESTING_release_port(system, new_port2); |
76 | status = GNUNET_OK; | 76 | status = GNUNET_OK; |
77 | 77 | ||
78 | end: | 78 | end: |
79 | GNUNET_TESTING_system_destroy (system, GNUNET_YES); | 79 | GNUNET_TESTING_system_destroy(system, GNUNET_YES); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | int main (int argc, char *argv[]) | 83 | int main(int argc, char *argv[]) |
84 | { | 84 | { |
85 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 85 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
86 | GNUNET_GETOPT_OPTION_END | 86 | GNUNET_GETOPT_OPTION_END |
@@ -88,14 +88,14 @@ int main (int argc, char *argv[]) | |||
88 | 88 | ||
89 | status = GNUNET_SYSERR; | 89 | status = GNUNET_SYSERR; |
90 | if (GNUNET_OK != | 90 | if (GNUNET_OK != |
91 | GNUNET_PROGRAM_run (argc, | 91 | GNUNET_PROGRAM_run(argc, |
92 | argv, | 92 | argv, |
93 | "test_testing_new_portreservation", | 93 | "test_testing_new_portreservation", |
94 | "test case for testing port reservation routines" | 94 | "test case for testing port reservation routines" |
95 | " from the new testing library API", | 95 | " from the new testing library API", |
96 | options, | 96 | options, |
97 | &run, | 97 | &run, |
98 | NULL)) | 98 | NULL)) |
99 | return 1; | 99 | return 1; |
100 | return (GNUNET_OK == status) ? 0 : 1; | 100 | return (GNUNET_OK == status) ? 0 : 1; |
101 | } | 101 | } |