From a234e13a0513da8452b21f938821878eafeeb3aa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 10:16:37 +0200 Subject: fflush(NULL) before abort so that all pending writes are performed --- tests/mysql_client_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/mysql_client_test.c') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b65528eccb6..7cdd82f3779 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -122,7 +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(stderr); + fflush(NULL); abort(); } -- cgit v1.2.1 From 966d11ef8dabde1d4a949632c2a178c910c216c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 11:29:41 +0200 Subject: Change the 'sleep' into an explicit FLUSH LOGS command --- tests/mysql_client_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/mysql_client_test.c') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 7cdd82f3779..89b07143873 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14930,7 +14930,9 @@ 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); -- cgit v1.2.1 From 703c50e639889be2bfd8881cc543f339c81099dd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 14:02:57 +0200 Subject: Add printouts in test case for bug17667 tests/mysql_client_test.c: Add printout describing what master.log is to be opened. Add printout about statements that are found in the log. --- tests/mysql_client_test.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/mysql_client_test.c') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 89b07143873..f5acf179319 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14937,6 +14937,7 @@ static void test_bug17667() 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); @@ -14956,6 +14957,9 @@ static void test_bug17667() } 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"); -- cgit v1.2.1 From d09ba5a874909b997caa43725b6990b0a46aaeec Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 17:26:02 +0200 Subject: Add some more code to analyze why the fgets fails. --- tests/mysql_client_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tests/mysql_client_test.c') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index f5acf179319..32a8e94aee9 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14951,9 +14951,18 @@ static void test_bug17667() 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); -- cgit v1.2.1