summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2006-08-21 16:59:53 -0400
committerunknown <cmiller@zippy.cornsilk.net>2006-08-21 16:59:53 -0400
commit1b6858ea50c55bfff29d9796aed91166eda2b4ea (patch)
treec70977bce435613ec79f440513febc69e17f3d8f /tests
parentbfaef559c0ec546fa855e6e4c38616e4321efba4 (diff)
parent167aaaa5a4d13d735a97cd0db1193841a783fca7 (diff)
downloadmariadb-git-1b6858ea50c55bfff29d9796aed91166eda2b4ea.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
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");