[Guessnet-devel] [svn] r168 - in trunk: . src

Enrico Zini enrico at costa.debian.org
Sat Sep 23 13:12:56 UTC 2006


Author: enrico
Date: Sat Sep 23 13:12:55 2006
New Revision: 168

Modified:
   trunk/   (props changed)
   trunk/src/ProcessRunner.cc
   trunk/src/ProcessRunner.h
   trunk/src/ScriptScanner.cc
   trunk/src/ScriptScanner.h
Log:
 r434 at viaza:  enrico | 2006-09-23 14:07:46 +0100
 Added more debug and verbose calls


Modified: trunk/src/ProcessRunner.cc
==============================================================================
--- trunk/src/ProcessRunner.cc	(original)
+++ trunk/src/ProcessRunner.cc	Sat Sep 23 13:12:55 2006
@@ -1,7 +1,7 @@
 /*
  * Run test scripts in parallel
  *
- * Copyright (C) 2003  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006  Enrico Zini <enrico at debian.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,9 +36,6 @@
 using namespace std;
 using namespace wibble::sys;
 
-//#define DEBUG(args...) fprintf(stderr, ##args)
-#define DEBUG(args...) do {} while(0)
-
 static bool canRun(const string& cmdline)
 {
 	size_t pos = cmdline.find(' ');
@@ -71,7 +68,7 @@
 		cmd.env.push_back("GUESSNET=true");
 		cmd.env.push_back(string("PATH=") + SCRIPTDIR + ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
 
-		DEBUG("SCRIPT MAIN Running %.*s\n", PFSTR(cmdline));
+		debug("SCRIPT MAIN Running %s\n", cmdline.c_str());
 
 		cmd.exec();
 	} catch (std::exception& e) {
@@ -122,7 +119,7 @@
 			{
 				MutexLock lock(listenersMutex);
 				requested_shutdown = true;
-				DEBUG("PRI asked for shutdown\n");
+				debug("PRI asked for shutdown\n");
 			}
 			// FIXME: if someone has a cleaner ideas...
 			//kill(SIGCHLD);
@@ -157,7 +154,7 @@
 		MutexLock lock(listenersMutex);
 		queuedForRunning.push(ProcData(tag, cmdline, pl));
 		listenersCond.broadcast();
-		DEBUG("PRI added process %.*s: %.*s\n", PFSTR(tag), PFSTR(cmdline));
+		debug("PRI added process %s: %s\n", tag.c_str(), cmdline.c_str());
 	}
 	// FIXME: if someone has a cleaner ideas...
 	//kill(SIGCHLD);
@@ -193,25 +190,25 @@
 
 	while (true)
 	{
-		DEBUG("PRI Main Loop\n");
+		debug("PRI Main Loop\n");
 		bool want_shutdown = false;
 		try {
 			{
 				// Wait for some child process to be run
 				MutexLock lock(listenersMutex);
 
-				DEBUG("PRI Check Requested Shutdown\n");
+				debug("PRI Check Requested Shutdown\n");
 
 				if (requested_shutdown)
 				{
-					DEBUG("PRI Requested Shutdown\n");
+					debug("PRI Requested Shutdown\n");
 					want_shutdown = true;
 					requested_shutdown = false;
 				} else {
-					DEBUG("PRI Run queued processes\n");
+					debug("PRI Run queued processes\n");
 					while (!queuedForRunning.empty())
 					{
-						DEBUG("PRI Run a queued process\n");
+						debug("PRI Run a queued process\n");
 						ProcData d = queuedForRunning.front();
 						queuedForRunning.pop();
 						d.run();
@@ -223,26 +220,26 @@
 
 			if (want_shutdown)
 			{
-				DEBUG("PRI Perform shutdown\n");
+				debug("PRI Perform shutdown\n");
 				debug("Requested shutdown\n");
 				for (map<pid_t, ProcData>::iterator i = proclist.begin();
 						i != proclist.end(); i++)
 				{
-					DEBUG("PRI Perform shutdown of %s\n", i->second.tag.c_str());
+					debug("PRI Perform shutdown of %s\n", i->second.tag.c_str());
 					debug("still running: %s (%d)\n", i->second.tag.c_str(), i->second.script->pid());
 					i->second.script->kill(9);
 					i->second.script->wait();
 					delete i->second.script;
-					DEBUG("PRI Performed shutdown of %s\n", i->second.tag.c_str());
+					debug("PRI Performed shutdown of %s\n", i->second.tag.c_str());
 				}
 				proclist.clear();
-				DEBUG("PRI Performed shutdown\n");
+				debug("PRI Performed shutdown\n");
 				return 0;
 			}
 
 			//fprintf(stderr, "There are %d processes\n", proclist.size());
 			
-			DEBUG("PRI Checking Children\n");
+			debug("PRI Checking Children\n");
 
 			pid_t pid = 0;
 			int status;

Modified: trunk/src/ProcessRunner.h
==============================================================================
--- trunk/src/ProcessRunner.h	(original)
+++ trunk/src/ProcessRunner.h	Sat Sep 23 13:12:55 2006
@@ -4,7 +4,7 @@
 /*
  * Run test scripts in parallel
  *
- * Copyright (C) 2003  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006  Enrico Zini <enrico at debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

Modified: trunk/src/ScriptScanner.cc
==============================================================================
--- trunk/src/ScriptScanner.cc	(original)
+++ trunk/src/ScriptScanner.cc	Sat Sep 23 13:12:55 2006
@@ -1,7 +1,7 @@
 /*
  * Tester that delegates testing to an external script
  *
- * Copyright (C) 2003  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006  Enrico Zini <enrico at debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
  */
 
 #include "ScriptScanner.h"
+#include "Environment.h"
 
 using namespace std;
 using namespace wibble::sys;
@@ -28,6 +29,8 @@
 {
 	MutexLock lock(candMutex);
 
+	verbose("script %s terminated with status %d\n", signature.c_str(), status);
+
 	if (status != 0)
 		return;
 

Modified: trunk/src/ScriptScanner.h
==============================================================================
--- trunk/src/ScriptScanner.h	(original)
+++ trunk/src/ScriptScanner.h	Sat Sep 23 13:12:55 2006
@@ -4,7 +4,7 @@
 /*
  * Tester that delegates testing to an external script
  *
- * Copyright (C) 2003  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006  Enrico Zini <enrico at debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by



More information about the Guessnet-devel mailing list