|
@@ -14,6 +14,14 @@ static const char *valids[] = {
|
14
|
14
|
"unix://foo.sock",
|
15
|
15
|
NULL};
|
16
|
16
|
|
|
17
|
+static const char *valids6[] = {
|
|
18
|
+ "tcp://localhost:8181",
|
|
19
|
+ "udp://localhost:8000",
|
|
20
|
+ //"tcp://::1:8000",
|
|
21
|
+ "unix:///tmp/test/test.sock",
|
|
22
|
+ "unix://foo.sock",
|
|
23
|
+ NULL};
|
|
24
|
+
|
17
|
25
|
static const char *invalids[] = {
|
18
|
26
|
"localhost:8000",
|
19
|
27
|
"ttt://127.0.0.1:81",
|
|
@@ -55,7 +63,7 @@ START_TEST(test_check_sock_invalid)
|
55
|
63
|
}
|
56
|
64
|
END_TEST
|
57
|
65
|
|
58
|
|
-START_TEST(test_parse_sock_valid_v4)
|
|
66
|
+START_TEST(test_parse_sock_valid_ipv4)
|
59
|
67
|
{
|
60
|
68
|
pyfcgi_monitor_addr_t addr;
|
61
|
69
|
int domain, type, protocol, args[3], ret, i;
|
|
@@ -97,6 +105,47 @@ START_TEST(test_parse_sock_valid_v4)
|
97
|
105
|
}
|
98
|
106
|
END_TEST
|
99
|
107
|
|
|
108
|
+START_TEST(test_parse_sock_valid_ipv6)
|
|
109
|
+{
|
|
110
|
+ pyfcgi_monitor_addr_t addr;
|
|
111
|
+ int domain, type, protocol, args[3], ret, i;
|
|
112
|
+ const char **urls;
|
|
113
|
+ char err_msg[256];
|
|
114
|
+
|
|
115
|
+ const int expt_ret[] = {
|
|
116
|
+ AF_INET6, SOCK_STREAM, 0,
|
|
117
|
+ AF_INET6, SOCK_DGRAM, 0,
|
|
118
|
+ AF_UNIX, SOCK_STREAM, 0,
|
|
119
|
+ AF_UNIX, SOCK_STREAM, 0,};
|
|
120
|
+ const int *expts = expt_ret;
|
|
121
|
+
|
|
122
|
+ PyFCGI_conf.ipv6 = 1;
|
|
123
|
+ i=0;
|
|
124
|
+
|
|
125
|
+ for(urls=valids6; *urls != NULL; urls++)
|
|
126
|
+ {
|
|
127
|
+ ret = pyfcgi_monitor_parse_sock(*urls, args, &addr);
|
|
128
|
+ snprintf(err_msg, 256,
|
|
129
|
+ "returns %d != 0 but '%s' given",
|
|
130
|
+ ret, *urls);
|
|
131
|
+ ck_assert_msg(ret == 0, err_msg);
|
|
132
|
+
|
|
133
|
+ domain = args[0];
|
|
134
|
+ type = args[1];
|
|
135
|
+ protocol = args[2];
|
|
136
|
+
|
|
137
|
+ ck_assert_int_eq(expts[0], domain);
|
|
138
|
+ ck_assert_int_eq(expts[1], type);
|
|
139
|
+ ck_assert_int_eq(expts[2], protocol);
|
|
140
|
+
|
|
141
|
+ /**@todo check returned address */
|
|
142
|
+ expts+=3;
|
|
143
|
+ i+=1;
|
|
144
|
+ }
|
|
145
|
+}
|
|
146
|
+END_TEST
|
|
147
|
+
|
|
148
|
+
|
100
|
149
|
Suite * logger_suite(void)
|
101
|
150
|
{
|
102
|
151
|
Suite *s;
|
|
@@ -106,7 +155,8 @@ Suite * logger_suite(void)
|
106
|
155
|
tc_sockurl = tcase_create("Socket URL handling functions");
|
107
|
156
|
tcase_add_test(tc_sockurl, test_check_sock_valid);
|
108
|
157
|
tcase_add_test(tc_sockurl, test_check_sock_invalid);
|
109
|
|
- tcase_add_test(tc_sockurl, test_parse_sock_valid_v4);
|
|
158
|
+ tcase_add_test(tc_sockurl, test_parse_sock_valid_ipv4);
|
|
159
|
+ tcase_add_test(tc_sockurl, test_parse_sock_valid_ipv6);
|
110
|
160
|
|
111
|
161
|
suite_add_tcase(s, tc_sockurl);
|
112
|
162
|
return s;
|