dovecot-2.0-sieve: Testsuite: added command line parameter for c...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Fri Jan 8 00:58:42 EET 2010


details:   http://hg.rename-it.nl/dovecot-2.0-sieve/rev/c3fff8c8250d
changeset: 1176:c3fff8c8250d
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Jan 07 22:22:08 2010 +0100
description:
Testsuite: added command line parameter for copying errors to stderr.

diffstat:

 src/testsuite/testsuite-common.c |   4 ++--
 src/testsuite/testsuite-common.h |   2 +-
 src/testsuite/testsuite-log.c    |   4 +++-
 src/testsuite/testsuite-log.h    |   2 +-
 src/testsuite/testsuite.c        |  15 +++++++++------
 5 files changed, 16 insertions(+), 11 deletions(-)

diffs (118 lines):

diff -r 6d81b4ee9e0e -r c3fff8c8250d src/testsuite/testsuite-common.c
--- a/src/testsuite/testsuite-common.c	Sun Jan 03 13:33:45 2010 +0100
+++ b/src/testsuite/testsuite-common.c	Thu Jan 07 22:22:08 2010 +0100
@@ -232,10 +232,10 @@
  * Main testsuite init/deinit
  */
 
-void testsuite_init(struct sieve_instance *svinst)
+void testsuite_init(struct sieve_instance *svinst, bool log_stdout)
 {
 	testsuite_test_context_init();
-	testsuite_log_init();
+	testsuite_log_init(log_stdout);
 	testsuite_tmp_dir_init();
 	
 	testsuite_script_init();
diff -r 6d81b4ee9e0e -r c3fff8c8250d src/testsuite/testsuite-common.h
--- a/src/testsuite/testsuite-common.h	Sun Jan 03 13:33:45 2010 +0100
+++ b/src/testsuite/testsuite-common.h	Thu Jan 07 22:22:08 2010 +0100
@@ -152,7 +152,7 @@
  * Testsuite init/deinit 
  */
 
-void testsuite_init(struct sieve_instance *svinst);
+void testsuite_init(struct sieve_instance *svinst, bool log_stdout);
 void testsuite_deinit(void);
 
 #endif /* __TESTSUITE_COMMON_H */
diff -r 6d81b4ee9e0e -r c3fff8c8250d src/testsuite/testsuite-log.c
--- a/src/testsuite/testsuite-log.c	Sun Jan 03 13:33:45 2010 +0100
+++ b/src/testsuite/testsuite-log.c	Thu Jan 07 22:22:08 2010 +0100
@@ -101,8 +101,10 @@
 	return msg->message;		
 }
 
-void testsuite_log_init(void)
+void testsuite_log_init(bool log_stdout)
 {
+	_testsuite_log_stdout = log_stdout;
+
 	testsuite_log_ehandler = _testsuite_log_ehandler_create(); 	
 	sieve_error_handler_accept_infolog(testsuite_log_ehandler, TRUE);
 
diff -r 6d81b4ee9e0e -r c3fff8c8250d src/testsuite/testsuite-log.h
--- a/src/testsuite/testsuite-log.h	Sun Jan 03 13:33:45 2010 +0100
+++ b/src/testsuite/testsuite-log.h	Thu Jan 07 22:22:08 2010 +0100
@@ -8,7 +8,7 @@
 
 extern struct sieve_error_handler *testsuite_log_ehandler;
 
-void testsuite_log_init(void);
+void testsuite_log_init(bool log_stdout);
 void testsuite_log_deinit(void);
 
 void testsuite_log_clear_messages(void);
diff -r 6d81b4ee9e0e -r c3fff8c8250d src/testsuite/testsuite.c
--- a/src/testsuite/testsuite.c	Sun Jan 03 13:33:45 2010 +0100
+++ b/src/testsuite/testsuite.c	Thu Jan 07 22:22:08 2010 +0100
@@ -55,7 +55,7 @@
 	testsuite_setting_get
 };
 
-static void testsuite_tool_init(const char *extensions) 
+static void testsuite_tool_init(const char *extensions, bool log_stdout) 
 {
 	testsuite_settings_init();
 
@@ -63,7 +63,7 @@
 
 	sieve_extensions_set_string(sieve_instance, extensions);
 
-	testsuite_init(sieve_instance);
+	testsuite_init(sieve_instance, log_stdout);
 }
 
 static void testsuite_tool_deinit(void)
@@ -82,7 +82,7 @@
 static void print_help(void)
 {
 	printf(
-"Usage: testsuite [-d <dump filename>] <scriptfile>\n"
+"Usage: testsuite [-t][-E][-d <dump filename>] <scriptfile>\n"
 	);
 }
 
@@ -136,11 +136,11 @@
 	const char *user, *home, *errstr;
 	struct sieve_binary *sbin;
 	const char *sieve_dir;
-	bool trace = FALSE;
+	bool trace = FALSE, log_stdout = FALSE;
 	int ret, c;
 
 	master_service = master_service_init
-		("testsuite", MASTER_SERVICE_FLAG_STANDALONE, &argc, &argv, "d:x:t");
+		("testsuite", MASTER_SERVICE_FLAG_STANDALONE, &argc, &argv, "d:x:tE");
 
 	user = getenv("USER");
 
@@ -160,6 +160,9 @@
 		case 't':
 			trace = TRUE;
 			break;
+		case 'E':
+			log_stdout = TRUE;
+			break;
 		default:
 			print_help();
 			i_fatal_status(EX_USAGE,
@@ -202,7 +205,7 @@
 		i_fatal("%s", errstr);
 
 	/* Initialize testsuite */
-	testsuite_tool_init(extensions);
+	testsuite_tool_init(extensions, log_stdout);
 
 	printf("Test case: %s:\n\n", scriptfile);
 


More information about the dovecot-cvs mailing list