summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcmiller@zippy.cornsilk.net <>2006-08-21 12:59:46 -0400
committercmiller@zippy.cornsilk.net <>2006-08-21 12:59:46 -0400
commitf2f90320de7bf0378e55be666d8332ec97be7d5f (patch)
tree3086a79b8bf655d1668a25f2e43dec8f4ce7be11 /tests
parentff57b304a438582d89f459be5a4e012c983e97cc (diff)
parent64092ca93b0c898b668af2f4b27f61ab354f511d (diff)
downloadmariadb-git-f2f90320de7bf0378e55be666d8332ec97be7d5f.tar.gz
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/merge/mysql-5.0
into zippy.cornsilk.net:/home/cmiller/work/mysql/merge/mysql-5.1
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index d2fff9e1d84..02170f6aacb 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -122,6 +122,7 @@ static void client_disconnect();
void die(const char *file, int line, const char *expr)
{
fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
+ fflush(NULL);
abort();
}
@@ -14944,7 +14945,7 @@ static void test_bug17667()
{ "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 },
{ "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 },
{ "drop table bug17667", 19 },
- { NULL, 0 } };
+ { NULL, 0 } };
struct buffer_and_length *statement_cursor;
FILE *log_file;
@@ -14959,11 +14960,14 @@ static void test_bug17667()
myquery(rc);
}
- sleep(1); /* The server may need time to flush the data to the log. */
+ /* Make sure the server has written the logs to disk before reading it */
+ rc= mysql_query(mysql, "flush logs");
+ myquery(rc);
master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1);
strcpy(master_log_filename, opt_vardir);
strcat(master_log_filename, "/log/master.log");
+ printf("Opening '%s'\n", master_log_filename);
log_file= fopen(master_log_filename, "r");
free(master_log_filename);
@@ -14971,18 +14975,30 @@ static void test_bug17667()
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) {
- char line_buffer[MAX_TEST_QUERY_LENGTH*2];
- /* more than enough room for the query and some marginalia. */
+ char line_buffer[MAX_TEST_QUERY_LENGTH*2];
+ /* more than enough room for the query and some marginalia. */
do {
memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2);
- DIE_UNLESS(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) !=
- NULL);
- /* If we reach EOF before finishing the statement list, then we failed. */
+ if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL)
+ {
+ /* If fgets returned NULL, it indicates either error or EOF */
+ if (feof(log_file))
+ DIE("Found EOF before all statements where found");
+ else
+ {
+ fprintf(stderr, "Got error %d while reading from file\n",
+ ferror(log_file));
+ DIE("Read error");
+ }
+ }
} while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2,
statement_cursor->buffer, statement_cursor->length) == NULL);
+
+ printf("Found statement starting with \"%s\"\n",
+ statement_cursor->buffer);
}
printf("success. All queries found intact in the log.\n");