Merge lp:~brianaker/libdrizzle/cleanup-api into lp:libdrizzle

Proposed by Brian Aker
Status: Merged
Approved by: Andrew Hutchings
Approved revision: no longer in the source branch.
Merged at revision: 98
Proposed branch: lp:~brianaker/libdrizzle/cleanup-api
Merge into: lp:libdrizzle
Diff against target: 665 lines (+245/-143)
20 files modified
configure.ac (+1/-0)
docs/api/statement.rst (+2/-0)
libdrizzle-5.1/command_client.h (+0/-61)
libdrizzle-5.1/conn.h (+0/-11)
libdrizzle-5.1/drizzle_client.h (+0/-1)
libdrizzle-5.1/include.am (+0/-1)
libdrizzle-5.1/return.h (+20/-0)
libdrizzle/conn_local.h (+11/-0)
libdrizzle/drizzle.cc (+33/-0)
libdrizzle/drizzle_local.h (+1/-0)
libdrizzle/statement.cc (+3/-3)
rpm/spec.in (+0/-1)
tests/unit/binlog.cc (+15/-22)
tests/unit/cleanup.h (+58/-0)
tests/unit/column.c (+9/-16)
tests/unit/include.am (+31/-1)
tests/unit/statement.c (+12/-26)
yatl/include.am (+38/-0)
yatl/run-ci.gdb (+6/-0)
yatl/run.gdb (+5/-0)
To merge this branch: bzr merge lp:~brianaker/libdrizzle/cleanup-api
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+145077@code.launchpad.net
To post a comment you must log in.
lp:~brianaker/libdrizzle/cleanup-api updated
98. By Drizzle Continuous Integration

Merge lp:~brianaker/libdrizzle/cleanup-api Build: jenkins-Libdrizzle-54

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 2013-01-18 13:33:00 +0000
3+++ configure.ac 2013-01-27 00:45:27 +0000
4@@ -88,6 +88,7 @@
5
6 # Checks for library functions.
7 AC_CHECK_FUNCS([fcntl])
8+AC_CHECK_FUNCS([on_exit])
9 AC_CHECK_FUNCS([poll])
10 AC_CHECK_FUNCS([ppoll])
11
12
13=== modified file 'docs/api/statement.rst'
14--- docs/api/statement.rst 2013-01-05 11:25:32 +0000
15+++ docs/api/statement.rst 2013-01-27 00:45:27 +0000
16@@ -311,5 +311,7 @@
17
18 Gets the row count for a statement buffered with :c:func:`drizzle_stmt_buffer`
19
20+ On error it returns UINT64_MAX;
21+
22 :param stmt: The prepared statement object
23 :returns: The row count
24
25=== removed file 'libdrizzle-5.1/command_client.h'
26--- libdrizzle-5.1/command_client.h 2012-12-18 11:36:28 +0000
27+++ libdrizzle-5.1/command_client.h 1970-01-01 00:00:00 +0000
28@@ -1,61 +0,0 @@
29-/*
30- * Drizzle Client & Protocol Library
31- *
32- * Copyright (C) 2008 Eric Day (eday@oddments.org)
33- * All rights reserved.
34- *
35- * Redistribution and use in source and binary forms, with or without
36- * modification, are permitted provided that the following conditions are
37- * met:
38- *
39- * * Redistributions of source code must retain the above copyright
40- * notice, this list of conditions and the following disclaimer.
41- *
42- * * Redistributions in binary form must reproduce the above
43- * copyright notice, this list of conditions and the following disclaimer
44- * in the documentation and/or other materials provided with the
45- * distribution.
46- *
47- * * The names of its contributors may not be used to endorse or
48- * promote products derived from this software without specific prior
49- * written permission.
50- *
51- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62- *
63- */
64-
65-/**
66- * @file
67- * @brief Command Declarations for Clients
68- */
69-
70-#pragma once
71-
72-#ifdef __cplusplus
73-extern "C" {
74-#endif
75-
76-/**
77- * @addtogroup drizzle_command_client Command Declarations for Clients
78- * @ingroup drizzle_client_interface
79- *
80- * These functions are used to issue commands on a connection. Normal SQL
81- * queries are issued using the drizzle_query* functions defined in query.h.
82- * @{
83- */
84-
85-/** @} */
86-
87-#ifdef __cplusplus
88-}
89-#endif
90
91=== modified file 'libdrizzle-5.1/conn.h'
92--- libdrizzle-5.1/conn.h 2013-01-26 23:09:08 +0000
93+++ libdrizzle-5.1/conn.h 2013-01-27 00:45:27 +0000
94@@ -197,17 +197,6 @@
95 in_port_t drizzle_port(const drizzle_st *con);
96
97 /**
98- * Set unix domain socket for a connection.
99- *
100- * @param[in] con Connection structure previously initialized with
101- * drizzle_create(), drizzle_clone(), or related functions.
102- * @param[in] uds Unix domain socket to use for this connection, NULL for
103- * defailt value.
104- */
105-DRIZZLE_API
106-void drizzle_set_uds(drizzle_st *con, const char *uds);
107-
108-/**
109 * Get username for a connection.
110 *
111 * @param[in] con Connection structure previously initialized with
112
113=== modified file 'libdrizzle-5.1/drizzle_client.h'
114--- libdrizzle-5.1/drizzle_client.h 2013-01-26 23:09:08 +0000
115+++ libdrizzle-5.1/drizzle_client.h 2013-01-27 00:45:27 +0000
116@@ -56,7 +56,6 @@
117 #include <libdrizzle-5.1/drizzle.h>
118 #include <libdrizzle-5.1/conn_client.h>
119 #include <libdrizzle-5.1/handshake_client.h>
120-#include <libdrizzle-5.1/command_client.h>
121 #include <libdrizzle-5.1/query.h>
122 #include <libdrizzle-5.1/result_client.h>
123 #include <libdrizzle-5.1/column_client.h>
124
125=== modified file 'libdrizzle-5.1/include.am'
126--- libdrizzle-5.1/include.am 2012-12-30 02:23:50 +0000
127+++ libdrizzle-5.1/include.am 2013-01-27 00:45:27 +0000
128@@ -5,7 +5,6 @@
129 nobase_include_HEADERS+= libdrizzle-5.1/binlog.h
130 nobase_include_HEADERS+= libdrizzle-5.1/column.h
131 nobase_include_HEADERS+= libdrizzle-5.1/column_client.h
132-nobase_include_HEADERS+= libdrizzle-5.1/command_client.h
133 nobase_include_HEADERS+= libdrizzle-5.1/conn.h
134 nobase_include_HEADERS+= libdrizzle-5.1/conn_client.h
135 nobase_include_HEADERS+= libdrizzle-5.1/constants.h
136
137=== modified file 'libdrizzle-5.1/return.h'
138--- libdrizzle-5.1/return.h 2013-01-05 11:25:32 +0000
139+++ libdrizzle-5.1/return.h 2013-01-27 00:45:27 +0000
140@@ -80,3 +80,23 @@
141 #ifndef __cplusplus
142 typedef enum drizzle_return_t drizzle_return_t;
143 #endif
144+
145+static inline bool drizzle_success(drizzle_return_t ret)
146+{
147+ if (ret == DRIZZLE_RETURN_OK)
148+ {
149+ return true;
150+ }
151+
152+ return false;
153+}
154+
155+static inline bool drizzle_failed(drizzle_return_t ret)
156+{
157+ if (ret != DRIZZLE_RETURN_OK)
158+ {
159+ return true;
160+ }
161+
162+ return false;
163+}
164
165=== modified file 'libdrizzle/conn_local.h'
166--- libdrizzle/conn_local.h 2012-12-30 11:18:18 +0000
167+++ libdrizzle/conn_local.h 2013-01-27 00:45:27 +0000
168@@ -118,6 +118,17 @@
169 * @param[in] db Database to use with this connection.
170 */
171 void drizzle_set_db(drizzle_st *con, const char *db);
172+
173+/**
174+ * Set unix domain socket for a connection.
175+ *
176+ * @param[in] con Connection structure previously initialized with
177+ * drizzle_create(), drizzle_clone(), or related functions.
178+ * @param[in] uds Unix domain socket to use for this connection, NULL for
179+ * defailt value.
180+ */
181+DRIZZLE_API
182+void drizzle_set_uds(drizzle_st *con, const char *uds);
183
184 /**
185 * Check if state stack is empty.
186
187=== modified file 'libdrizzle/drizzle.cc'
188--- libdrizzle/drizzle.cc 2013-01-26 23:31:43 +0000
189+++ libdrizzle/drizzle.cc 2013-01-27 00:45:27 +0000
190@@ -178,6 +178,39 @@
191 return con;
192 }
193
194+drizzle_st *drizzle_clone(drizzle_st *drizzle, const drizzle_st *from)
195+{
196+ drizzle= drizzle_create();
197+ if (drizzle == NULL)
198+ {
199+ return NULL;
200+ }
201+
202+ drizzle->capabilities= from->capabilities;
203+ drizzle->options= from->options;
204+
205+ drizzle->backlog= from->backlog;
206+ strcpy(drizzle->db, from->db);
207+ strcpy(drizzle->password, from->password);
208+ strcpy(drizzle->user, from->user);
209+
210+ switch (from->socket_type)
211+ {
212+ case DRIZZLE_CON_SOCKET_TCP:
213+ drizzle_set_tcp(drizzle, from->socket.tcp.host, from->socket.tcp.port);
214+ break;
215+
216+ case DRIZZLE_CON_SOCKET_UDS:
217+ drizzle_set_uds(drizzle, from->socket.uds.path_buffer);
218+ break;
219+
220+ default:
221+ break;
222+ }
223+
224+ return drizzle;
225+}
226+
227 void drizzle_free(drizzle_st *con)
228 {
229 if (con == NULL)
230
231=== modified file 'libdrizzle/drizzle_local.h'
232--- libdrizzle/drizzle_local.h 2013-01-05 11:31:45 +0000
233+++ libdrizzle/drizzle_local.h 2013-01-27 00:45:27 +0000
234@@ -82,6 +82,7 @@
235 */
236 void drizzle_free(drizzle_st *con);
237
238+drizzle_st *drizzle_clone(drizzle_st *drizzle, const drizzle_st *from);
239
240 /**
241 * Log a message.
242
243=== modified file 'libdrizzle/statement.cc'
244--- libdrizzle/statement.cc 2013-01-26 23:09:08 +0000
245+++ libdrizzle/statement.cc 2013-01-27 00:45:27 +0000
246@@ -620,10 +620,10 @@
247
248 uint64_t drizzle_stmt_row_count(drizzle_stmt_st *stmt)
249 {
250- if ((stmt == NULL) || (stmt->execute_result == NULL))
251+ if (stmt and stmt->execute_result)
252 {
253- return 0;
254+ return stmt->execute_result->row_count;
255 }
256
257- return stmt->execute_result->row_count;
258+ return UINT64_MAX;
259 }
260
261=== modified file 'rpm/spec.in'
262--- rpm/spec.in 2013-01-18 13:33:00 +0000
263+++ rpm/spec.in 2013-01-27 00:45:27 +0000
264@@ -62,7 +62,6 @@
265 %{_includedir}/libdrizzle-5.1/binlog.h
266 %{_includedir}/libdrizzle-5.1/column.h
267 %{_includedir}/libdrizzle-5.1/column_client.h
268-%{_includedir}/libdrizzle-5.1/command_client.h
269 %{_includedir}/libdrizzle-5.1/conn.h
270 %{_includedir}/libdrizzle-5.1/conn_client.h
271 %{_includedir}/libdrizzle-5.1/constants.h
272
273=== renamed file 'tests/unit/binlog.c' => 'tests/unit/binlog.cc'
274--- tests/unit/binlog.c 2013-01-13 22:31:54 +0000
275+++ tests/unit/binlog.cc 2013-01-27 00:45:27 +0000
276@@ -2,7 +2,7 @@
277 *
278 * Drizzle Client & Protocol Library
279 *
280- * Copyright (C) 2012 Drizzle Developer Group
281+ * Copyright (C) 2012-2013 Drizzle Developer Group
282 * All rights reserved.
283 *
284 * Redistribution and use in source and binary forms, with or without
285@@ -35,36 +35,32 @@
286 *
287 */
288
289+
290 #include <yatl/lite.h>
291
292 #include <libdrizzle-5.1/libdrizzle.h>
293-#include <stdio.h>
294-#include <stdlib.h>
295-#include <stdint.h>
296-#include <inttypes.h>
297+
298+#include "tests/unit/cleanup.h"
299+
300+#include <cstdio>
301+#include <cstdlib>
302
303 int main(int argc, char *argv[])
304 {
305 (void) argc;
306 (void) argv;
307
308- drizzle_st *con= drizzle_create_tcp(getenv("MYSQL_SERVER"),
309- getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
310- getenv("MYSQL_USER"),
311- getenv("MYSQL_PASSWORD"),
312- getenv("MYSQL_SCHEMA"), 0);
313+ con= drizzle_create_tcp(getenv("MYSQL_SERVER"),
314+ getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
315+ getenv("MYSQL_USER"),
316+ getenv("MYSQL_PASSWORD"),
317+ getenv("MYSQL_SCHEMA"), NULL);
318
319+ CLOSE_ON_EXIT(con);
320 ASSERT_NOT_NULL_(con, "Drizzle connection object creation error");
321
322 drizzle_return_t ret= drizzle_connect(con);
323- if (ret == DRIZZLE_RETURN_COULD_NOT_CONNECT)
324- {
325- char error[DRIZZLE_MAX_ERROR_SIZE];
326- strncpy(error, drizzle_error(con), DRIZZLE_MAX_ERROR_SIZE);
327-
328- drizzle_quit(con);
329- SKIP_IF_(ret == DRIZZLE_RETURN_COULD_NOT_CONNECT, "%s(%s)", error, drizzle_strerror(ret));
330- }
331+ SKIP_IF_(ret == DRIZZLE_RETURN_COULD_NOT_CONNECT, "%s(%s)", drizzle_error(con), drizzle_strerror(ret));
332 ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s(%s)", drizzle_error(con), drizzle_strerror(ret));
333
334 drizzle_result_st *result= drizzle_start_binlog(con, 0, "", 0, true, &ret);
335@@ -86,15 +82,12 @@
336 * timestamps will have weird values that shoud fail this after several
337 * events. Also rotate event doesn't have a timestamp so need to add 0
338 * to this test */
339- ASSERT_FALSE_(((timestamp < 1325376000) && (timestamp != 0)), "Bad timestamp retrieved: %" PRIu32, timestamp);
340+ ASSERT_FALSE_(((timestamp < 1325376000) && (timestamp != 0)), "Bad timestamp retrieved: %u", timestamp);
341
342 /* An event higher than the max known is bad, either we don't know about
343 * new events or type is corrupted */
344 ASSERT_FALSE_((drizzle_binlog_event_type(result) >= DRIZZLE_EVENT_TYPE_END), "Bad event type: %d", drizzle_binlog_event_type(result));
345 }
346
347- ret= drizzle_quit(con);
348- ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_strerror(ret));
349-
350 return EXIT_SUCCESS;
351 }
352
353=== added file 'tests/unit/cleanup.h'
354--- tests/unit/cleanup.h 1970-01-01 00:00:00 +0000
355+++ tests/unit/cleanup.h 2013-01-27 00:45:27 +0000
356@@ -0,0 +1,58 @@
357+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
358+ *
359+ * Drizzle Client & Protocol Library
360+ *
361+ * Copyright (C) 2013 Drizzle Developer Group
362+ * All rights reserved.
363+ *
364+ * Redistribution and use in source and binary forms, with or without
365+ * modification, are permitted provided that the following conditions are
366+ * met:
367+ *
368+ * * Redistributions of source code must retain the above copyright
369+ * notice, this list of conditions and the following disclaimer.
370+ *
371+ * * Redistributions in binary form must reproduce the above
372+ * copyright notice, this list of conditions and the following disclaimer
373+ * in the documentation and/or other materials provided with the
374+ * distribution.
375+ *
376+ * * The names of its contributors may not be used to endorse or
377+ * promote products derived from this software without specific prior
378+ * written permission.
379+ *
380+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
381+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
382+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
383+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
384+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
385+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
386+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
387+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
388+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
389+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
390+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
391+ *
392+ */
393+
394+#pragma once
395+
396+#ifdef __cplusplus
397+# include <cstdlib>
398+# include <cstdio>
399+#else
400+# include <stdlib.h>
401+# include <stdio.h>
402+#endif
403+
404+#include <libdrizzle-5.1/libdrizzle.h>
405+
406+static drizzle_st *con= NULL;
407+static void close_connection_on_exit(void)
408+{
409+ drizzle_return_t ret= drizzle_quit(con);
410+ ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "drizzle_quit() : %s", strerror(ret));
411+}
412+
413+#define CLOSE_ON_EXIT(__connection) atexit(close_connection_on_exit);
414+
415
416=== modified file 'tests/unit/column.c'
417--- tests/unit/column.c 2013-01-12 13:40:18 +0000
418+++ tests/unit/column.c 2013-01-27 00:45:27 +0000
419@@ -36,8 +36,10 @@
420 */
421
422 #include <yatl/lite.h>
423+#include "tests/unit/cleanup.h"
424
425 #include <libdrizzle-5.1/libdrizzle.h>
426+
427 #include <stdio.h>
428 #include <string.h>
429 #include <stdlib.h>
430@@ -49,22 +51,16 @@
431 drizzle_row_t row;
432 int num_fields;
433
434- drizzle_st *con= drizzle_create_tcp(getenv("MYSQL_SERVER"),
435- getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
436- getenv("MYSQL_USER"),
437- getenv("MYSQL_PASSWORD"),
438- getenv("MYSQL_SCHEMA"), 0);
439+ con= drizzle_create_tcp(getenv("MYSQL_SERVER"),
440+ getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
441+ getenv("MYSQL_USER"),
442+ getenv("MYSQL_PASSWORD"),
443+ getenv("MYSQL_SCHEMA"), 0);
444 ASSERT_NOT_NULL_(con, "Drizzle connection object creation error");
445+ CLOSE_ON_EXIT(con);
446
447 drizzle_return_t ret= drizzle_connect(con);
448- if (ret == DRIZZLE_RETURN_COULD_NOT_CONNECT)
449- {
450- char error[DRIZZLE_MAX_ERROR_SIZE];
451- strncpy(error, drizzle_error(con), DRIZZLE_MAX_ERROR_SIZE);
452-
453- drizzle_quit(con);
454- SKIP_IF_(ret == DRIZZLE_RETURN_COULD_NOT_CONNECT, "%s(%s)", error, drizzle_strerror(ret));
455- }
456+ SKIP_IF_(ret == DRIZZLE_RETURN_COULD_NOT_CONNECT, "%s", drizzle_strerror(ret));
457 ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s(%s)", drizzle_error(con), strerror(ret));
458
459 drizzle_query(con, "DROP SCHEMA IF EXISTS libdrizzle", 0, &ret);
460@@ -123,8 +119,5 @@
461 drizzle_query(con, "DROP SCHEMA IF EXISTS libdrizzle", 0, &ret);
462 ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "DROP SCHEMA libdrizzle (%s)", drizzle_error(con));
463
464- ret= drizzle_quit(con);
465- ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_strerror(ret));
466-
467 return EXIT_SUCCESS;
468 }
469
470=== modified file 'tests/unit/include.am'
471--- tests/unit/include.am 2013-01-12 10:51:40 +0000
472+++ tests/unit/include.am 2013-01-27 00:45:27 +0000
473@@ -2,11 +2,22 @@
474 # included from Top Level Makefile.am
475 # All paths should be given relative to the root
476
477-tests_unit_binlog_SOURCES= tests/unit/binlog.c
478+noinst_HEADERS+= tests/unit/cleanup.h
479+
480+tests_unit_binlog_SOURCES= tests/unit/binlog.cc
481 tests_unit_binlog_LDADD= libdrizzle/libdrizzle.la
482 check_PROGRAMS+= tests/unit/binlog
483 noinst_PROGRAMS+= tests/unit/binlog
484
485+gdb-binlog: tests/unit/binlog
486+ @$(GDB_COMMAND) tests/unit/binlog
487+
488+valgrind-binlog: tests/unit/binlog
489+ @$(VALGRIND_COMMAND) tests/unit/binlog
490+
491+check-binlog: tests/unit/binlog
492+ tests/unit/binlog
493+
494 tests_unit_escape_SOURCES= tests/unit/escape.c
495 tests_unit_escape_LDADD= libdrizzle/libdrizzle.la
496 check_PROGRAMS+= tests/unit/escape
497@@ -27,6 +38,16 @@
498 check_PROGRAMS+= tests/unit/column
499 noinst_PROGRAMS+= tests/unit/column
500
501+gdb-column: tests/unit/column
502+ @$(GDB_COMMAND) tests/unit/column
503+
504+valgrind-column: tests/unit/column
505+ @$(VALGRIND_COMMAND) tests/unit/column
506+
507+check-column: tests/unit/column
508+ tests/unit/column
509+
510+
511 tests_unit_row_SOURCES= tests/unit/row.c
512 tests_unit_row_LDADD= libdrizzle/libdrizzle.la
513 check_PROGRAMS+= tests/unit/row
514@@ -47,6 +68,15 @@
515 check_PROGRAMS+= tests/unit/connect
516 noinst_PROGRAMS+= tests/unit/connect
517
518+gdb-connect: tests/unit/connect
519+ @$(GDB_COMMAND) tests/unit/connect
520+
521+valgrind-connect: tests/unit/connect
522+ @$(VALGRIND_COMMAND) tests/unit/connect
523+
524+check-connect: tests/unit/connect
525+ tests/unit/connect
526+
527 tests_unit_connect_uds_SOURCES= tests/unit/connect_uds.c
528 tests_unit_connect_uds_LDADD= libdrizzle/libdrizzle.la
529 check_PROGRAMS+= tests/unit/connect_uds
530
531=== modified file 'tests/unit/statement.c'
532--- tests/unit/statement.c 2013-01-12 13:40:18 +0000
533+++ tests/unit/statement.c 2013-01-27 00:45:27 +0000
534@@ -49,7 +49,9 @@
535 {
536 (void) argc;
537 (void) argv;
538- drizzle_stmt_st *stmt;
539+ drizzle_stmt_st *stmt= NULL;
540+
541+ ASSERT_EQ(UINT64_MAX, drizzle_stmt_row_count(stmt));
542
543 drizzle_st *con= drizzle_create_tcp(getenv("MYSQL_SERVER"),
544 getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT,
545@@ -92,30 +94,18 @@
546
547 uint32_t val= 1;
548 ret = drizzle_stmt_set_int(stmt, 0, val, false);
549- if (ret != DRIZZLE_RETURN_OK)
550- {
551- printf("Bind failure\n");
552- return EXIT_FAILURE;
553- }
554+ ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con));
555
556 ret = drizzle_stmt_execute(stmt);
557- if (ret != DRIZZLE_RETURN_OK)
558- {
559- printf("Execute failure\n");
560- return EXIT_FAILURE;
561- }
562+ ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con));
563+
564 ret = drizzle_stmt_buffer(stmt);
565- if (ret != DRIZZLE_RETURN_OK)
566- {
567- printf("Buffer failure\n");
568- return EXIT_FAILURE;
569- }
570+ ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con));
571+
572 /* Result should have 2 rows */
573- if (drizzle_stmt_row_count(stmt) != 2)
574- {
575- printf("Retrieved bad row count\n");
576- return EXIT_FAILURE;
577- }
578+ int count= drizzle_stmt_row_count(stmt);
579+ ASSERT_EQ_(2, count, "%s", drizzle_error(con));
580+
581 uint32_t i= 1;
582 while (drizzle_stmt_fetch(stmt) != DRIZZLE_RETURN_ROW_END)
583 {
584@@ -154,11 +144,7 @@
585 return EXIT_FAILURE;
586 }
587 ret = drizzle_stmt_close(stmt);
588- if (ret != DRIZZLE_RETURN_OK)
589- {
590- printf("Statement close failure ret: %d, err: %d, msg: %s\n", ret, drizzle_errno(con), drizzle_error(con));
591- return EXIT_FAILURE;
592- }
593+ ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "%s", drizzle_error(con));
594
595 drizzle_query(con, "DROP TABLE libdrizzle.t1", 0, &ret);
596 ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "DROP TABLE libdrizzle.t1");
597
598=== modified file 'yatl/include.am'
599--- yatl/include.am 2012-12-29 10:49:09 +0000
600+++ yatl/include.am 2013-01-27 00:45:27 +0000
601@@ -2,5 +2,43 @@
602 # included from Top Level Makefile.am
603 # All paths should be given relative to the root
604
605+LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
606+VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
607+VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND)
608+HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
609+DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
610+MASSIF_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=massif
611+GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x yatl/run.gdb
612+PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1
613+PAHOLE_COMMAND= $(LIBTOOL_COMMAND) --mode=execute pahole
614+VALGRIND_SUPRESSION= $(LIBTOOL_COMMAND) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all --log-file=minimalraw.log
615+
616+export LIBTOOL_COMMAND
617+export VALGRIND_COMMAND
618+export HELGRIND_COMMAND
619+export DRD_COMMAND
620+export GDB_COMMAND
621+
622+valgrind:
623+ @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\""
624+
625+valgrind-supressions:
626+ @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_SUPRESSION)\""
627+
628+gdb:
629+ @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\""
630+
631+helgrind:
632+ @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
633+
634+drd:
635+ @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
636+
637 noinst_HEADERS+= yatl/lite.h
638
639+EXTRA_DIST+= yatl/run.gdb
640+
641+.PHONY: clean-yatl-check
642+ clean-yatl-check:
643+ -rm -rf tmp_chroot
644+
645
646=== added file 'yatl/run-ci.gdb'
647--- yatl/run-ci.gdb 1970-01-01 00:00:00 +0000
648+++ yatl/run-ci.gdb 2013-01-27 00:45:27 +0000
649@@ -0,0 +1,6 @@
650+set logging on
651+set logging overwrite on
652+set environment LIBTEST_IN_GDB=1
653+run
654+thread apply all bt
655+quit
656
657=== added file 'yatl/run.gdb'
658--- yatl/run.gdb 1970-01-01 00:00:00 +0000
659+++ yatl/run.gdb 2013-01-27 00:45:27 +0000
660@@ -0,0 +1,5 @@
661+set logging on
662+set logging overwrite on
663+set environment LIBTEST_IN_GDB=1
664+run
665+thread apply all bt

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: