List:Commits« Previous MessageNext Message »
From:andrey.hristov Date:November 4 2008 10:58am
Subject:bzr commit into connector-cpp-bzr branch (andrey.hristov:202)
View as plain text  
#At bzr+ssh://ahristov@stripped/bzrroot/public/connector-cpp-bzr/trunk/

  202 andrey.hristov@stripped	2008-11-04 [merge]
      Merge
modified:
  CHANGES
  test/driver_test.cpp
  test/static_test.cpp
  test/test_common.cpp

=== modified file 'CHANGES'
--- a/CHANGES	2008-09-10 17:34:33 +0000
+++ b/CHANGES	2008-11-03 18:14:22 +0000
@@ -3,6 +3,8 @@ Alpha  1.0.1 - xx/xx/2008
 - New directory layout
 - Addition of Connector/J test convert
 - Changing DbcException to implement the interface of JDBC's SQLException
+- All tests changed to create TAP compliant output
+- Introduction of experimental CPack support, see make help
 
 Preview 1.0.0  - 05/08/2008
 

=== modified file 'test/driver_test.cpp'
--- a/test/driver_test.cpp	2008-10-20 11:49:28 +0000
+++ b/test/driver_test.cpp	2008-11-03 17:49:01 +0000
@@ -33,7 +33,7 @@
 
 using namespace std;
 
-int loops = 0;
+int loops = 1;
 
 static sql::Driver * mysql_driver = NULL;
 

=== modified file 'test/static_test.cpp'
--- a/test/static_test.cpp	2008-10-13 09:55:26 +0000
+++ b/test/static_test.cpp	2008-11-03 17:49:01 +0000
@@ -23,7 +23,7 @@
 #include "driver/mysql_public_iface.h"
 #include <string>
 
-int loops = 0;
+int loops = 1;
 
 /* {{{	*/
 sql::Connection *

=== modified file 'test/test_common.cpp'
--- a/test/test_common.cpp	2008-10-28 20:04:19 +0000
+++ b/test/test_common.cpp	2008-11-03 17:49:01 +0000
@@ -38,9 +38,9 @@
   #define __LINE__ "(line number n/a)"
 #endif
 
-#define ensure(msg, stmt)				do {total_tests++;if(!(stmt)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}} while (0)
-#define ensure_equal(msg, op1, op2)	do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s\n",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
-#define ensure_equal_int(msg, op1, op2)	do {total_tests++;if((op1)!=(op2)){printf("\nError! line=%d: %s Op1=%d Op2=%d\n",__LINE__,msg,op1,op2);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
+#define ensure(msg, stmt)				do {total_tests++;if(!(stmt)){printf("\n# Error! line=%d: %s\n# ",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}} while (0)
+#define ensure_equal(msg, op1, op2)	do {total_tests++;if((op1)!=(op2)){printf("\n# Error! line=%d: %s\n# ",__LINE__,msg);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
+#define ensure_equal_int(msg, op1, op2)	do {total_tests++;if((op1)!=(op2)){printf("\n# Error! line=%d: %s Op1=%d Op2=%d\n# ",__LINE__,msg,op1,op2);total_errors++;throw sql::SQLException("error");} else { printf(".");}}while(0)
 
 static int total_errors = 0;
 static int total_tests = 0;
@@ -49,8 +49,8 @@ static int silent = 1;
 #define USED_DATABASE "test"
 #define DATABASE_TO_USE "USE test"
 
-#define ENTER_FUNCTION()		if (!silent) printf(">>>>   %s\n", __FUNCTION__);
-#define LEAVE_FUNCTION()		if (!silent) printf("<<<<   %s\n", __FUNCTION__); else printf("\n");
+#define ENTER_FUNCTION()		if (!silent) printf("# >>>>   %s\n# ", __FUNCTION__);
+#define LEAVE_FUNCTION()		if (!silent) printf("# <<<<   %s\n# ", __FUNCTION__); else printf("\n# ");
 
 #if defined(_WIN32) || defined(_WIN64)
 #pragma warning(disable:4251)
@@ -191,7 +191,8 @@ static void test_autocommit(sql::Connect
 		conn->setAutoCommit(0);
 		ensure("AutoCommit", conn->getAutoCommit() == false);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -233,7 +234,8 @@ static void test_connection_0(sql::Conne
 		}
 		ensure("connection is open", conn->isClosed() == false);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -289,7 +291,8 @@ static void test_connection_1(sql::Conne
 		stmt1->execute(DATABASE_TO_USE);
 		stmt1->execute("DROP TABLE test_function_tx");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -318,7 +321,8 @@ static void test_connection_2(sql::Conne
 		std::string newCatalog2(conn->getCatalog());
 		ensure("Wrong catalog", newCatalog2 == std::string("information_schema"));
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -334,7 +338,8 @@ static void test_connection_3(sql::Conne
 		const sql::DatabaseMetaData * meta(conn->getMetaData());
 		ensure("getUserName() failed", user == meta->getUserName().substr(0, user.length()));
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -350,7 +355,8 @@ static void test_statement_0(sql::Connec
 		std::auto_ptr<sql::Statement> stmt(conn->createStatement());
 		ensure("AutoCommit", conn == stmt->getConnection());
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -376,10 +382,12 @@ static void test_statement_1(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -405,10 +413,12 @@ static void test_statement_2(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -430,8 +440,9 @@ static void test_statement_3(sql::Connec
 			std::auto_ptr<sql::ResultSet> rset(stmt->executeQuery("SELECT * FROM test_function"));
 			ensure("NULL returned for result set", rset.get() != NULL);
 		} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
 			total_errors++;
+			printf("# ");
 		}
 
 		/* Clean */
@@ -440,10 +451,12 @@ static void test_statement_3(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -467,7 +480,8 @@ static void test_statement_4(sql::Connec
 			ensure_equal_int("Non-empty result set", false, rset->next());
 
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -477,10 +491,12 @@ static void test_statement_4(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -504,7 +520,8 @@ static void test_statement_5(sql::Connec
 			ensure_equal_int("Non-empty result set", false, rset->next());
 		} catch (sql::SQLException &) {
 		} catch (...) {
-			printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+			printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+			printf("# ");
 			total_errors++;
 		}
 		/* Clean */
@@ -513,10 +530,12 @@ static void test_statement_5(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -537,7 +556,7 @@ static void test_statement_6(sql::Connec
 		try {
 			ensure("Number of updated rows", stmt->executeUpdate("UPDATE test_function SET a = 123") == 1);
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
 			total_errors++;
 		}
 
@@ -547,10 +566,12 @@ static void test_statement_6(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -573,7 +594,8 @@ static void test_statement_7(sql::Connec
 			ensure("No exception thrown", false);
 		} catch (sql::SQLException &) {
 		} catch (...) {
-			printf("ERR: Incorrectly sql::SQLException ist not thrown\n");
+			printf("\n# ERR: Incorrectly sql::SQLException ist not thrown\n");
+			printf("# ");
 			total_errors++;
 		}
 
@@ -583,10 +605,12 @@ static void test_statement_7(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -606,10 +630,12 @@ static void test_statement_xx(sql::Conne
 
 		ensure("fetchSize is negative", stmt->getFetchSize() > 0);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -631,10 +657,12 @@ static void test_statement_xx(sql::Conne
 
 		ensure_equal("Non-equal", setFetchSize, stmt->getFetchSize());
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 }
@@ -657,10 +685,12 @@ static void test_statement_xx(sql::Conne
 			printf("INFO: Caught sql::InvalidArgumentException\n");
 		}
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -679,13 +709,15 @@ static void test_statement_xx(sql::Conne
 
 		try {
 			stmt->setQueryTimeout(-1);
-			printf("ERR: No exception\n");
+			printf("\n# ERR:No exception\n");
 		} catch (sql::InvalidArgumentException &) {}
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -715,10 +747,12 @@ static void test_statement_8(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 }
@@ -746,10 +780,12 @@ static void test_statement_9(sql::Connec
 		stmt2->execute(DATABASE_TO_USE);
 		stmt2->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -771,7 +807,8 @@ static void test_result_set_0(sql::Conne
 
 		ensure_equal_int("isLast", result->isLast(), false);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -796,7 +833,8 @@ static void test_result_set_1(sql::Conne
 		ensure("res1 is empty", rset1->next() != false);
 		ensure("res2 is empty", rset2->next() != false);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -823,7 +861,8 @@ static void test_result_set_2(sql::Conne
 
 		stmt1->execute("DROP TABLE test_function");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -888,7 +927,8 @@ static void test_result_set_3(sql::Conne
 
 		conn->setAutoCommit(old_commit_mode);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -969,7 +1009,8 @@ static void test_result_set_4(sql::Conne
 
 		conn->setAutoCommit(old_commit_mode);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -990,7 +1031,8 @@ static void test_result_set_5(sql::Conne
 			ensure("ERR: Exception not thrown", false);
 		} catch (sql::SQLException &) {}
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1068,7 +1110,8 @@ static void test_result_set_check_out_of
 
 		ensure_equal_int("res1 has more rows ", rset1->next(), false);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 }
@@ -1093,7 +1136,8 @@ static void test_result_set_6(sql::Conne
 
 		stmt1->execute("DROP TABLE test_function_tx");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1120,7 +1164,8 @@ static void test_result_set_7(sql::Conne
 		std::auto_ptr<sql::PreparedStatement> stmt2(conn->prepareStatement("DROP TABLE test_function_tx"));
 		stmt2->execute();
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1207,7 +1252,8 @@ static void test_result_set_8(sql::Conne
 
 		conn->setAutoCommit(old_commit_mode);
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1226,7 +1272,8 @@ static void test_result_set_9(sql::Conne
 			ensure("ERR: Exception not thrown", false);
 		} catch (sql::SQLException &) {}
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1288,7 +1335,8 @@ static void test_result_set_10(sql::Conn
 		}
 #endif
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1355,7 +1403,8 @@ static void test_result_set_11(sql::Conn
 
 
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1381,7 +1430,7 @@ static void test_general_0(sql::Connecti
 			}
 		}
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1422,7 +1471,8 @@ static void test_general_1(sql::Connecti
 
 		stmt->execute("DROP TABLE IF EXISTS test.product");
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1440,14 +1490,16 @@ static void test_prep_statement_0(sql::C
 			stmt->execute();
 			std::auto_ptr<sql::ResultSet> rset1(stmt->getResultSet());
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
 		try {
 			std::auto_ptr<sql::PreparedStatement> stmt(conn->prepareStatement("SELECT ?"));
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -1456,7 +1508,8 @@ static void test_prep_statement_0(sql::C
 			std::auto_ptr<sql::PreparedStatement> stmt(conn->prepareStatement("SELECT ?, ?, ?"));
 			stmt->setInt(1, 1);
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -1467,7 +1520,8 @@ static void test_prep_statement_0(sql::C
 			stmt->setInt(1, 42);
 			stmt->execute();
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -1479,8 +1533,9 @@ static void test_prep_statement_0(sql::C
 			stmt->setString(3, "Здрасти МySQL");
 			stmt->setDateTime(4, "2006-11-10 16:17:18");
 			stmt->execute();
-		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		} catch (sql::SQLException &e) {			
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -1502,7 +1557,8 @@ static void test_prep_statement_0(sql::C
 			ensure("Incorrect value for col 2", rset->getInt(3) == 42 && false == rset->wasNull());
 			ensure("Incorrect value for col 2", !rset->getString(3).compare("42") && false == rset->wasNull());
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 #endif
@@ -1514,7 +1570,8 @@ static void test_prep_statement_0(sql::C
 				std::auto_ptr<sql::ResultSet> rset(stmt->executeQuery());
 			}
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			total_errors++;
 		}
 
@@ -1544,7 +1601,8 @@ static void test_prep_statement_0(sql::C
 				ensure("Incorrect value for col 2", !rset->getString(3).compare("") && true == rset->wasNull());
 
 			} catch (sql::SQLException &e) {
-				printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+				printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+				printf("# ");
 				total_errors++;
 			}
 			/* Step 2 */
@@ -1566,7 +1624,8 @@ static void test_prep_statement_0(sql::C
 
 				ensure("Incorrect value for col 3", rset->getDouble(2) == 1.25 && false == rset->wasNull());
 			} catch (sql::SQLException &e) {
-				printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+				printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+				printf("# ");
 				total_errors++;
 			}
 		}
@@ -1576,12 +1635,14 @@ static void test_prep_statement_0(sql::C
 			stmt->execute();
 			std::auto_ptr<sql::ResultSet> rset(stmt->getResultSet());
 		} catch (sql::SQLException &) {
-			printf("ERR: Caught sql::SQLException at %s::%d\n", CPPCONN_FUNC, __LINE__);
+			printf("\n# ERR: Caught sql::SQLException at %s::%d\n", CPPCONN_FUNC, __LINE__);
+			printf("# ");
 			total_errors++;
 		}
 
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1614,10 +1675,12 @@ static void test_prep_statement_1(sql::C
 		ensure("stmt3 is NULL", stmt3.get() != NULL);
 		stmt3->execute();
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1647,10 +1710,12 @@ static void test_prep_statement_2(sql::C
 		} catch (sql::SQLException &) {}
 
 	} catch (sql::SQLException &e) {
-		printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+		printf("# ");
 		total_errors++;
 	} catch (...) {
-		printf("ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);
+		printf("# ");
 		total_errors++;
 	}
 	LEAVE_FUNCTION();
@@ -1662,28 +1727,35 @@ static void test_prep_statement_2(sql::C
 int main(int argc, const char **argv)
 {
 
+	printf("1..%d\n#\n", loops);	
 #ifndef DRIVER_TEST
-	printf("%s\n", mysql_get_client_info());
+	printf("# %s\n", mysql_get_client_info());
 #endif
 
 	sql::Connection *conn, *conn2;
+	int last_error_total = 0;
+	int i;
 
 	const std::string user(argc >=3? argv[2]:"root");
 	const std::string pass(argc >=4? argv[3]:"root");
 
-	for (;loops < 1; loops++) {
+	for (i = 0 ; i < loops; i++) {
+		last_error_total = total_errors;
 		const std::string host(argc >=2? argv[1]:"tcp://127.0.0.1");
-		printf("\n---------------  %d -----------------\n", loops + 1);
+		printf("#---------------  %d -----------------\n", i + 1);
+		printf("# ");
 
 		try {
 			conn = get_connection(host, user, pass);
 #ifndef DRIVER_TEST
 		} catch (sql::mysql::MySQL_SQLException &e) {
-			printf("ERR: Caught sql::mysql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::mysql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			return 1;
 #endif
 		} catch (sql::SQLException &e) {
-			printf("ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("\n# ERR: Caught sql::SQLException at %s::%d  %s\n", CPPCONN_FUNC, __LINE__, e.what());
+			printf("# ");
 			return 1;
 		}
 		/* XXX : Doing upcast, not the best thing, but tests getMySQLVariable */
@@ -1692,16 +1764,17 @@ int main(int argc, const char **argv)
 								mysql_get_server_info(((sql::mysql::MySQL_Connection *) conn)->getMySQLHandle())
 																							)
 			);
-		printf("\nServer %s\n", ((sql::mysql::MySQL_Connection *) conn)->getSessionVariable("version").c_str());
-
+		printf("\n");
+		printf("# Server %s\n", ((sql::mysql::MySQL_Connection *) conn)->getSessionVariable("version").c_str());
+		printf("# ");
 		delete conn;
 
-		test_connection_0(conn = get_connection(host, user, pass));delete conn;
-		test_connection_1(conn = get_connection(host, user, pass));delete conn;
-		test_connection_2(conn = get_connection(host, user, pass));delete conn;
-		test_connection_3(conn = get_connection(host, user, pass), user);delete conn;
-		test_autocommit(conn = get_connection(host, user, pass));delete conn;
-		test_statement_0(conn = get_connection(host, user, pass));delete conn;
+		test_connection_0(conn = get_connection(host, user, pass)); delete conn;
+		test_connection_1(conn = get_connection(host, user, pass)); delete conn;
+		test_connection_2(conn = get_connection(host, user, pass)); delete conn;
+		test_connection_3(conn = get_connection(host, user, pass), user); delete conn;
+		test_autocommit(conn = get_connection(host, user, pass)); delete conn;
+		test_statement_0(conn = get_connection(host, user, pass)); delete conn;
 
 		test_statement_1(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
 		test_statement_2(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
@@ -1713,29 +1786,35 @@ int main(int argc, const char **argv)
 		test_statement_8(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
 		test_statement_9(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
 
-		test_result_set_0(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_1(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_2(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_3(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_4(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_5(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_6(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_7(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_8(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_9(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_10(conn = get_connection(host, user, pass));delete conn;
-		test_result_set_11(conn = get_connection(host, user, pass));delete conn;
+		test_result_set_0(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_1(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_2(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_3(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_4(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_5(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_6(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_7(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_8(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_9(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_10(conn = get_connection(host, user, pass)); delete conn;
+		test_result_set_11(conn = get_connection(host, user, pass)); delete conn;
 #if 0
-		test_general_0(conn = get_connection(host, user, pass));delete conn;
-		test_general_1(conn = get_connection(host, user, pass));delete conn;
+		test_general_0(conn = get_connection(host, user, pass)); delete conn;
+		test_general_1(conn = get_connection(host, user, pass)); delete conn;
 #endif
 		test_prep_statement_0(conn = get_connection(host, user, pass)); delete conn;
 		test_prep_statement_1(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
 		test_prep_statement_2(conn = get_connection(host, user, pass), conn2 = get_connection(host, user, pass)); delete conn; delete conn2;
 
-		printf("\n---------------  %d -----------------\n", loops + 1);
+		printf("\n#---------------  %d -----------------\n", i + 1);	
+		if ((total_errors - last_error_total) == 0)
+			printf("ok\n");
+		else 
+			printf("not ok\n");
+		printf("# ");
+		
 	}
-	printf("Loops=%2d Tests= %4d Failures= %3d \n", loops, total_tests, total_errors);
+	printf("\n# Loops=%2d Tests= %4d Failures= %3d \n", loops, total_tests, total_errors);
 
 	return 0;
 }

Thread
bzr commit into connector-cpp-bzr branch (andrey.hristov:202) andrey.hristov4 Nov