diff options
Diffstat (limited to 'src/transport/test_transport_start_with_config.c')
-rw-r--r-- | src/transport/test_transport_start_with_config.c | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/src/transport/test_transport_start_with_config.c b/src/transport/test_transport_start_with_config.c index 795c157d7..932b0e583 100644 --- a/src/transport/test_transport_start_with_config.c +++ b/src/transport/test_transport_start_with_config.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file transport/test_transport_start_with_config.c | 22 | * @file transport/test_transport_start_with_config.c |
23 | * @brief Test case executing a script which sends a test message between two peers. | 23 | * @brief Generic program to start testcases in an configurable topology. |
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
@@ -29,57 +29,32 @@ | |||
29 | 29 | ||
30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | 30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) |
31 | 31 | ||
32 | /** | ||
33 | * Return value of the test. | ||
34 | * | ||
35 | */ | ||
36 | static unsigned int rv = 0; | ||
37 | |||
38 | static char *topology_config; | ||
39 | |||
40 | /** | ||
41 | * Main function to run the test cases. | ||
42 | * | ||
43 | * @param cls not used. | ||
44 | * | ||
45 | */ | ||
46 | static void | ||
47 | run (void *cls) | ||
48 | { | ||
49 | struct GNUNET_TESTING_Command commands[] = { | ||
50 | GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start", | ||
51 | topology_config), | ||
52 | GNUNET_TESTING_cmd_netjail_start_testing_system_v2 ("netjail-start-testbed", | ||
53 | topology_config, | ||
54 | &rv), | ||
55 | GNUNET_TESTING_cmd_stop_testing_system_v2 ("stop-testbed", | ||
56 | "netjail-start-testbed", | ||
57 | topology_config), | ||
58 | GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop", | ||
59 | topology_config), | ||
60 | GNUNET_TESTING_cmd_end () | ||
61 | }; | ||
62 | |||
63 | GNUNET_TESTING_run (NULL, | ||
64 | commands, | ||
65 | TIMEOUT); | ||
66 | } | ||
67 | |||
68 | 32 | ||
69 | int | 33 | int |
70 | main (int argc, | 34 | main (int argc, |
71 | char *const *argv) | 35 | char *const *argv) |
72 | { | 36 | { |
37 | char *topology_config; | ||
38 | |||
73 | GNUNET_log_setup ("test-netjail", | 39 | GNUNET_log_setup ("test-netjail", |
74 | "DEBUG", | 40 | "DEBUG", |
75 | NULL); | 41 | NULL); |
76 | 42 | ||
77 | topology_config = argv[1]; | 43 | topology_config = argv[1]; |
78 | 44 | ||
79 | GNUNET_SCHEDULER_run (&run, | 45 | struct GNUNET_TESTING_Command commands[] = { |
80 | NULL); | 46 | GNUNET_TESTING_cmd_netjail_start ("netjail-start", |
47 | topology_config), | ||
48 | GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed", | ||
49 | topology_config), | ||
50 | GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed", | ||
51 | "netjail-start-testbed", | ||
52 | topology_config), | ||
53 | GNUNET_TESTING_cmd_netjail_stop ("netjail-stop", | ||
54 | topology_config), | ||
55 | GNUNET_TESTING_cmd_end () | ||
56 | }; | ||
81 | 57 | ||
82 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 58 | return GNUNET_TESTING_main (commands, |
83 | "Test finished!\n"); | 59 | TIMEOUT); |
84 | return rv; | ||
85 | } | 60 | } |