diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-08-17 12:17:52 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-08-17 12:17:52 -0400 |
commit | b8930cbc55e1f054682d070fb615a513e6d086cc (patch) | |
tree | 61c7dffec75cc4a3395f97dd3a322abd6998bc90 /tests/mysql_client_test.c | |
parent | b32b2ce7afa830257a1052f70b57eb3f3a38710f (diff) | |
parent | 5c8c2ab43b73984889fd6c337523b657861793ea (diff) | |
download | mariadb-git-b8930cbc55e1f054682d070fb615a513e6d086cc.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
BitKeeper/deleted/.del-openssl.m4~41cebd0ba8281769:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/grant.result:
Auto merged
mysql-test/t/grant.test:
Auto merged
mysql-test/t/mysql.test:
Auto merged
mysql-test/t/mysql_client_test.test:
Auto merged
server-tools/instance-manager/listener.cc:
Auto merged
server-tools/instance-manager/portability.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
client/mysql.cc:
Manual merge
mysql-test/mysql-test-run.pl:
Manual merge
mysql-test/t/func_time.test:
Manual merge
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r-- | tests/mysql_client_test.c | 30 |
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"); |