Merge lp:~brianaker/libdrizzle/signal-skip-test into lp:libdrizzle

Proposed by Brian Aker
Status: Merged
Approved by: Andrew Hutchings
Approved revision: 55
Merged at revision: 55
Proposed branch: lp:~brianaker/libdrizzle/signal-skip-test
Merge into: lp:libdrizzle
Diff against target: 209 lines (+48/-14)
8 files modified
configure.ac (+3/-0)
libdrizzle/conn.cc (+20/-3)
libdrizzle/drizzle.cc (+0/-6)
tests/unit/binlog.c (+5/-1)
tests/unit/connect.c (+5/-1)
tests/unit/insert_id.c (+5/-1)
tests/unit/query.c (+5/-1)
tests/unit/unbuffered_query.c (+5/-1)
To merge this branch: bzr merge lp:~brianaker/libdrizzle/signal-skip-test
Reviewer Review Type Date Requested Status
Andrew Hutchings Pending
Review via email: mp+141039@code.launchpad.net

Description of the change

Fixes signal usage (mostly) and adds EXIT_SKIP to allow for "make check" to work.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-12-20 14:19:01 +0000
3+++ configure.ac 2012-12-21 07:30:29 +0000
4@@ -70,10 +70,13 @@
5 CHECK_FOR_CXXABI
6 AC_CHECK_HEADERS_ONCE([errno.h])
7 AC_CHECK_HEADERS_ONCE([sys/socket.h])
8+AC_CHECK_HEADERS_ONCE([poll.h])
9
10 # Checks for typedefs, structures, and compiler characteristics.
11
12 # Checks for library functions.
13+AC_CHECK_FUNCS([poll])
14+AC_CHECK_FUNCS([ppoll])
15
16 AX_ENDIAN
17 AX_HEX_VERSION([LIBDRIZZLE],[$VERSION])
18
19=== modified file 'libdrizzle/conn.cc'
20--- libdrizzle/conn.cc 2012-12-19 12:07:00 +0000
21+++ libdrizzle/conn.cc 2012-12-21 07:30:29 +0000
22@@ -44,6 +44,10 @@
23 #include "config.h"
24 #include "libdrizzle/common.h"
25
26+#ifndef MSG_NOSIGNAL
27+# define MSG_NOSIGNAL 0
28+#endif
29+
30 /**
31 * @addtogroup drizzle_con_static Static Connection Declarations
32 * @ingroup drizzle_con
33@@ -1146,8 +1150,7 @@
34 read_size= SSL_read(con->ssl, (char*)con->buffer_ptr + con->buffer_size, available_buffer);
35 else
36 #endif
37- read_size = recv(con->fd, (char *)con->buffer_ptr + con->buffer_size,
38- available_buffer, 0);
39+ read_size= recv(con->fd, (char *)con->buffer_ptr + con->buffer_size, available_buffer, MSG_NOSIGNAL);
40 #ifdef _WIN32
41 errno = WSAGetLastError();
42 switch(errno) {
43@@ -1272,7 +1275,7 @@
44 write_size= SSL_write(con->ssl, con->buffer_ptr, con->buffer_size);
45 else
46 #endif
47- write_size = send(con->fd,(char *) con->buffer_ptr, con->buffer_size, 0);
48+ write_size = send(con->fd,(char *) con->buffer_ptr, con->buffer_size, MSG_NOSIGNAL);
49
50 #ifdef _WIN32
51 errno = WSAGetLastError();
52@@ -1468,6 +1471,20 @@
53 return DRIZZLE_RETURN_ERRNO;
54 }
55
56+#if defined(SO_NOSIGPIPE)
57+ if (SO_NOSIGPIPE)
58+ {
59+ int ret= 1;
60+ ret= setsockopt(con->fd, SOL_SOCKET, SO_NOSIGPIPE, static_cast<void *>(&ret), sizeof(int));
61+
62+ if (ret == -1)
63+ {
64+ drizzle_set_error(con->drizzle, __func__, "setsockopt(SO_NOSIGPIPE): %s", strerror(errno));
65+ return DRIZZLE_RETURN_ERRNO;
66+ }
67+ }
68+#endif
69+
70 #if defined (_WIN32)
71 {
72 unsigned long asyncmode;
73
74=== modified file 'libdrizzle/drizzle.cc'
75--- libdrizzle/drizzle.cc 2012-12-19 12:07:00 +0000
76+++ libdrizzle/drizzle.cc 2012-12-21 07:30:29 +0000
77@@ -103,12 +103,6 @@
78 WSADATA wsaData;
79 if ( WSAStartup( MAKEWORD(2,2), &wsaData ) != 0 )
80 printf("Error at WSAStartup()\n");
81-#else
82- struct sigaction act;
83- memset(&act, 0, sizeof(act));
84-
85- act.sa_handler = SIG_IGN;
86- sigaction(SIGPIPE, &act, NULL);
87 #endif
88
89 drizzle= (drizzle_st*)malloc(sizeof(drizzle_st));
90
91=== modified file 'tests/unit/binlog.c'
92--- tests/unit/binlog.c 2012-12-18 20:12:52 +0000
93+++ tests/unit/binlog.c 2012-12-21 07:30:29 +0000
94@@ -42,6 +42,10 @@
95 #include <stdio.h>
96 #include <stdlib.h>
97
98+#ifndef EXIT_SKIP
99+# define EXIT_SKIP 77
100+#endif
101+
102 int main(int argc, char *argv[])
103 {
104 (void) argc;
105@@ -67,7 +71,7 @@
106 if (ret != DRIZZLE_RETURN_OK)
107 {
108 printf("Drizzle connection failure\n");
109- return EXIT_FAILURE;
110+ return EXIT_SKIP;
111 }
112
113 result= drizzle_start_binlog(con, 0, "", 0, &ret);
114
115=== modified file 'tests/unit/connect.c'
116--- tests/unit/connect.c 2012-12-18 11:36:28 +0000
117+++ tests/unit/connect.c 2012-12-21 07:30:29 +0000
118@@ -41,6 +41,10 @@
119 #include <stdio.h>
120 #include <stdlib.h>
121
122+#ifndef EXIT_SKIP
123+# define EXIT_SKIP 77
124+#endif
125+
126 int main(int argc, char *argv[])
127 {
128 (void) argc;
129@@ -65,7 +69,7 @@
130 if (ret != DRIZZLE_RETURN_OK)
131 {
132 printf("Drizzle connection failure\n");
133- return EXIT_FAILURE;
134+ return EXIT_SKIP;
135 }
136
137 drizzle_con_quit(con);
138
139=== modified file 'tests/unit/insert_id.c'
140--- tests/unit/insert_id.c 2012-12-18 11:36:28 +0000
141+++ tests/unit/insert_id.c 2012-12-21 07:30:29 +0000
142@@ -41,6 +41,10 @@
143 #include <stdio.h>
144 #include <stdlib.h>
145
146+#ifndef EXIT_SKIP
147+# define EXIT_SKIP 77
148+#endif
149+
150 int main(int argc, char *argv[])
151 {
152 (void) argc;
153@@ -66,7 +70,7 @@
154 if (ret != DRIZZLE_RETURN_OK)
155 {
156 printf("Drizzle connection failure\n");
157- return EXIT_FAILURE;
158+ return EXIT_SKIP;
159 }
160
161 drizzle_query_str(con, "create table libdrizzle.t1 (a int primary key auto_increment, b int)", &ret);
162
163=== modified file 'tests/unit/query.c'
164--- tests/unit/query.c 2012-12-18 11:36:28 +0000
165+++ tests/unit/query.c 2012-12-21 07:30:29 +0000
166@@ -41,6 +41,10 @@
167 #include <stdio.h>
168 #include <stdlib.h>
169
170+#ifndef EXIT_SKIP
171+# define EXIT_SKIP 77
172+#endif
173+
174 int main(int argc, char *argv[])
175 {
176 (void) argc;
177@@ -68,7 +72,7 @@
178 if (ret != DRIZZLE_RETURN_OK)
179 {
180 printf("Drizzle connection failure\n");
181- return EXIT_FAILURE;
182+ return EXIT_SKIP;
183 }
184
185 drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret);
186
187=== modified file 'tests/unit/unbuffered_query.c'
188--- tests/unit/unbuffered_query.c 2012-12-18 11:36:28 +0000
189+++ tests/unit/unbuffered_query.c 2012-12-21 07:30:29 +0000
190@@ -41,6 +41,10 @@
191 #include <stdio.h>
192 #include <stdlib.h>
193
194+#ifndef EXIT_SKIP
195+# define EXIT_SKIP 77
196+#endif
197+
198 int main(int argc, char *argv[])
199 {
200 (void) argc;
201@@ -68,7 +72,7 @@
202 if (ret != DRIZZLE_RETURN_OK)
203 {
204 printf("Drizzle connection failure\n");
205- return EXIT_FAILURE;
206+ return EXIT_SKIP;
207 }
208
209 drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret);

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: